https://github.com/yukti-09/linear-regression
A small code for understanding linear regression.
https://github.com/yukti-09/linear-regression
linear-regression matplotlib mean-squared-error numpy
Last synced: about 1 month ago
JSON representation
A small code for understanding linear regression.
- Host: GitHub
- URL: https://github.com/yukti-09/linear-regression
- Owner: Yukti-09
- Created: 2021-05-16T07:14:48.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-16T07:50:13.000Z (about 5 years ago)
- Last Synced: 2025-03-30T22:29:33.159Z (about 1 year ago)
- Topics: linear-regression, matplotlib, mean-squared-error, numpy
- Language: Jupyter Notebook
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Linear-Regression
Linear regression is a linear model, e.g. a model that assumes a linear relationship between the input variables (x) and the single output variable (y). More specifically, that y can be calculated from a linear combination of the input variables (x).
In this analysis, 100 random input samples have been considered with value less than 1.
A function, here, y = 3x has been considered and some randomness has been added to it.
Straight lines are of the form, y = mx + c.
Here, we consider m to be the weights and c to be the bias added.
Therefore, we can say, y = wx + b.
y = [w,b] . [x,1]T
Here, we create a new variable x_dash = [x,1]
The bias added is 1 here.
The cost here is mean squared error.
Cost = Sum (y(predicted) - y(actual))2
= Sum (wTx - y(actual))2
Residuals = wTx - y(actual)
Gradient vector = x * (Residuals)
w(t+1) = w(t) - (Learning Rate) * (Gradient vector)
The code has been run for 100 epochs with a learning rate of 0.01.