Package smile.validation.metric
Class LogLoss
java.lang.Object
smile.validation.metric.LogLoss
- All Implemented Interfaces:
Serializable
,ProbabilisticClassificationMetric
Log loss is an evaluation metric for binary classifiers, and it is sometimes
the optimization objective as well in case of logistic regression and neural
networks. Log Loss takes into account the uncertainty of the prediction
based on how much it varies from the actual label. This provides a more
nuanced view of the performance of the model. In general, minimizing
Log Loss gives greater accuracy for the classifier. However, it is
susceptible in case of imbalanced data.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
instance
Default instance.
-
-
Constructor Details
-
LogLoss
public LogLoss()
-
-
Method Details
-
score
public double score(int[] truth, double[] probability) Description copied from interface:ProbabilisticClassificationMetric
Returns a score to measure the quality of classification.- Specified by:
score
in interfaceProbabilisticClassificationMetric
- Parameters:
truth
- the true class labels.probability
- The posterior probability of positive class.- Returns:
- the metric.
-
of
public static double of(int[] truth, double[] probability) Calculates the Log Loss for binary classifier.- Parameters:
truth
- the ground truth.probability
- the posterior probability of positive class.- Returns:
- Log Loss
-
toString
-