hlnicholls commited on
Commit
70d322c
·
1 Parent(s): c29c407

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -131,6 +131,9 @@ if len(gene_list) > 1:
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")
@@ -140,9 +143,6 @@ if len(gene_list) > 1:
140
  max_display=8
141
  feature_names=df_shap.columns
142
  gene_index = df_shap.index
143
- feature_order = np.argsort(np.sum(np.abs(shap_values), axis=0)[:-1])
144
- feature_order = feature_order[-min(8, len(feature_order)):]
145
- col_order = [df.columns[i] for i in feature_order]
146
  for i in range(1, len(plotly_fig['data']), 2):
147
  t = gene_index #plotly_fig['data']
148
  plotly_fig['data'][i]['name'] = ''
 
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
+ feature_order = np.argsort(np.sum(np.abs(shap_values), axis=0)[:-1])
135
+ feature_order = feature_order[-min(8, len(feature_order)):]
136
+ col_order = [df.columns[i] for i in feature_order]
137
  st.caption("SHAP Summary Plot of All Input Genes")
138
  st.pyplot(fig=summary_plot)
139
  st.caption("Interactive SHAP Summary Plot of All Input Genes")
 
143
  max_display=8
144
  feature_names=df_shap.columns
145
  gene_index = df_shap.index
 
 
 
146
  for i in range(1, len(plotly_fig['data']), 2):
147
  t = gene_index #plotly_fig['data']
148
  plotly_fig['data'][i]['name'] = ''