Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import streamlit as st
|
|
| 2 |
import pandas as pd
|
| 3 |
from pycaret.classification import setup as classification_setup, compare_models as compare_classification_models, evaluate_model as evaluate_classification_model, save_model as save_classification_model, plot_model as plot_classification_model
|
| 4 |
from pycaret.regression import setup as regression_setup, compare_models as compare_regression_models, evaluate_model as evaluate_regression_model, save_model as save_regression_model, plot_model as plot_regression_model
|
| 5 |
-
from pycaret.clustering import setup as clustering_setup,
|
| 6 |
from ydata_profiling import ProfileReport
|
| 7 |
from streamlit_pandas_profiling import st_profile_report
|
| 8 |
import os
|
|
@@ -81,11 +81,15 @@ elif app_mode == "Model Training":
|
|
| 81 |
elif st.session_state['problem_type'] == "Regression":
|
| 82 |
best_model = compare_regression_models()
|
| 83 |
elif st.session_state['problem_type'] == "Clustering":
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
if 'best_model' in st.session_state:
|
| 89 |
st.subheader("Model Evaluation")
|
| 90 |
if st.button("Evaluate Model"):
|
| 91 |
with st.spinner("Evaluating model..."):
|
|
@@ -110,8 +114,8 @@ elif app_mode == "Model Training":
|
|
| 110 |
|
| 111 |
elif app_mode == "Validation & Exploration":
|
| 112 |
st.title("🔍 Validation & Exploration")
|
| 113 |
-
if 'best_model' not in st.session_state:
|
| 114 |
-
st.warning("Please train a model first.")
|
| 115 |
st.stop()
|
| 116 |
|
| 117 |
st.subheader("Model Performance")
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
from pycaret.classification import setup as classification_setup, compare_models as compare_classification_models, evaluate_model as evaluate_classification_model, save_model as save_classification_model, plot_model as plot_classification_model
|
| 4 |
from pycaret.regression import setup as regression_setup, compare_models as compare_regression_models, evaluate_model as evaluate_regression_model, save_model as save_regression_model, plot_model as plot_regression_model
|
| 5 |
+
from pycaret.clustering import setup as clustering_setup, evaluate_model as evaluate_clustering_model, save_model as save_clustering_model, plot_model as plot_clustering_model
|
| 6 |
from ydata_profiling import ProfileReport
|
| 7 |
from streamlit_pandas_profiling import st_profile_report
|
| 8 |
import os
|
|
|
|
| 81 |
elif st.session_state['problem_type'] == "Regression":
|
| 82 |
best_model = compare_regression_models()
|
| 83 |
elif st.session_state['problem_type'] == "Clustering":
|
| 84 |
+
st.info("Model comparison is not available for clustering. Please proceed with evaluation or create a model manually.")
|
| 85 |
+
best_model = None
|
| 86 |
+
else:
|
| 87 |
+
best_model = None
|
| 88 |
+
if best_model is not None:
|
| 89 |
+
st.session_state['best_model'] = best_model
|
| 90 |
+
st.success(f"Best Model: {best_model}")
|
| 91 |
|
| 92 |
+
if 'best_model' in st.session_state and st.session_state['best_model'] is not None:
|
| 93 |
st.subheader("Model Evaluation")
|
| 94 |
if st.button("Evaluate Model"):
|
| 95 |
with st.spinner("Evaluating model..."):
|
|
|
|
| 114 |
|
| 115 |
elif app_mode == "Validation & Exploration":
|
| 116 |
st.title("🔍 Validation & Exploration")
|
| 117 |
+
if 'best_model' not in st.session_state or st.session_state['best_model'] is None:
|
| 118 |
+
st.warning("Please train a model first. Note: Clustering does not support automatic model comparison.")
|
| 119 |
st.stop()
|
| 120 |
|
| 121 |
st.subheader("Model Performance")
|