Roberta2024 commited on
Commit
2c3f886
·
verified ·
1 Parent(s): b74de29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
  import pandas as pd
3
  import plotly.express as px
4
- import seaborn as sns
5
  from sklearn.ensemble import RandomForestClassifier
6
  from xgboost import XGBClassifier
7
  from sklearn.tree import DecisionTreeClassifier
@@ -57,11 +57,10 @@ if uploaded_file is not None:
57
  # Process the file and get results
58
  rf_importance, xgb_importance, cart_importance, corr_matrix = calculate_importances(uploaded_file)
59
 
60
- # Display the correlation matrix as a heatmap (static for now)
61
  st.write("Correlation Matrix:")
62
- plt.figure(figsize=(10, 8))
63
- sns.heatmap(corr_matrix, annot=True, fmt=".2f", cmap="coolwarm", cbar=True)
64
- st.pyplot(plt)
65
 
66
  # Plot and display Random Forest Feature Importances with Plotly
67
  st.write("Random Forest Feature Importance:")
 
1
  import streamlit as st
2
  import pandas as pd
3
  import plotly.express as px
4
+ import plotly.graph_objects as go
5
  from sklearn.ensemble import RandomForestClassifier
6
  from xgboost import XGBClassifier
7
  from sklearn.tree import DecisionTreeClassifier
 
57
  # Process the file and get results
58
  rf_importance, xgb_importance, cart_importance, corr_matrix = calculate_importances(uploaded_file)
59
 
60
+ # Display the correlation matrix as an interactive heatmap with Plotly
61
  st.write("Correlation Matrix:")
62
+ fig_corr = px.imshow(corr_matrix, text_auto=True, aspect="auto", title="Correlation Matrix", color_continuous_scale="coolwarm")
63
+ st.plotly_chart(fig_corr)
 
64
 
65
  # Plot and display Random Forest Feature Importances with Plotly
66
  st.write("Random Forest Feature Importance:")