Linear Regression Explained

This shows linear regression where the blue points are the training examples and the red line is the line of best-fit Image by

Predicting House Prices using its features

This represents the input (no. of bedrooms) of the i-th training example
This represents the output (the price of the house) of the i-th training example
This is our hypothesis, with two parameters theta 0 and theta 1

Cost Function

This is the mean squared error function where m is the number of training examples and theta 0 and theta 1 are the two parameters of the cost function and the hypothesis

Gradient Descent

This shows how the gradient descent algorithm finding the local minimum in the graph of the cost function Image by-
These equations show how to adjust the two parameters where := is the assignment operator, and alpha is the learning rate

Multivariable Linear Regression

This represent the k-th feature in the i-th training example
We define this feature to be equal to 1 for notation purposes
Theta is now a vector of parameters where j is the number of features for each training examples
Our hypothesis has now a single parameter which is a vector now and x is also a vector. The hypothesis is the dot product of the two vectors
Our cost function now also takes a single parameter theta, which is now a vector
Each iteration of gradient descent, we now update all the parameters simultaneously


Thanks for Reading!




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Predict Customer Churn?

2020 Kaleidoscope

Prevention is better than cure: a case study of the abnormalities detection in the chest

Decision Tree Algorithm

Time Series Analysis on COV-19 HK cases

Applied Deep Reinforcement Learning in Quantitative Trading (Both Momentum and Market Neutral)

Session : How data literate is your organization

How to Use the Aito Engine to Predict Animals

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ahaan Pandya

Ahaan Pandya

More from Medium

Linear regression and Multiple regression

Caveats of Linear Regression

Linear Regression: Fundamental

Explaining Linear Regression