Spaces:
Sleeping
Sleeping
Commit
·
9251b0b
1
Parent(s):
7bbae35
Update app.py
Browse files
app.py
CHANGED
@@ -130,9 +130,9 @@ if len(gene_list) > 1:
|
|
130 |
df_shap = df_total[df_total.index.isin(gene_list)]
|
131 |
df_shap.drop(columns='XGB_Score', inplace=True)
|
132 |
shap_values = explainer.shap_values(df_shap)
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
st.caption("Interactive SHAP Summary Plot of All Input Genes")
|
137 |
mpl_fig = shap_summary_plot(shap_values, df_shap, max_display=8, show=False, feature_names=df_shap.columns)
|
138 |
plotly_fig = tls.mpl_to_plotly(mpl_fig)
|
@@ -150,6 +150,7 @@ if len(gene_list) > 1:
|
|
150 |
plotly_fig['data'][i]['hoverinfo'] = 'text'
|
151 |
colorbar_trace = go.Scatter(x=[None],
|
152 |
y=col_order, # [None],
|
|
|
153 |
mode='markers',
|
154 |
marker=dict(
|
155 |
colorscale=red_blue,
|
@@ -165,7 +166,7 @@ if len(gene_list) > 1:
|
|
165 |
plotly_fig['layout']['height']=600
|
166 |
plotly_fig['layout']['width']=500
|
167 |
plotly_fig['layout']['xaxis'].update(zeroline=True, showline=True, ticklen=4, showgrid=False)
|
168 |
-
plotly_fig['layout']['yaxis'].update(dict(visible=True))
|
169 |
plotly_fig.add_trace(colorbar_trace)
|
170 |
plotly_fig.layout.update(
|
171 |
annotations=[dict(
|
|
|
130 |
df_shap = df_total[df_total.index.isin(gene_list)]
|
131 |
df_shap.drop(columns='XGB_Score', inplace=True)
|
132 |
shap_values = explainer.shap_values(df_shap)
|
133 |
+
summary_plot = shap.summary_plot(shap_values, df_shap)
|
134 |
+
st.caption("SHAP Summary Plot of All Input Genes")
|
135 |
+
st.pyplot(fig=summary_plot)
|
136 |
st.caption("Interactive SHAP Summary Plot of All Input Genes")
|
137 |
mpl_fig = shap_summary_plot(shap_values, df_shap, max_display=8, show=False, feature_names=df_shap.columns)
|
138 |
plotly_fig = tls.mpl_to_plotly(mpl_fig)
|
|
|
150 |
plotly_fig['data'][i]['hoverinfo'] = 'text'
|
151 |
colorbar_trace = go.Scatter(x=[None],
|
152 |
y=col_order, # [None],
|
153 |
+
visible=True,
|
154 |
mode='markers',
|
155 |
marker=dict(
|
156 |
colorscale=red_blue,
|
|
|
166 |
plotly_fig['layout']['height']=600
|
167 |
plotly_fig['layout']['width']=500
|
168 |
plotly_fig['layout']['xaxis'].update(zeroline=True, showline=True, ticklen=4, showgrid=False)
|
169 |
+
plotly_fig['layout']['yaxis'].update(y=col_order, dict(visible=True))
|
170 |
plotly_fig.add_trace(colorbar_trace)
|
171 |
plotly_fig.layout.update(
|
172 |
annotations=[dict(
|