logloss

It measures the performance of a classification model where the output of the classification model is in terms of probability. It takes into account the uncertainty of the predictions based on how much it varies from the actual label. Best Value: 0 Worst Value: tends to infinity (it increases as the predicted probability value diverges from actual label).

Syntax

Loss = logloss(targets,predictions)

Inputs

targets
Actual label for each observation.
Type: double
Dimension: vector
predictions
Predicted value for each observation.
Type: double
Dimension: vector

Outputs

Loss
Log loss of the classifier.
Type: double
Dimension: scalar

Example

Usage of logloss

targets = [1, 0];
predictions = [0, 1];
score = logloss(targets, predictions);
> score
score = 24.1771435

Comments

When predicted probability becomes 0 or 1, it leads to error or infinity in OML, because of the computation of log(0). So, min and max functions are applied to solve this problem. When the predicted probability is 0, it is replaced with 1e^(-15) and when the predicted probability is 1, it is replaced with 1-1e^(-6).