Table of contents:


References

Linear regression model

For example, if the goal is to predict the price of a house given the size, and you are given a training set of existing house sizes and prices, the basic flow will look something like the image.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/0a17e9e6-d8ca-468d-a96e-c096e48a8415/model_representation_overview.png

Training set

The input existing data used to determine the best parameters for the hypothesis.

Linear hypothesis

Used to find a straight line through data.

$$ h_\theta(x) = \theta_0 + \theta_1x $$

Sometimes it will just be $h(x)$ for short.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/80151660-651f-4649-b935-4d62e357279c/linear_regression.png

Cost function

$$ J(\theta_0, \theta_1) = \frac{1}{2m}\sum_{i=1}^m (h_\theta(x^{(i)}) - y^{(i)})^2 $$

Finds the error between the hypothesis with a set of parameters and the actual results from the Training Set.

It is equal to $\frac{1}{2}\bar{x}$ where $\bar{x}$ is the mean of the squares of $h_\theta(x^{(i)}) - y^{(i)}$. This equals the difference between predicted and actual value. It is halved for convenience of computing Gradient Descent (derivative of the square will cancel out the half).

Gradient descent