Machine Learning
-
Checking Gradient Descent for convergence (경사하강의 수렴) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 10. 30. 23:09
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Regression with multiple input variables 우리가 Gradient Descent을 계산할 때, 우리의 목적은 minimum값으로 수렴할 수 있도록 유도하고, 끝내 Minimum값을 찾아내는 것이다. 여기서 이 J값과 Iteration한 횟수를 그래프로 나타낸것을 Learning Curve라고 한다. 위 그래프에서 보면, 300번정도 Iteration을 했을 때, Minimum값에 가까워졌고, 300번과 400번의 차이가 얼마 없으므로, 400번때에는 Converged, 즉 수렴하고 있다고 판..
-
Feature Scaling | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 10. 30. 22:54
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Regression with multiple input variables Feature and Parameter 집값을 구하기 위해, 두가지의 feature를 사용했다고 가정해보자. 집을 결정하는 요인으로 집의 크기(x1)와 방의 갯수(x2)가 있고, 크기는 300 - 2000 사이, 방의 갯수는 0 - 5 사이라고 가정해보자. 그러면 아래와 같은 모델에서, w1, w2, b값을 알아내는것이 목표이다. price = w1x1 + w2x2 + b 우리가 단 한가지의 training example이 있어서 그것을 갖고 w1,..
-
Gradient descent for multiple linear regression (다중 선형회귀의 경사 하강법) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 10. 30. 21:34
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Regression with multiple input variables 지난번 배운 Gradient Descent와 Vectorization을 모두 이용해서 Multiple Linear Regression(다중 선형회귀)의 Gradient Descent(경사 하강법)에 대해서 알아보자. Vector Notation 기존의 notation을 사용하면 w들을 표현할 때, feature가 여러개라면, w1, w2, ..., wn과 같은 방식으로 표현해야 했다. 또한 모델의 표현도 복잡하다. w들과 b는 아래와 같이 표현할 수..
-
Vectorization (벡터화) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 10. 28. 14:55
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Regression with multiple input variables Vectorization vs non-Vectorization Code 학습 알고리즘을 구현할 때, Vectorization(백터화)를 이용하게 되면 코드도 짧아지고 효율도 좋아진다고 한다. 또한 백터화된 코드를 사용하면 그래픽 용도로 사용되는 GPU를 사용할 수 있다고 한다. 백터화란 무엇인가? 앞서서 살펴본 내용에서 언급한것처럼, feature가 많은 수식을 다음과 같이 벡터화해서 나타낼 수 있다. w = [w1, w2, w3, ...] b = ..
-
Multiple Features | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 10. 28. 14:27
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Regression with multiple input variables Multiple Features 이전까지 Linear Regression을 살펴볼 때, 우리는 아래와 같이 1가지의 feature만 가지고 모델을 구현하는 방법에 대해 알아보았다. $ f(x) = wx + b $ 하지만, 실제 상황은 이렇지 않다. 집값을 예측할 때, 집의 크기 이외에도 방의 갯수, 층의 갯수, 연식, 주변 인구들의 연봉등의 정보들은 모두 집값을 예측하는데 도움을 준다. 이 정보들을 숫자로 나타내면 어떨까? 이런 feature들을 모..
-
Running Gradient Descent | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 10. 27. 20:04
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Introduction to Machine Learning 경사 하강법이 어떻게 동작하는지 알아보도록 하자. 맨 처음에는 아래 함수부터 시작한다. $ F(x) = -0.1 + 900 $ 여기서 Gradient Descent를 이용해서 점점 값을 줄여가면서 가장 작은 Cost, 2311을 찾아내었다. 여기서 Gradient Descent를 계산할 때, 가지고 있는 모든 데이터 예제를 사용해서 계산하는 방식을 Batch Gradient Descent라고 한다. 이렇게 모든 데이터를 사용해서 매번 계산하는것이 비효율적이기 때문..
-
Gradient Descent for Linear Regression (선형회귀를 위한 경사 하강법) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 10. 27. 19:19
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Introduction to Machine Learning 선형회귀와 Cost Function을 다시 살펴보자. Linear Regression모델은 다음과 같다. w와 b값을 바꿔가면서 최종적으로 가장 좋은 Performance를 보여주는 최종 값을 찾는것이다. 그런데 여기서 어떻게 이 모델이 좋은 모델이라고 판단할 수 있는가? 바로 Cost Function을 이용해서, 할 수 있었다. 실제 값과 모델이 추측한 값의 차이들을 비교해서 좋은 w, b값들을 찾아가는게 바로 학습의 과정이었다. 그렇다면 w와 b값은 어떤 방식..
-
Learning Rate (학습률, 알파) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 10. 27. 18:58
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Introduction to Machine Learning Learning Rate(학습률)이라는것이 있다. 지난 시간 Gradient Descent(경사 하강법)에 대해 공부할 때, w값을 바꾸어가면서 계산했는데, 새로운 w값을 찾을 때, 알파(a)값을 바꿔서 J(w)의 Derevitive 값을 곱해줬었다. 여기서 알파(a)가 바로 학습률, Learning Rate이다. 너무 작지도 크지도 않은 Learning Rate를 선택하는것은 아주 중요하다. Too Large or Small Learning Rate 만약, 알파..