I'm studying a tutorial in a video about supervised learning, more specifically, it's about "linear regression with one variable", that is the cost function.
So my first question : is this "cost function" equal to "linear regression with one variable, or does "cost function" belong to linear regression functions with one variable?
Well, having this as the regression function:
$$\color{green}{\underline{\color{black}{h_\theta(x)}}}=\theta_0+\theta_1x$$
we need to find out the minimum values for $\theta_0$ and $\theta_1$, and where $h$ stands for hypothesis. So my second question is : Why should $\theta_0$ and $\theta_1$ have minimum values? I know that having many training set we need to have kind of approximation... but this didn't help me much.
Finally, to find out the solution (the minimum values $\theta_0$ and $\theta_1$), we need to minimize $J(\theta_0,\theta_1)$ which is the cost function and whose expression is below:
$$J(\theta_0,\theta_1) = \frac{1}{2m} \sum_{i=1}^m (h_\theta(x^{(i)})-y^{(i)})^2$$
$$\begin{array}{cc}\begin{array}{c} \text{minimize}\\ \theta_0,\theta_1 \end{array} & \underbrace{J(\theta_0,\theta_1)}\\ &\text{Cost function} \end{array} $$
where $m$ is the number of the training set and $i$ is the index of the elements in the set. So my third question is : How could we reach this expression? and Can anybody explain this expression to me?