Machine Learning
-
Gradient Descent Implementation for Logistic Regression (로지스틱 회귀를 위한 경사 하강) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 11. 6. 21:32
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Classification Logistic Regression에 대해 다시 복기해보자. Linear Regression과 동일하게, w와 b값을 찾는 것 인데, sigmoid 함수 안에 e의 마이너스 지수로 이용된 wx + b 에서의 w(vector 이다), b의 조합을 찾아야 한다. 이전 시간에, Loss function을 이용해서 Cost를 계산하는 방법에 대해 배워봤다. 그렇다면 w와 b의 값은 어떻게 바꿔나갈 수 있을까? Linear Regression에서 했던 것처럼, Logistic Regression에도 역..
-
Cost Function for Logistic Regression (로지스틱 회귀를 위한 비용함수) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 11. 6. 20:37
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Classification Squared Error Cost Classification Model을 생성하기 위해서는 Logistic Regression을 이용해서 예측할 수 있다고 배웠다. 그렇다면, 다른 모델들처럼 생성된 모델의 성능을 평가할 수 있어야한다. Logistic Regression의 Cost Function이 무엇인지 알아보자. 다음과 같은 트레이닝 데이터셋이 있다고 가정하자. Tumor Size (cm) ... patient's age malignant? 10 52 1 2 73 0 5 55 0 12 4..
-
Decision Boundary (결정 경계) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 11. 5. 18:06
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Classification Logistic Regression이 어떻게 예측을 계산하는지 더 잘 이해하기 위해 Decision Boundry에 대해 알아보자. 앞에서 배웠듯, Logistic Regression은 Sigmoid 함수에 Linear Regression 모델을 대입해서 아래와 같은 함수를 이용해서 True가 될 확률을 0 에서 1 사이의 소수점으로 나타내주는 모델이다. 그렇다면 그것을 가지고 우리는 어떻게 판단할 수 있나? 바로 threshold를 이용해서, 해당 확률이 threshold보다 같거나 크면 T..
-
Logistic Regression (로지스틱 회귀) | Supervised Machine Learning: Regression and ClassificationMachine Learning/Stanford ML Specialization 2023. 11. 5. 17:26
Coursera Machine Learning Specialization > Supervised Machine Learning: Regression and Classification > Classification Logistic Regression (로지스틱 회귀) 로지스틱 회귀에 대해 알아보자. 로지스틱 회귀는 세계적으로 가장 많이 쓰이는 머신러닝 알고리즘중 하나이다. Logistic Regression은 분류된 데이터에 위와 같이 회전된 S자 형태의 그래프를 그려주는것 이라고 할 수 있다. Sigmoid Function(시그모이드 함수) 여기서 threshold라는 개념이 나오는데, 이 값을 이용해서 그 값에 만나는 포인트를 중심으로 True 또는 False로 값을 예측할 수 있게 된다. 여기서 아..
-
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이 늘어나는데..