로지스틱 회귀모델의 모수 추정

2021. 5. 6. 02:38 AI, 머신러닝/머신러닝

Sigmoid 함수 (logistic function)

sigmoid(x)=11+ex

 

Sigmoid 함수 미분

ddxsigmoid(x)=ddx(1+ex)1

=(1)1(1+ex)2ddx(1+ex)

=(1)1(1+ex)2(0+ex)ddx(x)

=(1)1(1+ex)2ex(1)

=(1)1(1+ex)2ex(1)

=(1)1(1+ex)2ex(1)

=(1+ex)(1+ex)21(1+ex)2

=11+ex1(1+ex)2

=11+ex(111+ex)

=sigmoid(x)(1sigmoid(x))

=σ(x)'=σ(x)(1σ(x))

 

Cost 함수

Cost(hθ(x),y)=ylog(hθ(x))(1y)log(1hθ(x))

 

전체 Cost 함수

j(θ)=1mmi=1[y(i)log(hθ(x(i)))+(1y(i))log(1hθ(x(i)))]

 

Cost 함수 미분

θjj(θ)=θj1mmi=1[y(i)log(hθ(x(i)))+(1y(i))log(1hθ(x(i)))]

=1mmi=1[y(i)θjlog(hθ(x(i)))+(1y(i))θjlog(1hθ(x(i)))]

=1mmi=1[y(i)θjhθ(x(i))hθ(x(i))+(1y(i))θj(1hθ(x(i)))1hθ(x(i))]

=1mmi=1[y(i)θjσ(θTx(i))hθ(x(i))+(1y(i))θj(1σ(θTx(i)))1hθ(x(i))]

=1mmi=1[y(i)σ(θTx(i))(1σ(θTx(i)))θjθTx(i)hθ(x(i))+(1y(i))σ(θTx(i))(1σ(θTx(i)))θjθTx(i)1hθ(x(i))]

=1mmi=1[y(i)hθ(x(i))(1hθ(x(i)))θjθTx(i)hθ(x(i))+(1y(i))hθ(x(i))(1hθ(x(i)))θjθTx(i)1hθ(x(i))]

=1mmi=1[y(i)hθ(x(i))(1hθ(x(i)))x(i)j+(1y(i))hθ(x(i))x(i)j]

=1mmi=1[y(i)hθ(x(i))(1hθ(x(i)))+(1y(i))hθ(x(i))]x(i)j

=1mmi=1[y(i)y(i)hθ(x(i))hθ(x(i))+y(i)hθ(x(i))]x(i)j

=1mmi=1[y(i)hθ(x(i))]x(i)j

=1mmi=1[hθ(x(i))y(i)]x(i)j

 

 

Gradient Desent

Repeat{θj :=θjαθjJ(θ)}

 

 

출처: https://unabated.tistory.com/entry/로지스틱-회귀모델의-모수-추정?category=735138 [랄라라]