2.7 (选修)logistic 损失函数的解释(Explanation of logistic regression cost function )
可以看成是预测输出为正类(+1)的概率:
当y=1时:
当y=0时:
整合到一个式子:
进行log处理:
上述概率P(y|x)越大越好,加上负号,则转化成了单个样本的Loss function,越小越好:
对于所有m个训练样本,假设样本之间是独立同分布的,总的概率越大越好:
引入log函数,加上负号,将上式转化为Cost function:
Previous2.6 向量化 logistic 回归的梯度输出(Vectorizing Logistic Regression’s Gradient Output)
NextLogistic Regression with a Neural Network mindset 代码
Last updated
Was this helpful?