Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,14 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
from utils.data_cleaning import handle_missing_values, remove_outliers_iqr, cap_extreme_values
|
| 4 |
-
from utils.visualizations import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
from utils.model_training import train_all_models
|
| 6 |
import io
|
| 7 |
|
|
@@ -54,6 +61,51 @@ if uploaded_file is not None:
|
|
| 54 |
mime="image/png"
|
| 55 |
)
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
# Select Target and Features
|
| 58 |
st.subheader("Feature and Target Selection")
|
| 59 |
target = st.selectbox("Select Target Variable", df_cleaned.columns)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
from utils.data_cleaning import handle_missing_values, remove_outliers_iqr, cap_extreme_values
|
| 4 |
+
from utils.visualizations import (
|
| 5 |
+
plot_correlation_heatmap,
|
| 6 |
+
plot_histogram,
|
| 7 |
+
plot_box_plot,
|
| 8 |
+
plot_pair_plot,
|
| 9 |
+
plot_scatter_plot,
|
| 10 |
+
plot_bar_plot,
|
| 11 |
+
)
|
| 12 |
from utils.model_training import train_all_models
|
| 13 |
import io
|
| 14 |
|
|
|
|
| 61 |
mime="image/png"
|
| 62 |
)
|
| 63 |
|
| 64 |
+
# Additional Visualizations
|
| 65 |
+
st.subheader("Additional Visualizations")
|
| 66 |
+
|
| 67 |
+
numeric_columns = df_cleaned.select_dtypes(include=['float64', 'int64']).columns.tolist()
|
| 68 |
+
categorical_columns = df_cleaned.select_dtypes(include=['object']).columns.tolist()
|
| 69 |
+
|
| 70 |
+
# Distribution Plot
|
| 71 |
+
if numeric_columns:
|
| 72 |
+
st.write("### Distribution Plots (Histograms)")
|
| 73 |
+
for col in numeric_columns:
|
| 74 |
+
st.write(f"#### {col}")
|
| 75 |
+
hist_plot = plot_histogram(df_cleaned, col)
|
| 76 |
+
st.pyplot(hist_plot)
|
| 77 |
+
|
| 78 |
+
# Box Plot
|
| 79 |
+
if numeric_columns:
|
| 80 |
+
st.write("### Box Plots (Outlier Detection)")
|
| 81 |
+
for col in numeric_columns:
|
| 82 |
+
st.write(f"#### {col}")
|
| 83 |
+
box_plot = plot_box_plot(df_cleaned, col)
|
| 84 |
+
st.pyplot(box_plot)
|
| 85 |
+
|
| 86 |
+
# Pair Plot
|
| 87 |
+
if len(numeric_columns) > 1:
|
| 88 |
+
st.write("### Pair Plot")
|
| 89 |
+
pair_plot = plot_pair_plot(df_cleaned)
|
| 90 |
+
st.pyplot(pair_plot)
|
| 91 |
+
|
| 92 |
+
# Scatter Plot
|
| 93 |
+
if len(numeric_columns) > 1:
|
| 94 |
+
st.write("### Scatter Plot")
|
| 95 |
+
x_col = st.selectbox("Select X-axis for Scatter Plot", numeric_columns)
|
| 96 |
+
y_col = st.selectbox("Select Y-axis for Scatter Plot", numeric_columns)
|
| 97 |
+
if x_col and y_col:
|
| 98 |
+
scatter_plot = plot_scatter_plot(df_cleaned, x_col, y_col)
|
| 99 |
+
st.pyplot(scatter_plot)
|
| 100 |
+
|
| 101 |
+
# Bar Plot
|
| 102 |
+
if categorical_columns:
|
| 103 |
+
st.write("### Bar Plots (For Categorical Data)")
|
| 104 |
+
for col in categorical_columns:
|
| 105 |
+
st.write(f"#### {col}")
|
| 106 |
+
bar_plot = plot_bar_plot(df_cleaned, col)
|
| 107 |
+
st.pyplot(bar_plot)
|
| 108 |
+
|
| 109 |
# Select Target and Features
|
| 110 |
st.subheader("Feature and Target Selection")
|
| 111 |
target = st.selectbox("Select Target Variable", df_cleaned.columns)
|