Skip to content

Latest commit

 

History

History
48 lines (35 loc) · 1.31 KB

File metadata and controls

48 lines (35 loc) · 1.31 KB

Predicting Sleep Hours Based on Digital Device Usage

Project Overview

This project implements Linear Regression from scratch using Gradient Descent to predict the number of sleep hours based on a person’s age, daily screen time, device usage before sleep, and stress level. The dataset captures the impact of digital device usage on sleep quality and mental health.


Features

  • Age
  • Daily Screen Time (hours)
  • Use of Devices Before Sleep (Yes/No)
  • Stress Level

Target Variable:

  • Sleep Hours

Project Highlights

  • Manual implementation of Linear Regression (no sklearn LinearRegression used).
  • Gradient Descent algorithm used to learn model parameters.
  • Feature scaling using StandardScaler for efficient training.
  • Visualization of training loss (MSE) and predicted vs actual sleep hours.
  • Prediction for new individuals based on input features.

Results

  • R² Score (Test Set): 0.61
  • Mean Squared Error (MSE): 1.399
  • Root Mean Squared Error (RMSE): 1.183 hours

Visualizations

  1. Training Loss Curve (MSE vs Epochs)
  2. Predicted vs Actual Sleep Hours

Tools & Libraries

  • Python 3
  • NumPy
  • Pandas
  • Matplotlib
  • scikit-learn (for preprocessing and train-test split only)