Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,6 +78,11 @@ if uploaded_file is not None:
|
|
| 78 |
X = df_cleaned[features]
|
| 79 |
y = df_cleaned[target]
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
# Determine if the target is continuous or categorical
|
| 82 |
is_classification = len(y.unique()) <= 10 # If target has fewer than or equal to 10 unique values, treat as classification
|
| 83 |
|
|
@@ -154,7 +159,7 @@ if uploaded_file is not None:
|
|
| 154 |
# Download correlation heatmap
|
| 155 |
st.subheader("Correlation Heatmap")
|
| 156 |
correlation_matrix = df_cleaned.select_dtypes(include=['number']).corr()
|
| 157 |
-
fig, ax = plt.subplots(figsize=(
|
| 158 |
sns.heatmap(correlation_matrix, annot=True, fmt=".2f", cmap="coolwarm", ax=ax)
|
| 159 |
st.pyplot(fig)
|
| 160 |
fig.savefig("/tmp/correlation_heatmap.png")
|
|
|
|
| 78 |
X = df_cleaned[features]
|
| 79 |
y = df_cleaned[target]
|
| 80 |
|
| 81 |
+
# Remove rows where target variable y contains NaN
|
| 82 |
+
df_cleaned = df_cleaned.dropna(subset=[target])
|
| 83 |
+
X = df_cleaned[features]
|
| 84 |
+
y = df_cleaned[target]
|
| 85 |
+
|
| 86 |
# Determine if the target is continuous or categorical
|
| 87 |
is_classification = len(y.unique()) <= 10 # If target has fewer than or equal to 10 unique values, treat as classification
|
| 88 |
|
|
|
|
| 159 |
# Download correlation heatmap
|
| 160 |
st.subheader("Correlation Heatmap")
|
| 161 |
correlation_matrix = df_cleaned.select_dtypes(include=['number']).corr()
|
| 162 |
+
fig, ax = plt.subplots(figsize=(8, 6))
|
| 163 |
sns.heatmap(correlation_matrix, annot=True, fmt=".2f", cmap="coolwarm", ax=ax)
|
| 164 |
st.pyplot(fig)
|
| 165 |
fig.savefig("/tmp/correlation_heatmap.png")
|