Machine Learning · Data Science

Student Exam
Score Predictor

End-to-end ML pipeline trained on 6,607 real student records. Predicts your exam score and tells you the minimum weekly study hours you need to pass.

6,607
student records
0.68
R² score
2.03
MAE (pts)
19
features
PythonScikit-learn Random ForestPipeline ColumnTransformerOrdinalEncoder MinMaxScalerStreamlit PandasJoblib EDAFeature Engineering PythonScikit-learn Random ForestPipeline ColumnTransformerOrdinalEncoder MinMaxScalerStreamlit PandasJoblib EDAFeature Engineering

Pipeline Design

Instead of manually looping encoders (which causes unseen data errors at prediction time), the entire preprocessing + model is wrapped in a single sklearn Pipeline. One pipeline.joblib file handles everything — encoding, scaling, prediction — with no manual steps in the app.

Raw DataFrame (strings + numbers)
ColumnTransformer
OrdinalEncoder → 8 ordinal cols (Low/Med/High → 0/1/2)
OrdinalEncoder → 5 binary cols (Yes/No → 0/1)
MinMaxScaler → 6 numeric cols (→ 0 to 1 range)
RandomForestRegressor (200 trees, random_state=42)
Predicted Exam Score (55–101)
pipeline = Pipeline(steps=[ ("preprocessor", ColumnTransformer([ ("ordinal", OrdinalEncoder(categories=ordinal_cats), ORDINAL_COLS), ("binary", OrdinalEncoder(categories=binary_cats), BINARY_COLS), ("numeric", MinMaxScaler(), NUM_COLS), ])), ("model", RandomForestRegressor(n_estimators=200, random_state=42)) ]) pipeline.fit(X_train, y_train) joblib.dump(pipeline, "pipeline.joblib") # one file, everything inside

Results

0.68
R² Score
2.03
MAE (pts)
200
Trees
Attendance
38.5%
Hours_Studied
24.7%
Previous_Scores
8.8%
Tutoring_Sessions
3.6%
Access_to_Resources
3.0%
Parental_Involvement
2.9%

Key insight: Attendance (38.5%) matters more than hours studied (24.7%). Most students grind study hours while skipping class — the data says that's the wrong trade-off.

Built With

CORE

Python 3.11 Scikit-learn Pandas Joblib Streamlit

PREPROCESSING

Pipeline ColumnTransformer OrdinalEncoder MinMaxScaler

VISUALIZATION & DEPLOYMENT

Matplotlib Seaborn Jupyter Notebook Streamlit Cloud GitHub Pages

See It in Action

Enter your study habits and personal details — get your predicted score and the exact number of study hours you need to pass.

🚀 Launch the App