- Type Parameters:
- T- the sample type
- 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 calculates the overall error of a given program tree.
 The error is calculated from the 
LossFunction and, if desired, the
 program Complexity.
 
final Error<Double> error = Error.of(LossFunction::mse, Complexity.ofNodeCount(50));
- Since:
- 5.0
- Version:
- 5.0
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptiondoubleCalculates the overall error of a given program tree.static <T> Error<T> of(LossFunction<T> loss) Creates an error function which only uses the givenlossfunction for calculating the program errorstatic <T> Error<T> of(LossFunction<T> loss, Complexity<T> complexity) Creates an error function by combining the givenlossfunction and programcomplexity.static <T> Error<T> of(LossFunction<T> loss, Complexity<T> complexity, DoubleBinaryOperator compose) Creates an error function by combining the givenlossfunction and programcomplexity.
- 
Method Details- 
applyCalculates the overall error of a given program tree. The error is calculated from theLossFunctionand, if desired, the programComplexity.- Parameters:
- program- the program tree which calculated the- calculatedvalues
- calculated- the calculated function values
- expected- the expected function values
- Returns:
- the overall program error
- Throws:
- NullPointerException- if one of the arguments is- null
 
- 
ofCreates an error function which only uses the givenlossfunction for calculating the program error- Type Parameters:
- T- the sample type
- Parameters:
- loss- the loss function to use for calculating the program error
- Returns:
- an error function which uses the loss function for error calculation
- Throws:
- NullPointerException- if the given- lossfunction is- null
 
- 
ofCreates an error function by combining the givenlossfunction and programcomplexity. The loss function and program complexity is combined in the following way:error = loss + loss*complexity. The complexity function penalizes programs which grow to big.- Type Parameters:
- T- the sample type
- Parameters:
- loss- the loss function
- complexity- the program complexity measure
- Returns:
- a new error function by combining the given loss and complexity function
- Throws:
- NullPointerException- if one of the functions is- null
 
- 
ofstatic <T> Error<T> of(LossFunction<T> loss, Complexity<T> complexity, DoubleBinaryOperator compose) Creates an error function by combining the givenlossfunction and programcomplexity. The loss function and program complexity is combined in the following way:error = loss + loss*complexity. The complexity function penalizes programs which grow to big.- Type Parameters:
- T- the sample type
- Parameters:
- loss- the loss function
- complexity- the program complexity measure
- compose- the function which composes the- lossand- complexityfunction
- Returns:
- a new error function by combining the given loss and complexity function
- Throws:
- NullPointerException- if one of the functions is- null
 
 
-