mirror of
https://github.com/andwati/student-retention.git
synced 2026-11-27 18:58:47 +00:00
antigravity
This commit is contained in:
@@ -13,7 +13,7 @@ from sklearn.model_selection import train_test_split
|
|||||||
def load_and_preprocess_data():
|
def load_and_preprocess_data():
|
||||||
"""Load and preprocess the data exactly as done in the notebook"""
|
"""Load and preprocess the data exactly as done in the notebook"""
|
||||||
# Load data
|
# 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)
|
master_raw_data = pd.read_csv(data_file_name_path)
|
||||||
data = master_raw_data.copy()
|
data = master_raw_data.copy()
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ import time
|
|||||||
import json
|
import json
|
||||||
from typing import Dict, Any, Tuple, List
|
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:
|
def render_prediction_section(model, preprocessing_info, user_input: Dict[str, Any]) -> None:
|
||||||
"""Render the prediction section with enhanced animations"""
|
"""Render the prediction section with enhanced animations"""
|
||||||
from ..utils.model_utils import preprocess_input, generate_recommendations
|
|
||||||
|
|
||||||
# Prediction button with enhanced styling
|
# Prediction button with enhanced styling
|
||||||
predict_button = st.button("🔬 Analyze Student Data", type="primary", use_container_width=True)
|
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:
|
def render_recommendations(predicted_outcome: str, user_input: Dict[str, Any]) -> None:
|
||||||
"""Render personalized recommendations section"""
|
"""Render personalized recommendations section"""
|
||||||
from ..utils.model_utils import generate_recommendations
|
|
||||||
|
|
||||||
st.markdown("### 💡 Personalized 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:
|
def render_model_info_sidebar(user_input: Dict[str, Any]) -> None:
|
||||||
"""Render model information and validation in sidebar"""
|
"""Render model information and validation in sidebar"""
|
||||||
from ..utils.model_utils import validate_input
|
|
||||||
from ..config.theme import MODEL_METRICS
|
from ..config.theme import MODEL_METRICS
|
||||||
|
|
||||||
st.markdown('<h2 class="sub-header">📊 Model Insights</h2>', unsafe_allow_html=True)
|
st.markdown('<h2 class="sub-header">📊 Model Insights</h2>', unsafe_allow_html=True)
|
||||||
|
|||||||
+1
-1
@@ -275,7 +275,7 @@ ROSE_PINE_THEME = """
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
PAGE_CONFIG = {
|
PAGE_CONFIG = {
|
||||||
"Page_title": "Student Success Predictor",
|
"page_title": "Student Success Predictor",
|
||||||
"page_icon": "📊",
|
"page_icon": "📊",
|
||||||
"layout": "wide",
|
"layout": "wide",
|
||||||
"initial_sidebar_state": "expanded",
|
"initial_sidebar_state": "expanded",
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ from typing import Dict, Any, List
|
|||||||
def load_model_and_info():
|
def load_model_and_info():
|
||||||
"""Load the trained model and preprocessing information"""
|
"""Load the trained model and preprocessing information"""
|
||||||
try:
|
try:
|
||||||
with open('random_forest_model.pkl', 'rb') as f:
|
with open('./models/random_forest_model.pkl', 'rb') as f:
|
||||||
model = pickle.load(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)
|
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)
|
feature_names = pickle.load(f)
|
||||||
|
|
||||||
return model, preprocessing_info, feature_names
|
return model, preprocessing_info, feature_names
|
||||||
|
|||||||
Reference in New Issue
Block a user