전체 글
-
Classification Motivation (분류 회귀) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 11. 5. 16:42
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Classification 지난 시간동안 우리는 어떤 값을 예측하는 알고리즘에 대해 다뤘다. 그렇다면 이번엔 Classification, 즉 분류를 하는 알고리즘에 대해서 공부해보자. 아래와 같은 문제접을 생각해보자. 스팸 이메일인가? (Yes/No) 사기 결제인가? (Yes/No) 종양이 악성인가? (Yes/No) 위 문제들은 모두 Yes 또는 No 둘중 한가지의 답을 예측하는 알고리즘을 필요로 한다. 이렇게 결과 y가 단 2가지의 값이 되는 결우를 binary classification, 이진 분류라고 한다. 이진법..
-
Polynomial Regression (다항 회귀) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 11. 5. 16:17
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Classification 이때까지는 직선으로 이루어진 모델을 예측하는 Linear Regression(선형 회귀)에 대해서 알아보았는데, 이번에는 곡선을 피팅할 수 있는 다항식 회귀라는 새로운 알고리즘에 대해서 배운다. 만약 집값과 집의 크기가 항상 일정한 비율로 증가한다면, Linear Regression으로도 충분하겠지만, 현실은 그렇지 않다. 집의 크기가 어느정도 커지면, 가격의 변동이 주춤하기도 하고, 어떨때는 작은 사이즈 차이인데도 가격의 폭이 클때도 있기 떄문이다. 그런 경우를 생각했을 때, 예측률을 더 높..
-
Feature Engineering (특징 엔지니어링) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 11. 5. 13:58
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Regression with multiple input variables 모델을 만들 때, Feature를 잘 선정하는것 또한 중요한 일이다. 어떤 Feature를 어떻게 넣을지 계산하는 Feature Engineer의 직책이 있을 만큼, ML이 비지니스의 Core Mechanism 이라면, 정말 중요한 요소이다. 맨 처음, Linear Regression(선형 회귀)에 대해서 배울 때, 우리는 집의 크기(area)값을 사용했었다. 집의 Area가 아니라, frontage(정면값)과 depth(깊이)값을 알고 있다고 하자..
-
Choosing the Learning Rate (학습률 선정하기) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 11. 5. 11:53
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Regression with multiple input variables Gradient Descent에 대해 배울 때, 알파, 즉 Learning Rate에 대해서도 배워봤다. Learning Rate가 너무 작으면, 효율적이지 못하고 Minimum을 찾는데 오래 걸리는 반면, 너무 크게 잡아도 Minimum으로 가지 못하고 Gradient Descent가 convergence(수렴)하지 못한다는 내용에 대해 배웠었다. 위에 그림에서 알 수 있듯 J(w, b)값이 점점 작아지는것이 아니라, iteration이 늘어나는데..
-
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 = ..