|
1 | | -STUDENT PERFORMANCE PREDICTOR |
| 1 | +Student Exam Performance Predictor |
| 2 | +================================= |
2 | 3 |
|
3 | | -LIVE DEMO: https://student-performance-predictor-0hqd.onrender.com |
| 4 | +Live demo: https://student-performance-predictor-0hqd.onrender.com |
| 5 | + |
| 6 | +Predict a student's maths score from demographic factors and prior reading/writing scores using a trained ML pipeline, served via Flask. |
| 7 | + |
| 8 | +Features |
| 9 | +-------- |
| 10 | +- Flask web app with a simple form UI |
| 11 | +- Sklearn preprocessing pipeline with numeric/categorical handling |
| 12 | +- Model selection across multiple regressors with hyperparameter tuning |
| 13 | +- Persisted preprocessor and model artifacts in `artifacts/` |
| 14 | +- One-click deploy with Gunicorn + Procfile (compatible with Render/Heroku) |
| 15 | + |
| 16 | +Tech stack |
| 17 | +--------- |
| 18 | +- Python, Flask, Jinja2 |
| 19 | +- scikit-learn, CatBoost, XGBoost |
| 20 | +- pandas, numpy |
| 21 | + |
| 22 | +Project structure |
| 23 | +----------------- |
| 24 | +```text |
| 25 | +. |
| 26 | +├── app.py # Flask application |
| 27 | +├── src/ |
| 28 | +│ ├── components/ |
| 29 | +│ │ ├── data_ingestion.py # Load CSV, split train/test |
| 30 | +│ │ ├── data_transformation.py # Preprocess pipelines, save preprocessor |
| 31 | +│ │ └── model_trainer.py # Model selection, tuning, save best model |
| 32 | +│ ├── pipeline/ |
| 33 | +│ │ ├── predict_pipeline.py # Inference with saved artifacts |
| 34 | +│ │ └── train_pipeline.py # End-to-end training entrypoint |
| 35 | +│ ├── utils.py # IO helpers, grid search evaluate |
| 36 | +│ ├── exception.py # Custom exception wrapper |
| 37 | +│ └── logger.py # File logging setup |
| 38 | +├── templates/ # Jinja templates for UI |
| 39 | +├── artifacts/ # Saved data, preprocessor, model |
| 40 | +├── notebook/ # EDA and training notebooks |
| 41 | +├── requirements.txt |
| 42 | +├── setup.py |
| 43 | +└── Procfile |
| 44 | +``` |
| 45 | + |
| 46 | +Quick start |
| 47 | +----------- |
| 48 | +1) Setup environment |
| 49 | +```bash |
| 50 | +python -m venv .venv && source .venv/bin/activate |
| 51 | +pip install --upgrade pip |
| 52 | +pip install -r requirements.txt |
| 53 | +``` |
| 54 | + |
| 55 | +2) Train the model (artifacts will be created under `artifacts/`) |
| 56 | +```bash |
| 57 | +python -m src.pipeline.train_pipeline |
| 58 | +``` |
| 59 | + |
| 60 | +3) Run locally |
| 61 | +```bash |
| 62 | +python app.py |
| 63 | +# or production style |
| 64 | +gunicorn app:app --bind 0.0.0.0:5000 |
| 65 | +``` |
| 66 | + |
| 67 | +4) Open the app |
| 68 | +- Navigate to `http://127.0.0.1:5000/` |
| 69 | + |
| 70 | +Usage |
| 71 | +----- |
| 72 | +- Fill in gender, race/ethnicity, parental education, lunch, test preparation, and prior reading/writing scores. |
| 73 | +- Submit to get the predicted maths score. Artifacts must exist at `artifacts/model.pkl` and `artifacts/preprocessor.pkl`. |
| 74 | + |
| 75 | +Data |
| 76 | +---- |
| 77 | +- Training data is read from `notebook/data/stud.csv` inside the training pipeline. |
| 78 | +- The pipeline splits into train/test and stores copies in `artifacts/train.csv` and `artifacts/test.csv`. |
| 79 | + |
| 80 | +Deployment |
| 81 | +---------- |
| 82 | +- The repository includes a `Procfile` for platforms like Render/Heroku. The command used is `gunicorn app:app`. |
| 83 | + |
| 84 | +Development scripts |
| 85 | +------------------- |
| 86 | +Common commands: |
| 87 | +```bash |
| 88 | +# Run training |
| 89 | +python -m src.pipeline.train_pipeline |
| 90 | + |
| 91 | +# Start web server |
| 92 | +python app.py |
| 93 | + |
| 94 | +# Lint (once we add ruff/flake8) |
| 95 | +ruff check . |
| 96 | +``` |
| 97 | + |
| 98 | +Roadmap / Improvements |
| 99 | +---------------------- |
| 100 | +- Add CI (GitHub Actions) to run formatting, linting, and a smoke test |
| 101 | +- Add unit tests for `utils.load_object/save_object` and `PredictPipeline` |
| 102 | +- Add type hints and docstrings for public functions |
| 103 | +- Replace hardcoded paths with environment variables where appropriate |
| 104 | +- Add Dockerfile for reproducible deployments |
| 105 | +- Add CONTRIBUTING.md and CODE_OF_CONDUCT.md |
| 106 | + |
| 107 | +License |
| 108 | +------- |
| 109 | +If you intend the project to be open-source, add a `LICENSE` file (e.g., MIT). |
0 commit comments