Skip to content

Commit

Permalink
feature importanceV3
Browse files Browse the repository at this point in the history
MarkoBrie committed Mar 27, 2024
1 parent 1ecbdbb commit 711954b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions 3_Streamlit_dashboard/3_STREAMlit_dashboard.py
Original file line number Diff line number Diff line change
@@ -314,11 +314,19 @@ def main():
st.write("feature importance")
st.write(pred['importance'])

feature_importance_df = pd.DataFrame({
'Feature': feature_name,
'Importance': pred['importance']
})
st.write(feature_importance_df.sort_values(by=['Importance']))
feature_importance_df = pd.DataFrame({'Feature': feature_name['0'].tolist(), 'Importance': pred['importance']})
FI_sorted = feature_importance_df.sort_values(by=['Importance'], ascending=False)
FI_sorted = FI_sorted[:20]
st.write(FI_sorted)


fig = go.Figure(go.Bar(
x=FI_sorted['Importance'],
y=FI_sorted['Feature'],
orientation='h'))
st.plotly_chart(fig)



col1, col2, col3 = st.columns(3)
col1.metric(label= "Score", value= score, delta=(str((score-threshold)/threshold)+" %"), delta_color="normal", help=None, label_visibility="visible")

0 comments on commit 711954b

Please sign in to comment.