Skip to main content

Linear Regression

Given a set of inputs it produces a continuos output

Linear Regression is a machine learning algorithm that is used to predict the value of a dependent variable based on one or more independent variables.

The independent variables are also called features and the dependent variable is also called the target.

The goal of linear regression is to find the best fitting line that describes the relationship between the independent variables and the dependent variable.

Model

The model of linear regression is a linear equation that describes the relationship between the independent variables and the dependent variable.

The general form of the model is:

y=wx+by = w x + b

Where yy is the dependent variable, xx is the independent variable, ww is the weight and bb is the bias.

Cost function

J(w, b)=12mi=1m(y^(i)y(i))2J(w,\ b) = \frac{1}{2m} \sum_{i=1}^{m} (\hat{y}^{(i)} - y^{(i)})^2