Concept

Logistic Regression Cost Function

To train the parameters W and B of the logistic regression model, you need to define a cost function.

J(w,b)=1mi=1mL(y^(i),y(i))J(w, b) = \frac{1}{m} \sum_{i=1}^{m} L(\hat{y}^{(i)}, y^{(i)})

=1mi=1m[y(i)log(y^(i))+(1y(i))log(1y^(i))]=-\frac{1}{m} \sum_{i=1}^{m} [y^{(i)}log(\hat{y}^{(i)}) + (1 - y^{(i)})log(1 - \hat{y}^{(i)})]

This loss function is Convex.

Image 0

0

2

Updated 2024-04-05

Tags

Data Science

Related