Class R2
- java.lang.Object
-
- ai.libs.jaicore.ml.classification.loss.dataset.APredictionPerformanceMeasure<java.lang.Double,org.api4.java.ai.ml.regression.evaluation.IRegressionPrediction>
-
- ai.libs.jaicore.ml.regression.loss.dataset.ARegressionMeasure
-
- ai.libs.jaicore.ml.regression.loss.dataset.R2
-
- All Implemented Interfaces:
org.api4.java.ai.ml.core.evaluation.supervised.loss.IDeterministicPredictionPerformanceMeasure<java.lang.Double,org.api4.java.ai.ml.regression.evaluation.IRegressionPrediction>
public class R2 extends ARegressionMeasure
The R^2, aka. the coefficient of determination describes the proportion of the variance in the target variable and the predicted values. The formula of R^2 is as follows: (\sum_i (y^\hat_i - \bar{y})^2) / (\sum_i (y_i - \bar{y})^2) For predictions not worse than prediting constantly the mean of the target variable, R^2 resides within the [0, 1] interval. Caution: For worse predictions the coefficient of determination becomes *negative*.
-
-
Constructor Summary
Constructors Constructor Description R2()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublescore(java.util.List<? extends java.lang.Double> expected, java.util.List<? extends org.api4.java.ai.ml.regression.evaluation.IRegressionPrediction> predicted)If this performance measure is originally a loss function its loss is transformed into a score by multiplying the loss with -1.-
Methods inherited from class ai.libs.jaicore.ml.classification.loss.dataset.APredictionPerformanceMeasure
averageInstanceWiseLoss, averageInstanceWiseScore, checkConsistency, loss, loss, score
-
-
-
-
Method Detail
-
score
public double score(java.util.List<? extends java.lang.Double> expected, java.util.List<? extends org.api4.java.ai.ml.regression.evaluation.IRegressionPrediction> predicted)Description copied from class:APredictionPerformanceMeasureIf this performance measure is originally a loss function its loss is transformed into a score by multiplying the loss with -1. (score=-loss).- Specified by:
scorein interfaceorg.api4.java.ai.ml.core.evaluation.supervised.loss.IDeterministicPredictionPerformanceMeasure<java.lang.Double,org.api4.java.ai.ml.regression.evaluation.IRegressionPrediction>- Overrides:
scorein classAPredictionPerformanceMeasure<java.lang.Double,org.api4.java.ai.ml.regression.evaluation.IRegressionPrediction>
-
-