Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,19 +46,19 @@ def predict_new_values(new_input_data):
|
|
| 46 |
# Scale the new input data
|
| 47 |
new_input_scaled = scaler_X.transform(new_input_data)
|
| 48 |
print(f"Scaled Input Data: {new_input_scaled}")
|
| 49 |
-
|
| 50 |
# Make predictions with both base models
|
| 51 |
mlp_predictions_new = loaded_mlp_model.predict(new_input_scaled)
|
| 52 |
rf_predictions_new = loaded_rf_model.predict(new_input_scaled)
|
| 53 |
-
|
| 54 |
# Combine the predictions
|
| 55 |
combined_features_new = np.concatenate([mlp_predictions_new, rf_predictions_new], axis=1)
|
| 56 |
print(f"Combined Features: {combined_features_new}")
|
| 57 |
-
|
| 58 |
# Use the loaded meta model to make predictions on the new data
|
| 59 |
loaded_meta_predictions_new = loaded_meta_model.predict(combined_features_new)
|
| 60 |
print(f"Meta Model Predictions: {loaded_meta_predictions_new}")
|
| 61 |
-
|
| 62 |
return loaded_meta_predictions_new[0]
|
| 63 |
except Exception as e:
|
| 64 |
print(f"Error in prediction: {e}")
|
|
|
|
| 46 |
# Scale the new input data
|
| 47 |
new_input_scaled = scaler_X.transform(new_input_data)
|
| 48 |
print(f"Scaled Input Data: {new_input_scaled}")
|
| 49 |
+
|
| 50 |
# Make predictions with both base models
|
| 51 |
mlp_predictions_new = loaded_mlp_model.predict(new_input_scaled)
|
| 52 |
rf_predictions_new = loaded_rf_model.predict(new_input_scaled)
|
| 53 |
+
|
| 54 |
# Combine the predictions
|
| 55 |
combined_features_new = np.concatenate([mlp_predictions_new, rf_predictions_new], axis=1)
|
| 56 |
print(f"Combined Features: {combined_features_new}")
|
| 57 |
+
|
| 58 |
# Use the loaded meta model to make predictions on the new data
|
| 59 |
loaded_meta_predictions_new = loaded_meta_model.predict(combined_features_new)
|
| 60 |
print(f"Meta Model Predictions: {loaded_meta_predictions_new}")
|
| 61 |
+
|
| 62 |
return loaded_meta_predictions_new[0]
|
| 63 |
except Exception as e:
|
| 64 |
print(f"Error in prediction: {e}")
|