Skip to content

Hasu0507/student-score-predictor

Repository files navigation

🎓 Student Score Predictor

A beginner-friendly Machine Learning project built with Python, Scikit-learn, and Streamlit that predicts a student's exam score based on study habits and academic performance.

The model uses Linear Regression to estimate the final score using the following inputs:

  • 📚 Hours Studied
  • ✅ Attendance Percentage
  • 📝 Previous Exam Score
  • 😴 Sleep Hours

This project demonstrates the complete machine learning workflow, from data preparation and model training to prediction, visualization, and a simple web interface.


🚀 Features

  • Predicts student exam scores using Linear Regression
  • Input validation to prevent invalid values
  • Model evaluation using R² Score and Mean Squared Error (MSE)
  • Scatter plot comparing actual vs. predicted scores
  • Saves the trained model using Joblib
  • Command-line prediction using argparse
  • Interactive web application built with Streamlit
  • Clean and beginner-friendly project structure

🛠 Technologies Used

  • Python 3
  • Pandas
  • Scikit-learn
  • Matplotlib
  • Joblib
  • Streamlit
  • VS Code
  • Git & GitHub

📂 Project Structure

student-score-predictor/
│
├── data/
│   └── student_scores.csv
├── train.py
├── predict.py
├── app.py
├── student_model.pkl
├── actual_vs_predicted.png
├── requirements.txt
├── README.md
└── .gitignore

⚙️ Installation

Clone the repository:

git clone https://github.com/Hasu0507/student-score-predictor.git

Go to the project directory:

cd student-score-predictor

Install dependencies:

pip install -r requirements.txt

▶️ Running the Project

Train the model

python train.py

Predict from the command line

python predict.py --hours 6 --attendance 85 --previous 75 --sleep 7

Run the Streamlit web app

streamlit run app.py

📊 Example Output

Command-line

Predicted Score: 79.21

Training

R² Score: 0.98
Mean Squared Error: 2.10
Model saved successfully.

📈 Machine Learning Workflow

  1. Load the dataset.
  2. Preprocess the data.
  3. Split into training and testing datasets.
  4. Train a Linear Regression model.
  5. Evaluate model performance.
  6. Save the trained model.
  7. Predict new student scores.
  8. Visualize model predictions.
  9. Deploy a simple web interface with Streamlit.

👨‍💻 Author

Sreekamali J

GitHub: https://github.com/hasu0507

About

A beginner-friendly Machine Learning project built with Python and Scikit-learn that predicts a student's exam score based on study habits and academic performance.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages