- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
This function evaluates how well an evolved program tree fits the given
sample data set. If the predictions are totally off, the loss function will
output a higher value. If they're pretty good, it’ll output a lower number.
It is the essential part of the overall
Error
function.
final Error<Double> error = Error.of(LossFunction::mse);
- Since:
- 5.0
- Version:
- 5.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondouble
Calculates the error between the expected function values and the values calculated by the actualProgramGene
.static double
Mean absolute error is measured as the average of sum of absolute differences between predictions and actual observations.static double
Mean square error is measured as the average of squared difference between predictions and actual observations.static double
Root-mean-square error is measured as the average of squared difference between predictions and actual observations.
-
Method Details
-
apply
Calculates the error between the expected function values and the values calculated by the actualProgramGene
.- Parameters:
calculated
- the currently calculated function valueexpected
- the expected function values- Returns:
- the error value
- Throws:
IllegalArgumentException
- if the length of the two arrays is not equalNullPointerException
- if one of thedouble[]
arrays isnull
-
mse
Mean square error is measured as the average of squared difference between predictions and actual observations.- Parameters:
calculated
- the function values calculated with the current program treeexpected
- the expected function value as given by the sample points- Returns:
- the mean square error
- Throws:
IllegalArgumentException
- if the length of the two arrays is not equalNullPointerException
- if one of thedouble[]
arrays isnull
- See Also:
-
rmse
Root-mean-square error is measured as the average of squared difference between predictions and actual observations.- Parameters:
calculated
- the function values calculated with the current program treeexpected
- the expected function value as given by the sample points- Returns:
- the mean square error
- Throws:
IllegalArgumentException
- if the length of the two arrays is not equalNullPointerException
- if one of thedouble[]
arrays isnull
- See Also:
-
mae
Mean absolute error is measured as the average of sum of absolute differences between predictions and actual observations.- Parameters:
calculated
- the function values calculated with the current program treeexpected
- the expected function value as given by the sample points- Returns:
- the mean absolute error
- Throws:
IllegalArgumentException
- if the length of the two arrays is not equalNullPointerException
- if one of thedouble[]
arrays isnull
-