Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -79,7 +79,7 @@ if uploaded_file is not None:
|
|
| 79 |
y = df_cleaned[target]
|
| 80 |
|
| 81 |
# Determine if the target is continuous or categorical
|
| 82 |
-
is_classification = y.
|
| 83 |
|
| 84 |
# Ensure there is enough data before proceeding with train-test split
|
| 85 |
if len(X) == 0 or len(y) == 0:
|
|
@@ -165,18 +165,15 @@ if uploaded_file is not None:
|
|
| 165 |
mime="image/png"
|
| 166 |
)
|
| 167 |
|
| 168 |
-
#
|
| 169 |
-
st.subheader("
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
file_name=f"{column}_histogram.png",
|
| 181 |
-
mime="image/png"
|
| 182 |
-
)
|
|
|
|
| 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 |
|
| 84 |
# Ensure there is enough data before proceeding with train-test split
|
| 85 |
if len(X) == 0 or len(y) == 0:
|
|
|
|
| 165 |
mime="image/png"
|
| 166 |
)
|
| 167 |
|
| 168 |
+
# Pair plot of numerical columns to visualize relationships
|
| 169 |
+
st.subheader("Pair Plot of Numerical Columns")
|
| 170 |
+
pair_plot = sns.pairplot(df_cleaned[features]) # Generate pair plot for features
|
| 171 |
+
st.pyplot(pair_plot)
|
| 172 |
+
pair_plot.savefig("/tmp/pair_plot.png")
|
| 173 |
+
with open("/tmp/pair_plot.png", "rb") as f:
|
| 174 |
+
st.download_button(
|
| 175 |
+
label="Download Pair Plot",
|
| 176 |
+
data=f,
|
| 177 |
+
file_name="pair_plot.png",
|
| 178 |
+
mime="image/png"
|
| 179 |
+
)
|
|
|
|
|
|
|
|
|