ttd22 commited on
Commit
a270b83
1 Parent(s): 99b460a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -20
app.py CHANGED
@@ -69,31 +69,24 @@ input_val = buil_UI(X)
69
 
70
  if st.button('Calculate House Price'):
71
  predictLGBM = model.predict(input_val)
 
 
72
  st.write(st.write('Predicted house price is: $',predictLGBM[0]))
73
-
 
74
  shap_values = shap.TreeExplainer(model).shap_values(input_val)
75
- # st_shap(shap.plots.beeswarm(shap_values), height=300)
76
  fig_summary = shap.summary_plot(shap_values, input_val)
77
  st.pyplot(fig_summary)
78
 
79
  shap_interaction_values = shap.TreeExplainer(model).shap_interaction_values(input_val.iloc[:,:])
80
- # st_shap(shap.summary_plot(shap_interaction_values, input_val.iloc[:,:]), height=400)
81
  interaction_fig = shap.summary_plot(shap_interaction_values, input_val.iloc[:,:])
82
  st.pyplot(interaction_fig)
83
-
84
- # compute SHAP values
85
- # explainer = shap.Explainer(model, input_val)
86
- # shap_values = explainer(input_val)
87
-
88
- # st_shap(shap.plots.waterfall(shap_values[0]), height=300)
89
- # st_shap(shap.plots.beeswarm(shap_values), height=300)
90
-
91
-
92
- # shap_interaction_values = shap.TreeExplainer(model).shap_interaction_values(input_val.iloc[:,:])
93
- # shap.summary_plot(shap_interaction_values, input_val.iloc[:,:])
94
-
95
-
96
-
97
- # shap_values = shap.TreeExplainer(model,feature_perturbation="tree_path_dependent").shap_values(X)
98
- # st_shap(shap.force_plot(explainer.expected_value, shap_values[0,:], X_display.iloc[0,:]), height=200, width=1000)
99
- # st_shap(shap.force_plot(explainer.expected_value, shap_values[:1000,:], X_display.iloc[:1000,:]), height=400, width=1000)
 
69
 
70
  if st.button('Calculate House Price'):
71
  predictLGBM = model.predict(input_val)
72
+ # submissionLGBM = pd.DataFrame({'SalePrice':predictLGBM})
73
+ # result = submissionLGBM.iloc[0].values
74
  st.write(st.write('Predicted house price is: $',predictLGBM[0]))
75
+
76
+ #input_val
77
  shap_values = shap.TreeExplainer(model).shap_values(input_val)
 
78
  fig_summary = shap.summary_plot(shap_values, input_val)
79
  st.pyplot(fig_summary)
80
 
81
  shap_interaction_values = shap.TreeExplainer(model).shap_interaction_values(input_val.iloc[:,:])
 
82
  interaction_fig = shap.summary_plot(shap_interaction_values, input_val.iloc[:,:])
83
  st.pyplot(interaction_fig)
84
+
85
+ # X
86
+ shap_values_X = shap.TreeExplainer(model).shap_values(X)
87
+ fig_summary_X = shap.summary_plot(shap_values_X, X)
88
+ st.pyplot(fig_summary_X)
89
+
90
+ shap_interaction_values_X = shap.TreeExplainer(model).shap_interaction_values(X.iloc[:,:])
91
+ interaction_fig_X = shap.summary_plot(shap_interaction_values_X, X.iloc[:,:])
92
+ st.pyplot(interaction_fig_X)