← All projects

Machine Learning

Student Academic Performance Predictor

Used 1,000+ student records to build and compare Multiple Linear Regression, Logistic Regression, KNN, PCA, and k-means clustering in R.

  • R
  • dplyr
  • tidyverse
  • ggplot2
  • corrplot
  • factoextra
  • class
View the full R analysis

83.8% attendance classification accuracy with Logistic Regression

77.5% attendance classification accuracy with KNN

R² = 0.72 for GPA variance explained by Multiple Linear Regression

Overview

As a college student myself, I wanted to know how daily habits and lifestyle choices actually affect academic performance. I built this project in R to test that question with real modeling instead of assumptions.

I measured success two ways: CGPA and attendance percentage, then compared several modeling approaches on the same dataset.

Dataset

A public Kaggle dataset of 1,000 students with 12 variables, including study hours, sleep, screen time, gym hours, stress level, attendance, internal marks, and CGPA.

I renamed and cleaned the columns in dplyr, then scaled the numeric variables for the PCA, clustering, and KNN steps.

Methods

  • Correlation matrix to find which habits actually relate to performance
  • Principal Component Analysis with a biplot to see how student profiles group
  • Multiple Linear Regression to predict CGPA from lifestyle factors
  • Logistic Regression to classify high vs. low attendance
  • K-means clustering (k chosen with an elbow plot) to find student profiles
  • K-Nearest Neighbors as a second approach to the attendance classification

Results

  • Multiple Regression: adjusted R² = 0.72, with study hours (+0.60 CGPA per hour), sleep (+0.19) and stress (−0.29) all highly significant; screen time and attendance were not significant
  • Correlations with CGPA: sleep 0.62, study 0.51, stress −0.17; screen time and gym showed almost no linear effect
  • Logistic Regression classified high attendance (80%+) with 83.8% accuracy; study hours was the only significant predictor
  • KNN reached 77.5% accuracy on the same attendance classification
  • Clustering produced three profiles: high performers who study hard and sleep the most (avg. CGPA 8.2), a high-stress low-sleep group with lower grades, and a low-study low-stress group

Visualizations

The full report includes the correlation plot, PCA biplot, regression diagnostic plots, actual vs. predicted CGPA scatter, the elbow plot, and the cluster map.

What I Learned

Sleep mattered more than I expected. The strongest students were not just the ones studying the most hours, they were the ones protecting their rest, while high stress consistently pulled grades down.

Attendance turned out to be driven almost entirely by study habits rather than the other lifestyle factors, and comparing Logistic Regression to KNN on the same question showed me that a simpler model can fit better when the relationship is fairly linear.

This is one dataset, so it does not describe every student. If I took it further I would test the models on more data and look at factors like mental health and social support.