Understanding the various loss functions

As discussed in the previous chapter, there are two types of dependent variables—continuous and categorical variables. In the case of continuous variable prediction, the loss (error) function can be calculated by using the sum of squared error values across all predictions.

In cases where the dependent variable is a categorical variable with only two distinct values associated with it, loss is calculated as the binary cross-entropy error using this formula:

y*logp + (1-y)*log(1-p)

In cases where the dependent variable is a categorical variable with multiple distinct values, the loss is calculated using the categorical cross-entropy error as:

∑ y*logp

Where p is the probability of the event being a ...

Get Hands-On Machine Learning on Google Cloud Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.