Predicts a student's final grade (0-10) from study habits. Compares four regression algorithms to see which works best.
- Generates synthetic student data (so no external files needed)
- Trains 4 algorithms: Linear Regression, KNN, Decision Tree, Random Forest
- Saves the best model and makes predictions
- Includes pytest tests
pip install -r requirements.txt
python main.pyMenu:
- I: Generate dataset
- II: Show dataset stats
- III: Train models
- IV: Predict a grade
- V: Quit
python train.py # train, save best model
python predict.py # predict from terminal
pytest -q # run tests├── data.py load/generate/split data
├── train.py train 4 models, save best
├── predict.py load model and predict
├── main.py CLI menu
├── test_pipeline.py tests
├── requirements.txt
├── data/ students.csv
├── models/ best_model.joblib, scaler.joblib
└── plots/ true vs predicted plot
Results on the generated dataset (100 students, 80/20 split):
| Algorithm | MAE | RMSE | R² |
|---|---|---|---|
| Linear | 0.45 | 0.58 | 0.91 |
| KNN | 0.42 | 0.54 | 0.92 |
| Decision Tree | 0.38 | 0.49 | 0.94 |
| Random Forest | 0.35 | 0.46 | 0.95 |
Random Forest performs best.