Regression(회귀)

Hypothesis(h(θ))

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/52649a76-1941-4244-b774-063e3336de88/Untitled.png

h(x) 는 training set로 구한 모델이다.

Y에 영향을 끼치는 feature(x)가 하나일 때 h(x)는 다음 식으로 표현된다(Univariate linear regression일때)

$h(x)= \theta_0+\theta_1x$

Cost Function

모델의 정확도를 평가하기 위한 함수 $J(\theta_1,...\theta_n)$로 표현된다.

$$ ⁍
$$

2m을 쓰는 이유: 원래 정의 상 m을 쓰는 것이 맞으나, 미분 시 편하려고 사용하는 것

왜 오차는 MSE를 사용할까? MAE와 차이는?

: MSE의 경우 손실함수가 convex한 형태, MAE는 뾰족한 형태로 나온다. 이는 local minima를 찾을 가능서의 차이를 불러온다

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/d90883d9-e098-4686-b182-0b3a61c35e6c/Untitled.png

Linear regression에서는 위의 그림과 같이 항상 convex로 cost function이 나오기 때문에 local optima문제가 생기지 않는다.

Gradient descent

$J(\theta_1,...\theta_n)$을 가장 작게 만들기 위해 사용하는 방법으로 미분을 이용한다.(기울기)

$$ \theta_j := \theta_j -\alpha\frac{\delta}{\delta\theta_j}J(\theta_0,...\theta_n)= \theta_j -\alpha\frac{1}{m}\Sigma(h_\theta(x_i)-y_i)x^{(i)}
$$

을 이용한다. 이때 $\alpha$는 learning rate 즉, 기울기를 반영하는 정도를 의미하며 이 값이 너무 크면 minimum에 도달하지 못하니 주의하자.