Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -106,7 +106,8 @@ if uploaded_file is not None:
|
|
| 106 |
st.subheader("Highly Correlated Features")
|
| 107 |
high_corr = corr.abs().unstack().sort_values(ascending=False).drop_duplicates()
|
| 108 |
high_corr = high_corr[high_corr.index.get_level_values(0) != high_corr.index.get_level_values(1)]
|
| 109 |
-
|
|
|
|
| 110 |
|
| 111 |
target = st.selectbox("Select Target Variable", df.columns)
|
| 112 |
features = [col for col in df.columns if col != target]
|
|
@@ -164,12 +165,23 @@ if uploaded_file is not None:
|
|
| 164 |
# Visualization (Bar Graphs for Classification)
|
| 165 |
st.subheader("Classification Model Performance Metrics Graph")
|
| 166 |
metrics_df.set_index('Model', inplace=True)
|
| 167 |
-
metrics_df.plot(kind='bar', figsize=(10, 6), colormap='
|
| 168 |
plt.title("Classification Models - Performance Metrics")
|
| 169 |
plt.ylabel("Scores")
|
| 170 |
plt.xlabel("Models")
|
| 171 |
st.pyplot(plt)
|
| 172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
else: # Continuous target (regression)
|
| 174 |
st.subheader("Regression Model Training")
|
| 175 |
regressors = {
|
|
@@ -215,7 +227,7 @@ if uploaded_file is not None:
|
|
| 215 |
file_name="regression_metrics_table.png",
|
| 216 |
mime="image/png"
|
| 217 |
)
|
| 218 |
-
|
| 219 |
# Visualization (Bar Graphs for Regression)
|
| 220 |
st.subheader("Regression Model Performance Metrics Graph")
|
| 221 |
regression_metrics_df.set_index('Model', inplace=True)
|
|
@@ -224,3 +236,14 @@ if uploaded_file is not None:
|
|
| 224 |
plt.ylabel("Scores")
|
| 225 |
plt.xlabel("Models")
|
| 226 |
st.pyplot(plt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
st.subheader("Highly Correlated Features")
|
| 107 |
high_corr = corr.abs().unstack().sort_values(ascending=False).drop_duplicates()
|
| 108 |
high_corr = high_corr[high_corr.index.get_level_values(0) != high_corr.index.get_level_values(1)]
|
| 109 |
+
high_corr_df = pd.DataFrame(high_corr)
|
| 110 |
+
st.write(high_corr_df)
|
| 111 |
|
| 112 |
target = st.selectbox("Select Target Variable", df.columns)
|
| 113 |
features = [col for col in df.columns if col != target]
|
|
|
|
| 165 |
# Visualization (Bar Graphs for Classification)
|
| 166 |
st.subheader("Classification Model Performance Metrics Graph")
|
| 167 |
metrics_df.set_index('Model', inplace=True)
|
| 168 |
+
ax = metrics_df.plot(kind='bar', figsize=(10, 6), colormap='coolwarm', rot=45)
|
| 169 |
plt.title("Classification Models - Performance Metrics")
|
| 170 |
plt.ylabel("Scores")
|
| 171 |
plt.xlabel("Models")
|
| 172 |
st.pyplot(plt)
|
| 173 |
|
| 174 |
+
# Download button for the bar graph
|
| 175 |
+
buf = BytesIO()
|
| 176 |
+
ax.figure.savefig(buf, format="png")
|
| 177 |
+
buf.seek(0)
|
| 178 |
+
st.download_button(
|
| 179 |
+
label="Download Classification Performance Graph as PNG",
|
| 180 |
+
data=buf,
|
| 181 |
+
file_name="classification_performance_graph.png",
|
| 182 |
+
mime="image/png"
|
| 183 |
+
)
|
| 184 |
+
|
| 185 |
else: # Continuous target (regression)
|
| 186 |
st.subheader("Regression Model Training")
|
| 187 |
regressors = {
|
|
|
|
| 227 |
file_name="regression_metrics_table.png",
|
| 228 |
mime="image/png"
|
| 229 |
)
|
| 230 |
+
|
| 231 |
# Visualization (Bar Graphs for Regression)
|
| 232 |
st.subheader("Regression Model Performance Metrics Graph")
|
| 233 |
regression_metrics_df.set_index('Model', inplace=True)
|
|
|
|
| 236 |
plt.ylabel("Scores")
|
| 237 |
plt.xlabel("Models")
|
| 238 |
st.pyplot(plt)
|
| 239 |
+
|
| 240 |
+
# Download button for the bar graph
|
| 241 |
+
buf = BytesIO()
|
| 242 |
+
plt.savefig(buf, format="png")
|
| 243 |
+
buf.seek(0)
|
| 244 |
+
st.download_button(
|
| 245 |
+
label="Download Regression Performance Graph as PNG",
|
| 246 |
+
data=buf,
|
| 247 |
+
file_name="regression_performance_graph.png",
|
| 248 |
+
mime="image/png"
|
| 249 |
+
)
|