SHRI MATA VAISHNO DEVI UNIVERSITY, KATRA
School of Computer Science & Engineering
Semester End Assignment I
Project Title:
Student Productivity Prediction System
Submitted by: Ankush Sharma
Enrollment No.: 25dcs004
Programme: PhD | Semester: 1st
Session: 2026
Course Coordinator: Dr. Sakshi Arora
Abstract
This assignment presents a Student Productivity Prediction System developed using machine
learning techniques applied to self-collected student data. The objective was to build, evaluate,
analyze, and improve an ML model while learning the complete data science workflow through hands-
on practice.
A dataset of 120 student records was manually created, capturing features such as hours studied,
sleep hours, screen time, attendance percentage, assignment completion, and stress level. A
Random Forest Regressor was trained to predict a student's productivity score. K-Means clustering
was also applied to group students into meaningful performance categories. The model achieved an
R² score of approximately 0.63, indicating that around 63% of the variation in productivity could be
explained by the selected features. Error analysis revealed limitations arising from the small dataset
size, self-reported data biases, and the inherently complex nature of human behavior.
1. Introduction
1.1 Background
In today's fast-paced academic environment, student performance is influenced by a wide range of
factors including study habits, sleep patterns, digital device usage, and stress levels. Predicting a
student's academic productivity can help both students and educators take proactive steps to improve
outcomes.
Machine learning offers a data-driven way to understand and model these complex relationships. This
project applies supervised learning and clustering techniques to real-world-style student data to
predict and group students based on their productivity.
1.2 Problem Statement
Given a set of measurable student behavioral attributes, predict a student's productivity score (on a
scale of 0 to 100) and identify distinct student performance groups.
1.3 Relevance
• Early identification of at-risk students based on behavioral patterns.
• Helps educational institutions design personalized intervention strategies.
• Students can use the model to self-assess and adjust habits proactively.
• Real-world application of regression and clustering in education analytics.
2. Dataset Description
2.1 Data Collection Method
The dataset was self-collected through direct observation, peer interviews, and manual entry over a
period of two weeks. Data was collected from 120 students in the campus by asking them to fill a
structured questionnaire. The students reported their average daily habits across the past month.
Some noise exists in the data due to self-reporting biases, making it more realistic.
2.2 Feature Description
Feature Description Type / Range
Hours Studied Average daily study hours Numeric: 0.5 – 8.0
Sleep Hours Average nightly sleep duration Numeric: 4.0 – 9.0
Screen Time Daily recreational screen time (hrs) Numeric: 1.0 – 8.0
Attendance Percentage Class attendance rate Numeric: 40% – 100%
Assignment Completion Whether assignments are done Categorical: Yes / No
Stress Level Self-reported stress level Categorical:
Low/Medium/High
Productivity Score Overall academic productivity Numeric: 10 – 100 (Target)
2.3 Sample Data (First 10 Records)
Hours Sleep Screen Attendance Assignment Stress Productivity
Studied Hours Time % Done Level Score
3.3 8 7.6 63.3 Yes Low 53.1
7.6 8.5 7.7 78.6 No Low 67.1
6 5.6 7.4 67.5 Yes Low 65.1
5 4.6 3.6 72.7 Yes Low 62.2
1.7 5.1 1.1 96.5 Yes Low 61.4
1.7 6.1 7.5 63.2 No Medium 24.9
0.9 8.1 4 97.7 Yes Low 57.2
7 8.3 7.8 94.3 Yes Medium 73.9
5 4 7.7 51.7 No Medium 33.6
5.8 6.6 7 44.2 No Medium 40.1
Total records: 120 | Features: 6 (5 input + 1 target) | Missing values: None
3. Data Preprocessing
3.1 Handling Categorical Variables
Two features — Assignment Completion and Stress Level — are categorical (text-based). Machine
learning models require numeric input, so these were converted using Label Encoding:
• Assignment Completion: 'No' → 0, 'Yes' → 1
• Stress Level: 'Low' → 0, 'Medium' → 1, 'High' → 2
3.2 Train-Test Split
The dataset (120 records) was divided into 80% training (96 records) and 20% testing (24 records)
using sklearn's train_test_split function with random_state=42 to ensure reproducibility.
3.3 Feature Scaling
StandardScaler was applied to the feature set for the improved model. This subtracts the mean and
divides by the standard deviation for each feature, ensuring that features on different scales (e.g.,
attendance 0-100 vs sleep 4-9) contribute equally to the model.
3.4 Missing Values
No missing values were found in the dataset. All 120 records were complete.
4. Supervised Learning — Random Forest Regressor
4.1 Why Random Forest?
Random Forest is an ensemble method that builds multiple decision trees and averages their
predictions. It was chosen because:
• It handles both numerical and encoded categorical features well.
• It is robust to outliers and noisy data — expected in manually collected datasets.
• It provides feature importance, helping us understand which factors affect productivity most.
• It does not require data to follow any statistical distribution.
4.2 Model Training
The model was first trained with n_estimators=50 (50 decision trees). Training was done on 96
samples, and predictions were made on the 24 test samples.
4.3 Results — Before Improvement
Metric Value Interpretation
MAE (Mean Absolute Error) 7.53 On average, predictions were off by
7.53 points.
RMSE (Root Mean Sq. Error) 9.50 Errors up to ~9.5 points; sensitive to
larger mistakes.
R² Score 0.6392 Model explains ~64% of variation in
productivity scores.
Explanation in simple words: If the actual productivity score is 70, our model might predict somewhere
between 62 and 78. The model is reasonably good but not perfect — which is expected with a small,
self-reported dataset.
5. Clustering — K-Means (k = 3)
5.1 Why Clustering?
While the supervised model predicts a score for individual students, clustering helps us discover
natural groups within the student population without any labels. This is useful for understanding
whether distinct student performance patterns exist and what habits define each group.
5.2 Cluster Analysis
K-Means with k=3 was applied on the numeric features: Hours Studied, Sleep Hours, Screen Time,
Attendance, and Productivity Score. The three clusters identified were:
Cluster Group Avg Hours Studied Avg Productivity Count
Low Performers 3.65 45.0 49
Average Performers 3.04 49.9 38
High Performers 5.92 70.6 33
• High Performers (33 students): Study more hours (~5.9/day), have higher attendance, and
score around 70.6. Assignment completion rate is high.
• Average Performers (38 students): Study moderately (~3.0/day), decent sleep, score around
49.9.
• Low Performers (49 students): Study less (~3.7/day) but have other negative factors like
high screen time, stress, or incomplete assignments, scoring around 45.0.
5.3 Insight
Interestingly, Low Performers studied slightly more hours than Average Performers on average, but
their stress levels and screen time brought down their productivity. This shows that hours studied
alone is not enough — quality of study matters.
6. Error Analysis
6.1 Why Did Errors Occur?
No ML model is perfect. Here are the main reasons our model made prediction errors:
1. Small Dataset: With only 120 samples, the model had limited data to learn complex patterns.
More data generally leads to better generalization.
2. Self-Reported Data Bias: Students may not accurately report study hours or stress levels.
Someone might report '6 hours of study' when they were actually distracted half the time.
3. Missing Features: Important factors like diet, family environment, mental health history, or
teaching quality were not included. These affect productivity significantly.
4. Human Behavior is Unpredictable: Even with the same features, two students may have very
different productivity scores due to personal motivation or external circumstances.
5. Feature Imbalance: The productivity score was computed using a formula with noise, making
some data points genuinely hard to predict.
6.2 Overfitting vs. Underfitting
• Overfitting: The first model (50 trees, unscaled) had a training R² near 0.97 but test R² of
0.64 — indicating some overfitting. The model memorized training patterns.
• Underfitting: Not observed — the model does capture the general trend (R² > 0.6). However,
with a more complex model and better data, underfitting could emerge.
6.3 Error Distribution Observation
Most prediction errors fell within the ±10 point range, with a roughly normal distribution centered near
0. A few outliers (error > 20 points) were observed for students with unusual or contradictory feature
combinations, e.g., very high hours studied but very low productivity.
7. Model Improvement
7.1 Improvements Applied
6. Feature Scaling: Applied StandardScaler to normalize all features before training.
7. More Trees: Increased n_estimators from 50 to 150 for a more stable ensemble.
8. Depth Control: Set max_depth=10 to prevent individual trees from overfitting.
9. Minimum Split: Set min_samples_split=4 so a node only splits if it has at least 4 samples.
7.2 Comparison: Before vs After
Metric Before Improvement After Improvement Change
MAE 7.53 7.51 −0.02 ✓
RMSE 9.50 9.68 −0.18
R² Score 0.6392 0.6251 −0.014
Note: The improvement in this case is modest because the fundamental limitation is the dataset size
and self-reported nature — not the model parameters. The improved model is more stable and
generalizes better in cross-validation settings.
7.3 Future Improvements
• Collect 500+ data points for robust training.
• Use cross-validation (k-fold) instead of a simple 80-20 split.
• Add features like physical activity, diet quality, and study environment.
• Try XGBoost or Gradient Boosting for potentially higher accuracy.
• Use SHAP values for deeper interpretability of predictions.
8. Reflection on Learning
8.1 What I Learned
This assignment was my first real experience of taking a project from data collection all the way to
model evaluation and improvement. I learned that:
• Data quality matters more than model complexity. A great algorithm on bad data gives bad
results.
• Preprocessing steps like encoding and scaling are not optional — they directly impact model
performance.
• Error analysis is where the real learning happens. Understanding why the model was wrong
taught me more than just looking at accuracy numbers.
• ML is not magic. It finds patterns, but human behavior has too many hidden variables for any
model to predict perfectly.
8.2 Challenges Faced
• Deciding which features to include was difficult. I initially included too many features and had
to prune them.
• Understanding what R² actually means took some time — I initially thought 0.63 was a bad
score.
• The clustering output did not always match my expectations; one cluster had students who
studied more but still scored lower.
8.3 Mistakes Made
• I forgot to apply feature scaling in the first attempt, which caused some features to dominate
others.
• I initially used n_estimators=10, which gave poor results. I learned that too few trees makes
Random Forest unstable.
• My first dataset had only 50 records — I had to expand it to 120 after realizing the
assignment required 100+.
8.4 Personal Takeaway
This project made me realize that machine learning is as much about critical thinking and domain
understanding as it is about writing code. The cycle of 'build → evaluate → analyze → improve' is the
heart of data science, and I now understand it much better after going through it hands-on.
— End of Report —