Spaces:
Sleeping
Sleeping
Commit
·
1ededbc
1
Parent(s):
58ec90d
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import sklearn
|
|
6 |
import xgboost
|
7 |
import shap
|
8 |
from shap_plots import shap_summary_plot
|
|
|
9 |
import plotly.tools as tls
|
10 |
import dash_core_components as dcc
|
11 |
import matplotlib
|
@@ -111,8 +112,9 @@ if len(gene_list) > 1:
|
|
111 |
print(df_shap.columns)
|
112 |
shap_values = explainer.shap_values(df_shap)
|
113 |
#summary_plot = shap.summary_plot(shap_values, df_shap)
|
114 |
-
summary_plot = shap_summary_plot(shap_values, features=df_shap, feature_names=df_shap.columns, max_display=8)
|
115 |
-
|
|
|
116 |
st.caption("SHAP Summary Plot of All Input Genes")
|
117 |
feature_order = np.argsort(np.sum(np.abs(shap_values), axis=0)[:-1])
|
118 |
feature_order = feature_order[-min(8, len(feature_order)):]
|
|
|
6 |
import xgboost
|
7 |
import shap
|
8 |
from shap_plots import shap_summary_plot
|
9 |
+
from dynamic_shap_plot import matplotlib_to_plotly, summary_plot_plotly_fig
|
10 |
import plotly.tools as tls
|
11 |
import dash_core_components as dcc
|
12 |
import matplotlib
|
|
|
112 |
print(df_shap.columns)
|
113 |
shap_values = explainer.shap_values(df_shap)
|
114 |
#summary_plot = shap.summary_plot(shap_values, df_shap)
|
115 |
+
#summary_plot = shap_summary_plot(shap_values, features=df_shap, feature_names=df_shap.columns, max_display=8)
|
116 |
+
dynamic_plot = summary_plot_plotly_fig(shap_values, df_shap=df_shap, feature_names=df_shap.columns)
|
117 |
+
st.pyplot(fig=dynamic_plot)
|
118 |
st.caption("SHAP Summary Plot of All Input Genes")
|
119 |
feature_order = np.argsort(np.sum(np.abs(shap_values), axis=0)[:-1])
|
120 |
feature_order = feature_order[-min(8, len(feature_order)):]
|