forked from explainX/explainx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsummary_plot.py
46 lines (26 loc) · 1.01 KB
/
summary_plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from imports import *
from rescale_numeric_feature import *
"""
This class helps to plot summary plot
Input:
"""
class summary_plot():
def __init__(self):
super(summary_plot, self).__init__()
self.param= None
self.original_columns= None
def find(self, df):
column = get_cols()
self.original_columns = column.get_all_cols(df)
re= rescale_numeric_features()
df_with_rescaled_features= re.rescale(df)
final_dataframe= self.rearrange_dataframe(df_with_rescaled_features )
return final_dataframe
def rearrange_dataframe(self, df_re ):
df_final = pd.DataFrame()
for v in self.original_columns:
df_single = df_re[[v, v + '_rescaled', v + '_impact']]
df_single["Variable Name"] = v
df_single.columns = ['Original Feature Value', 'Rescaled Feature Value', 'Feature Impact on Outcome', 'Feature Name']
df_final = pd.concat([df_final, df_single])
return df_final