diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/models/train_and_save_model.py b/models/train_and_save_model.py index e26d5f9..fec57f6 100644 --- a/models/train_and_save_model.py +++ b/models/train_and_save_model.py @@ -13,7 +13,7 @@ from sklearn.model_selection import train_test_split def load_and_preprocess_data(): """Load and preprocess the data exactly as done in the notebook""" # Load data - data_file_name_path = "../data/data.csv" + data_file_name_path = "../../../data/data.csv" master_raw_data = pd.read_csv(data_file_name_path) data = master_raw_data.copy() diff --git a/src/components/prediction_components.py b/src/components/prediction_components.py index 2c23057..ef73aa4 100644 --- a/src/components/prediction_components.py +++ b/src/components/prediction_components.py @@ -9,10 +9,12 @@ import time import json from typing import Dict, Any, Tuple, List +from src.utils.models_utils import preprocess_input, generate_recommendations, validate_input + def render_prediction_section(model, preprocessing_info, user_input: Dict[str, Any]) -> None: """Render the prediction section with enhanced animations""" - from ..utils.model_utils import preprocess_input, generate_recommendations + # Prediction button with enhanced styling predict_button = st.button("🔬 Analyze Student Data", type="primary", use_container_width=True) @@ -89,7 +91,7 @@ def render_prediction_section(model, preprocessing_info, user_input: Dict[str, A def render_recommendations(predicted_outcome: str, user_input: Dict[str, Any]) -> None: """Render personalized recommendations section""" - from ..utils.model_utils import generate_recommendations + st.markdown("### 💡 Personalized Recommendations") @@ -171,7 +173,6 @@ def render_probability_charts(prediction_proba: List[float]) -> None: def render_model_info_sidebar(user_input: Dict[str, Any]) -> None: """Render model information and validation in sidebar""" - from ..utils.model_utils import validate_input from ..config.theme import MODEL_METRICS st.markdown('

📊 Model Insights

', unsafe_allow_html=True) diff --git a/src/config/theme.py b/src/config/theme.py index 410dba2..bb50b32 100644 --- a/src/config/theme.py +++ b/src/config/theme.py @@ -275,7 +275,7 @@ ROSE_PINE_THEME = """ """ PAGE_CONFIG = { - "Page_title": "Student Success Predictor", + "page_title": "Student Success Predictor", "page_icon": "📊", "layout": "wide", "initial_sidebar_state": "expanded", diff --git a/src/utils/models_utils.py b/src/utils/models_utils.py index e3cca8b..acb60b3 100644 --- a/src/utils/models_utils.py +++ b/src/utils/models_utils.py @@ -12,13 +12,13 @@ from typing import Dict, Any, List def load_model_and_info(): """Load the trained model and preprocessing information""" try: - with open('random_forest_model.pkl', 'rb') as f: + with open('./models/random_forest_model.pkl', 'rb') as f: model = pickle.load(f) - with open('preprocessing_info.pkl', 'rb') as f: + with open('./models/preprocessing_info.pkl', 'rb') as f: preprocessing_info = pickle.load(f) - with open('feature_names.pkl', 'rb') as f: + with open('./models/feature_names.pkl', 'rb') as f: feature_names = pickle.load(f) return model, preprocessing_info, feature_names