Linear Regression Explained | Full Deep Dive in ML from Scratch to GPU- Math and Model Training

Опубликовано: 18 Июнь 2026
на канале: TheSTEMYogi
290
11

Most people use Linear Regression… without really understanding what happens inside.

In this deep dive, we break Linear Regression down from first principles — no black box thinking.

We start with the simple equation y = mx + b, then build everything step-by-step:

• Method of Least Squares (Normal Equation)
• Gradient Descent (how models actually learn) with Demo
• MSE and loss functions
• Train / Validation / Test split
• Feature scaling
• Overfitting explained
• Ridge (L2), Lasso (L1), Elastic Net with Demo
• Model Accuracy R², Adjusted R² and p-values
• Vector form (Xθ)
• From NumPy to scikit-learn
• CPU vs GPU training (PyTorch demo)

By the end of this video, Linear Regression will not feel like a black box anymore.

This is part of the Machine Learning Deep Dive Series.

Next video: Logistic Regression.

#LinearRegression
#MachineLearning
#DeepLearning
#GradientDescent
#LeastSquares
#DataScience
#RidgeRegression
#LassoRegression
#ElasticNet
#Python
#PyTorch
#scikitlearn
#Statistics
#ArtificialIntelligence

00:00 Introduction – Why Most People Don’t Understand Linear Regression
02:15 What Is Linear Regression? (y = mx + b)
06:07 Method of Least Squares (Closed Form Solution)
09:04 Predictions and Error Explained
13:07 Mean Squared Error (MSE)
14:36 Gradient Descent - Why
15:20 Gradient Descent
18:06 Gradient Descent Calculation by hand
20:46 Gradient Descent Colab Notebook
21:10 Features & Multi-Variable Linear Regression
30:56 Feature Scaling & Overfitting
39:35 L2 Regularisation , L1 Regularisation & Elasticnet
48:05 Vector Notation
51:01 Coding LR in numpy and demo
01:00:40 Types of Linear Regression
01:03:00 Coding all LR model in scikit-learn
01:07:48 Model Evaluation – MSE, R², Adjusted R², p-value
01:11:22 CPU vs GPU – PyTorch Demo
01:16:16 Final Recap – No More Black Box
01:19:28 What’s Next – Logistic Regression


Links:
Gradient Descent : https://github.com/guptnava/youtube_d...

https://colab.research.google.com/dri...

Multivariable Linear Regression:
https://github.com/guptnava/youtube_d...
https://colab.research.google.com/dri...

Training using Numpy:
https://github.com/guptnava/youtube_d...
https://colab.research.google.com/dri...

Training Models using scikit-learn:
https://github.com/guptnava/youtube_d...
https://colab.research.google.com/dri...

Training Models on CPU and GPU comparison:
https://github.com/guptnava/youtube_d...

https//colab.research.google.com/drive/1xVgI70b5hpG4iPXZ9GsCuzMYWkbc3TMD?usp=sharing