This post was translated from the original with AI assistance. Read the original
Reposted from my old CSDN blog: 机器学习笔记(7)——逻辑回归:代价函数 (written 2018-04-19); formatting tidied during migration.
Logistic Regression: Cost Function#
To train the parameters w and b, we need to define a cost function.
Overview:

(tips:
is the i-th training example)
Loss Function#
The loss function computes the difference between the prediction
and the desired output
. In other words, the loss function computes the error for a single training example.

- If
, then
should be close to 1 - If
, then
should be close to 0
Cost Function#
The cost function is the average of the loss function over the entire training set. We’ll find the parameters w and b that make the cost function as small as possible.

Comments