\[err(h_\theta(x),y) = \begin{cases} 1 & \text{if }(h_\theta(x) \ge 0.5 \text{ and } y=0)\text{ or }(h_\theta(x) \lt 0.5 \text{ and } y=1) \\ 0 & \text{otherwise (eg. no error detected)} \end{cases}\]
⇒ This is the proportion of errors we have in the test set.
⇒ The problem here is that we are using the test set to select the value of the additional parameter d = polynomial degree so this is going to be an optimistic estimate on how well the hypothesis will perform on a completely new dataset.
\[J_{train}(\theta) = \frac{1}{2m} \sum\limits_{i=1}^m (h_\theta(x^{(i)}) - y^{(i)})^2\]