public class Stats
extends java.lang.Object
Supplier<Stream<double[][]>> expAndPredVals = () -> Arrays.stream(
new double[][][]{
{{0.0, 0.0, 1.0}, {0.0, 0.1, 0.9}},
{{0.0, 1.0, 0.0}, {0.8, 0.2, 0.0}},
{{1.0, 0.0, 0.0}, {0.7, 0.1, 0.2}},
{{1.0, 0.0, 0.0}, {0.3, 0.3, 0.4}},
{{0.0, 0.0, 1.0}, {0.2, 0.2, 0.6}}
}
);
Calculate the root mean square error:
Stats.rmse(expAndPredVals.get());
Calculate the score of the classification accuracy:
Stats.score(expAndPredVals.get());
Constructor and Description |
---|
Stats() |
Modifier and Type | Method and Description |
---|---|
static double |
rmse(java.util.stream.Stream<double[][]> outputPairs)
Root Mean Square Error.
|
static double |
score(java.util.stream.Stream<double[][]> outputPairs)
Classification Accuracy.
|
public static double rmse(java.util.stream.Stream<double[][]> outputPairs)
RMSE is the standard deviation of the prediction errors.
outputPairs
- A stream of array-pairs that contain the expected and predicted values.public static double score(java.util.stream.Stream<double[][]> outputPairs)
The ratio of number of correct predictions to the total number of provided pairs. For a prediction to be considered as correct, the index of its maximum expected value needs to be the same with the index of its maximum predicted value.
outputPairs
- A stream of array-pairs that contain the expected and predicted values.