11 September 2026
Predicting Test Scores from Study Hours: A Simple Linear Regression Project, Done Properly

Not every machine learning project needs to be a transformer model to be worth doing right. This one predicts a student's test score from their study hours using simple linear regression — genuinely one of the simplest models in ML — but the point wasn't the model. The point was shipping it as a real, usable full-stack application instead of leaving it as a Jupyter notebook nobody but me would ever open.
Why I built this
Ye project ek Simple Linear Regression model pr based hai jo predict karta hai ki user (student) kitne hours padhai karke kitna score achieve kar sakta hai. It's deliberately simple on the ML side so the engineering around the model — the API, the UI, the deployment — could get the real attention.
The stack, and why each piece is there
- scikit-learn — trains and serializes the linear regression model. No need to reach for a heavier framework when the relationship you're modeling really is linear.
- FastAPI — serves the model behind a clean prediction endpoint, so the frontend never touches the model directly. This separation means the model can be retrained and redeployed without touching the frontend at all.
- Next.js + Tailwind CSS — an interactive UI where you actually input hours and get an instant prediction back, instead of running a script and reading a number off a terminal.
- Recharts — visualizes the score trend, so the relationship between hours and predicted score is something you can see, not just a single output number.
The real lesson here
A lot of beginner ML projects stop at model.predict() in a notebook. Wrapping even the simplest model behind a real API and a real UI is what makes it a product instead of an exercise — and it's a much better demonstration of full-stack ML skills than a more "impressive" model that only ever runs in a notebook cell.
The stack, layer by layer
| Layer | Technology | Purpose |
|---|---|---|
| Model | scikit-learn | Trains and serializes the regression model |
| API | FastAPI | Serves predictions behind a clean endpoint |
| UI | Next.js + Tailwind CSS | Interactive input and instant results |
| Visualization | Recharts | Shows the score trend, not just a number |
Wrapping even the simplest model behind a real API and a real UI is what turns an exercise into a product.
Source on GitHub.
FAQ
Common Questions
For a genuinely linear relationship like hours studied vs. score, yes — reaching for a heavier model here would be over-engineering, not better ML.