yuns

Logistic Regression 본문

goorm 수업 정리/Machine Learning

Logistic Regression

yuuuun 2021. 8. 26. 12:18
반응형

classification task 수행 가능

binary classification, mulit-class classification

Logistic Regression

  • 예시
    • email: spam? not spam?
    • online transaction: Fradudulent? - 카드 lock
    • Tumor: Malignant? Benign? - 암 - 양성? 음성?
  • y{0,1} - 0: negative class 1: positive class
  • 예측 값이 0.5이상일 경우 1로 예측, 0.5 미만일 경우 0으로 예측
  • outlier가 있을 경우 linear regression이 이상하게 되기 때문에 무리가 있음

Logistic Model

  • 0\reqhθ(x)\req1 로 고정시키기 위하여 사용하는 함수: sigmoid function
    • sigmoid function: \frac{1}{1+e^{-\theta ^T x}

Decision Boundary

  • h0
    • Linear decision boundaries
    • non-linear decision boundaries

Cost Function

  • hθ(x(1))0.5: 1
  • hθ(x(1))<0.5 : 0
  • logistic regrsesion cost function
    • y = 1 ->Cost(hθ(x),y)=log(hθ(x)
    • y = 0 ->Cost(hθ(x),y)=log(1hθ(x))
    • --> ylog(hθ(x))(1y)log(1hθ(x))
  • J(θ)=1mCost(hθ(x(i)),y(i))=1m[iy(i)log(hθ(x(i))+(1y(i))log(1hθ(x(i)))]

Gradient Descent in Logistic Regression

  • J(a, b) = -log(\frac{1}{1+e^{-(ax+b)}
  • \frac{dJ(a,b)}{da} = \frac{-e^{(ax+b)}}{1+e^{-ax+b} \times x

Multi-class Classification

  • target value 값만 True, 나머지를 False로 지정
  • softmax 함수로 어느 클래스에 속할지 예측
반응형

'goorm 수업 정리 > Machine Learning' 카테고리의 다른 글

Dimensionality Reduction  (0) 2021.09.01
Cross Validation and Dimensionality Reduction  (0) 2021.08.30
Regularization  (0) 2021.08.27
Multiple Variable Linear Regression  (0) 2021.08.25
Linear Regression  (0) 2021.08.24
Comments