Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1041,15 +1041,15 @@ elif app_mode == "Model Training":
|
|
| 1041 |
|
| 1042 |
# In Model Training section - Fix indentation for training logic
|
| 1043 |
if st.button("Train Model"):
|
| 1044 |
-
|
| 1045 |
-
|
| 1046 |
-
|
| 1047 |
-
|
| 1048 |
-
|
| 1049 |
-
|
| 1050 |
-
|
| 1051 |
-
|
| 1052 |
-
|
| 1053 |
|
| 1054 |
if model: # Only proceed if training was successful
|
| 1055 |
st.success("Model trained successfully!")
|
|
@@ -1080,6 +1080,8 @@ elif app_mode == "Model Training":
|
|
| 1080 |
st.metric("MSE", f"{metrics['mse']:.2f}")
|
| 1081 |
st.metric("R2", f"{metrics['r2']:.2f}")
|
| 1082 |
|
|
|
|
|
|
|
| 1083 |
# Additional model display code...
|
| 1084 |
|
| 1085 |
|
|
|
|
| 1041 |
|
| 1042 |
# In Model Training section - Fix indentation for training logic
|
| 1043 |
if st.button("Train Model"):
|
| 1044 |
+
if not features:
|
| 1045 |
+
st.error("Please select at least one feature.")
|
| 1046 |
+
st.stop()
|
| 1047 |
+
|
| 1048 |
+
# Indent all this code under the button click
|
| 1049 |
+
# Call the training function
|
| 1050 |
+
model, scaler, label_encoder, imputer_numerical, metrics, column_order, importance, X_train, y_train = train_model(
|
| 1051 |
+
df.copy(), target, features, problem_type, test_size, model_type, model_params, use_grid_search
|
| 1052 |
+
)
|
| 1053 |
|
| 1054 |
if model: # Only proceed if training was successful
|
| 1055 |
st.success("Model trained successfully!")
|
|
|
|
| 1080 |
st.metric("MSE", f"{metrics['mse']:.2f}")
|
| 1081 |
st.metric("R2", f"{metrics['r2']:.2f}")
|
| 1082 |
|
| 1083 |
+
# A
|
| 1084 |
+
|
| 1085 |
# Additional model display code...
|
| 1086 |
|
| 1087 |
|