这里只推导逻辑回归的损失公式。
假设函数
h θ ( x ) = 1 1 + e − θ T x (假设函数) h_\theta(x) = \frac{1}{1+e^{-\theta^Tx}} \tag{假设函数} hθ(x)=1+e−θTx1(假设函数)
用于二分类
KaTeX parse error: Undefined control sequence: \mbox at position 41: …\theta( x), & \̲m̲b̲o̲x̲{if }y=1 \\ (1-…
总结:如果我们取对数和负值,可以代表对应的成本函数。和似然函数相反的方向。(log只是利于计算)。
KaTeX parse error: Undefined control sequence: \mbox at position 56: …theta( x)), & \̲m̲b̲o̲x̲{if }y=1 \\ -lo…
统一公式
我们找到联合概率公式:
p ( y ∣ x , θ ) = h θ ( x ) y ⋅ ( 1 − h θ ( x ) ) 1 − y , (统一概率) p(y|x,\theta) = h_\theta( x)^{y} \cdot (1-h_\theta(x))^{1-y}, \tag{统一概率} p(y∣x,θ)=hθ(x)y⋅(1−h