Cost Function (Method I)
For calculating the cost in linear regression, typically we use Sum of Squared Error method(SSE)
The goal is to minimize \(\ J(\theta)\) and figure out \(\ \theta\) values corresponding to the minimum cost. There are several optimization algorithms used to achieve this.
\(\ J(\theta) = \frac{1}{2m}\sum_{i=1}^m{(h(x^{(i)})-{y^{(i)}})^2}\)
The goal is to minimize \(\ J(\theta)\) and figure out \(\ \theta\) values corresponding to the minimum cost. There are several optimization algorithms used to achieve this.