A Flask web application that predicts student performance scores based on demographic and test preparation data using machine learning.
This project leverages machine learning to predict student exam performance based on various factors including gender, parental level of education, lunch type, test preparation course completion, and previous test scores. The application provides an intuitive web interface for easy data input and real-time predictions.
- Interactive Web Interface: User-friendly forms for inputting student demographics and test data
- Real-time Predictions: Instant performance score predictions using trained ML models
- Data Preprocessing: Automatic feature scaling and preprocessing pipeline
- Modular Architecture: Clean, maintainable code structure with separate pipeline components
- Responsive Design: Works seamlessly across different devices and screen sizes
student-performance-prediction/
├── .ebextensions/
├── artifacts/
│ ├── data.csv
│ ├── model.pkl
│ ├── proprocessor.pkl
│ ├── test.csv
│ └── train.csv
├── catboost_info/
│ ├── learn/
│ ├── catboost_training.json
│ ├── learn_error.tsv
│ └── time_left.tsv
├── notebook/
│ ├── data/
│ ├── EDA_STUDENT_PERFORMANCE.ipynb
│ └── MODEL_TRAINING.ipynb
├── src/
│ ├── components/
│ │ ├── __init__.py
│ │ ├── data_ingestion.py
│ │ ├── data_transformation.py
│ │ └── model_trainer.py
│ ├── pipeline/
│ │ ├── __init__.py
│ │ ├── predict_pipeline.py
│ │ └── train_pipeline.py
│ ├── __init__.py
│ ├── exception.py
│ ├── logger.py
│ └── utils.py
├── templates/
│ ├── index.html
│ └── home.html
├── .gitignore
├── app.py
├── README.md
├── requirements.txt
└── setup.py
- Python 3.7 or higher
- pip (Python package installer)
- Git
-
Clone the repository
git clone <repository-url> cd student-exam-performance-prediction
-
Create a virtual environment
# Create virtual environment python -m venv venv # Activate virtual environment # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python app.py
-
Access the application
Open your web browser and navigate to Home Page:
http://localhost:5000To Predict Marks:
http://localhost:5000/predictdata
- Navigate to the Home Page: Click on the "Go to Home Page" button from the landing page
- Fill in Student Details:
- Select gender
- Choose parental level of education
- Select lunch type (standard/free or reduced)
- Indicate test preparation course completion
- Enter reading and writing scores
- Get Prediction: Submit the form to receive the predicted math score
- View Results: The predicted performance score will be displayed on the same page
- CustomData Class: Handles data transformation and validation
- PredictPipeline Class: Manages the ML prediction workflow
- Flask Routes: Handle web requests and responses
- HTML Templates: Provide the user interface
- Data Collection: User inputs are collected through web forms
- Preprocessing: Features are scaled and transformed using saved preprocessors
- Prediction: Trained ML model generates performance predictions
- Output: Results are displayed in a user-friendly format
- Flask: Web framework for the application
- NumPy: Numerical computing library
- Pandas: Data manipulation and analysis
- Scikit-learn: Machine learning library
- Dill: Extended pickle functionality for model serialization
See requirements.txt for complete dependency list with versions.
The application runs on:
- Host: 127.0.0.1 (accessible from any IP)
- Port: 5000
- Debug Mode: Enabled for development
The machine learning model has been trained on student performance data and achieves reliable predictions for academic outcomes based on the input features.
Follow the installation steps above for local development.
For production deployment, consider:
- Setting
debug=Falsein app.py - Using a production WSGI server like Gunicorn
- Implementing proper error handling and logging
- Adding environment-specific configurations
- User Authentication: Add login/registration functionality
- Data Visualization: Include charts and graphs for better insights
- Model Retraining: Implement automated model updates
- API Endpoints: Create REST API for programmatic access
- Database Integration: Store predictions and user data
- Cloud Deployment: Deploy on AWS, GCP, or Azure
- CI/CD Pipeline: Automated testing and deployment
- Mobile App: Develop companion mobile application
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Open an issue on GitHub
- Check the documentation
- Review the code comments for implementation details
- Thanks to the contributors of the libraries used in this project
- Educational datasets that made this project possible
- The open-source community for continuous inspiration