Student Performance Predictor

Two scikit-learn models trained on the Student Performance - 1 Million Records dataset: a regressor for the final total_score and a classifier for the letter grade. Both are exported as joblib artifacts and are ready for offline inference with scikit-learn.

This repository contains only the 1-million-record pipeline. No other dataset, and no raw dataset file, is published here.

Model overview

Property Value
Task 1 Regression: predict total_score (0-100)
Task 2 Classification: predict grade in {F, D, C, B, A}
Regressor HistGradientBoostingRegressor (scikit-learn)
Classifier HistGradientBoostingClassifier (scikit-learn)
Input 3 raw behavioural features + 3 deterministic engineered features
Output Score in [0, 100], grade label, grade probabilities
Artifact format joblib (pickle), no GPU and no external runtime required
Training rows used 850,000 (700,000 train + 150,000 validation refit)
Held-out test rows 150,000 (never used for fitting or selection)
Seed 1337

Problem statement

Given a student's study behaviour - weekly self-study hours, attendance percentage and class participation - estimate the final total score and the letter grade. The purpose is early, coarse identification of students who may need support, not a guarantee of any individual result.

Dataset

Student Performance - 1 Million Records (Kaggle, kayhanh/student-performance-1-million). This is the only dataset used by the models in this repository.

Split Rows Role
Train 700,000 Model fitting and hyperparameter comparison
Validation 150,000 Model selection and early stopping
Test 150,000 Final evaluation only
Total 1,000,000

Columns: student_id, weekly_self_study_hours, attendance_percentage, class_participation, total_score, grade.

student_id is an identifier and is never used as a feature. total_score and grade are targets only; the grade classifier never receives the score. Splits are fixed files (700k/150k/150k) and are never re-partitioned or shuffled across splits. No overlapping records were found between splits.

Dataset files are not included in this repository; download them from the Kaggle source above. The JSON metadata files here (preprocessor/feature_names.json, preprocessor/preprocessor_meta.json) contain only the 1-million-record feature, target and label definitions.

Input features

Raw inputs (clipped to their physical ranges):

Feature Range
weekly_self_study_hours 0 - 40 hours/week
attendance_percentage 0 - 100 %
class_participation 0 - 10 points

Engineered features (row-local, no statistics learned from other rows):

Feature Formula
effort_index hours * participation / 10
study_attendance_product hours * attendance / 100
participation_per_study_hour participation / (hours + 1)

Deterministic feature engineering is part of the model contract: the same six columns must be passed in the same order at inference time.

Target variables

  • total_score: continuous, right-censored at 100 (26.8 % of rows). Predictions are clipped to [0, 100]; the exported model produced 0 out-of-range values on the test split.
  • grade: A >= 85, B >= 70, C >= 55, D >= 40, otherwise F. The grade is a near-deterministic binning of the score, but the classifier only sees behavioural features, so its task is genuinely harder.

Data preprocessing

  1. Numeric coercion of the three raw columns; rows with missing values or non-numeric entries are dropped (none in this dataset).
  2. Exact duplicate rows within a split are dropped; splits are never merged or re-shuffled.
  3. Physically impossible values are clipped to the ranges above; statistical outliers are kept and reported, not removed.
  4. Six features are assembled in a fixed order (preprocessor/feature_names.json).
  5. Both selected models are tree ensembles and are not scaled (scaled: false). preprocessor/million_preprocessor.joblib carries the feature metadata and a fitted StandardScaler kept for the candidates that required scaling; the published models do not use it.

Training methodology

  • Fixed seed 1337; deterministic split files; no leakage between splits.
  • Candidate models were fitted on the 700,000-row training split and compared on the 150,000-row validation split.
  • The winner was refit on train + validation (850,000 rows) and evaluated once on the untouched 150,000-row test split. The published artifacts are that refit model, so test metrics come from data the model never saw.
  • student_id, total_score and grade are excluded from the regressor's inputs; total_score is excluded from the classifier's inputs (asserted in the training pipeline).

Algorithms evaluated

Validation split, regression target total_score:

Model Key hyperparameters Train rows MAE RMSE R²
ridge alpha=1.0 700,000 7.0437 8.8676 0.6701
random_forest n_estimators=120, max_depth=18 300,000 6.1485 8.2784 0.7125
hist_gradient_boosting max_iter=400, learning_rate=0.06, max_leaf_nodes=31 700,000 6.1158 8.2211 0.7165
mlp hidden_layer_sizes=[64, 32], alpha=0.001, max_iter=40 200,000 6.1320 8.2343 0.7156
hist_gradient_boosting max_iter=300, learning_rate=0.05, max_leaf_nodes=31 700,000 6.1164 8.2217 0.7164
hist_gradient_boosting max_iter=300, learning_rate=0.08, max_leaf_nodes=63 700,000 6.1180 8.2239 0.7163
hist_gradient_boosting max_iter=500, learning_rate=0.04, max_leaf_nodes=15 700,000 6.1180 8.2207 0.7165

The selected configuration is the tuned HistGradientBoostingRegressor with the highest validation R² of the search (validation MAE 6.1180, RMSE 8.2207, R² 0.7165).

Grade classifier candidates (validation): HistGradientBoostingClassifier (accuracy 0.6952) versus RandomForestClassifier (accuracy 0.6447). The gradient boosting classifier was selected.

Actual hyperparameters

Regressor (model_config.json):

{
  "enabled": true,
  "max_iter": 500,
  "learning_rate": 0.04,
  "max_leaf_nodes": 15,
  "min_samples_leaf": 80,
  "l2_regularization": 2.0,
  "early_stopping": true,
  "n_iter_no_change": 20,
  "validation_fraction": 0.1
}

Classifier:

{
  "max_iter": 200,
  "learning_rate": 0.08,
  "max_leaf_nodes": 31,
  "min_samples_leaf": 40,
  "early_stopping": true,
  "n_iter_no_change": 15
}

Grade class order: F, D, C, B, A (index 0 = F ... 4 = A).

Evaluation metrics

Held-out test split, n = 150,000 (regressor refit on 850,000 rows):

Metric Value
MAE 6.1190 points
RMSE 8.2065 points
MSE 67.3460
R² 0.7175
Target mean / std 84.2910 / 15.4408
Predictions outside [0, 100] 0
Exact-match rate (context) 0.10482

Grade classifier, held-out test split:

Metric Value
Accuracy 0.6956
Macro precision 0.5059
Macro recall 0.4405
Macro F1 0.4536
Weighted F1 0.6869
ROC-AUC (OVR macro) 0.9034

Permutation importance (increase in RMSE when the feature is shuffled, test split):

Feature ΔRMSE
weekly_self_study_hours +11.7356
attendance_percentage -0.0003
class_participation +0.0002
effort_index +0.0039
study_attendance_product +0.0058
participation_per_study_hour +0.0066

Study hours dominate; attendance and participation carry almost no signal in this synthetic table (correlation with the score is ~0.005 and ~-0.002).

Model inference

import joblib, numpy as np, pandas as pd

reg = joblib.load("best_model/model.joblib")        # HistGradientBoostingRegressor
grade = joblib.load("best_model/grade_model.joblib")  # HistGradientBoostingClassifier

row = pd.DataFrame([{
    "weekly_self_study_hours": 22.0,
    "attendance_percentage": 95.0,
    "class_participation": 9.0,
}])
hours = row["weekly_self_study_hours"].clip(0, 40)
attendance = row["attendance_percentage"].clip(0, 100)
participation = row["class_participation"].clip(0, 10)
row["effort_index"] = hours * participation / 10.0
row["study_attendance_product"] = hours * attendance / 100.0
row["participation_per_study_hour"] = participation / (hours + 1.0)

X = row[reg["features"]].to_numpy(dtype=float)
score = float(np.clip(reg["model"].predict(X)[0], 0.0, 100.0))

proba = grade["model"].predict_proba(row[grade["features"]].to_numpy(dtype=float))[0]
label = grade["labels"][int(proba.argmax())]
print(f"{score:.2f} / grade {label} (confidence {proba.max():.3f})")

Output for the example above, computed with the published artifacts:

98.11 / grade A (confidence 0.980)

Notes for correct use:

  • Load the dict wrappers, not the estimator directly: reg["model"] and grade["model"], and pass reg["features"] / grade["features"] in order.
  • reg["scaled"] is false; if it were true, apply preprocessor/million_preprocessor.joblib["scaler"] first.
  • Requires scikit-learn (trained with 1.9.1), joblib, numpy, pandas. Loading a model trained with a different major scikit-learn version can warn.
  • No tokenizer, no prompt and no language model is involved: this is a tabular model. Natural-language answers in the companion project are generated by an LLM layer that only rewrites these numeric outputs.

Files

Path Description
best_model/model.joblib Published regressor (refit on 850,000 rows)
best_model/grade_model.joblib Published grade classifier
final_model/model.joblib Same refit artifact in its original location
checkpoints/hist_gradient_boosting.joblib Selected regressor before refit
checkpoints/final_refit.joblib Refit regressor checkpoint
checkpoints/ridge.joblib, random_forest.joblib, mlp.joblib Evaluated regression candidates
checkpoints/grade_*.joblib Evaluated grade candidates
model_config.json Selected model, features, hyperparameters, metrics
preprocessor/million_preprocessor.joblib Feature metadata and fitted scaler
preprocessor/feature_names.json Canonical feature and target names
preprocessor/preprocessor_meta.json Dataset, target, label and cutoff metadata

Limitations

  • Correlational, not causal. The features are observational; nothing here shows that raising study hours causes a higher score.
  • One strong predictor. Study hours correlate with the score at r ≈ 0.81; attendance and participation are nearly independent of it. R² is therefore bounded near 0.66-0.72, and the model mostly learns a study-hours response curve.
  • Regression to the mean. Extreme scores are pulled toward the middle, so low scores are over-predicted and very high scores under-predicted; the score is also censored at 100 for 26.8 % of rows.
  • Grade accuracy is modest. 0.6956 accuracy with 0.4536 macro-F1 reflects strong class imbalance (A is ~68 % of rows) and noisy grade boundaries.
  • Synthetic data. The dataset is synthetic; results do not establish performance on real students, schools or curricula.
  • Distribution shift. Inputs outside the ranges above (clipped at inference) or a different student population are outside the validated distribution.
  • Not a decision system. Do not use these predictions for admission, grading, disciplinary or other high-stakes decisions about individuals.

Links

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support