Documentation
¶
Overview ¶
Package fitness provides common fitness functions.
Index ¶
- Variables
- type FloatFunc
- func MeanSquaredErrorAbs(scaleFactor float64) (FloatFunc, error)
- func MeanSquaredErrorAbsRoot(scaleFactor float64) (FloatFunc, error)
- func MeanSquaredErrorRel(scaleFactor float64) (FloatFunc, error)
- func MeanSquaredErrorRelRoot(scaleFactor float64) (FloatFunc, error)
- func NumHitsAbs(precision, scaleFactor float64) (FloatFunc, error)
- func NumHitsRel(precision, scaleFactor float64) (FloatFunc, error)
- func RSquare(scaleFactor float64) (FloatFunc, error)
- func SelectionRangeAbs(selectionRange, scaleFactor float64) (FloatFunc, error)
- func SelectionRangeRel(selectionRange, scaleFactor float64) (FloatFunc, error)
Constants ¶
This section is empty.
Variables ¶
var ErrLength = errors.New("length error")
ErrLength is returned when the predicted and target slices are empty or not the same length.
Functions ¶
This section is empty.
Types ¶
type FloatFunc ¶
FloatFunc ...
func MeanSquaredErrorAbs ¶
MeanSquaredErrorAbs returns a fitness function that calculates the mean square error and is normalized from 0 to scaleFactor.
func MeanSquaredErrorAbsRoot ¶
MeanSquaredErrorAbsRoot returns a fitness function that calculates the square root of the mean square error and is normalized from 0 to scaleFactor.
func MeanSquaredErrorRel ¶
MeanSquaredErrorRel returns a fitness function that calculates the mean square relative error and is normalized from 0 to scaleFactor.
func MeanSquaredErrorRelRoot ¶
MeanSquaredErrorRelRoot returns a fitness function that calculates the square root of the mean square relative error and is normalized from 0 to scaleFactor.
func NumHitsAbs ¶
NumHitsAbs returns a fitness function that favors models that perform well for all fitness cases within a certain absolute error (that is, the precision that is chosen for the evolved models - a number between 0 and 1, inclusive) of the correct value. The maximum fitness possible is N*scaleFactor, where N=len(target).
func NumHitsRel ¶
NumHitsRel returns a fitness function that favors models that perform well for all fitness cases within a certain relative error (that is, the precision that is chosen for the evolved models - a number between 0 and 1, inclusive) of the correct value. The maximum fitness possible is N*scaleFactor, where N=len(target).
func RSquare ¶
RSquare returns a fitness function that is based on the standard R-square, which returns the square of the Pearson product moment correlation coefficient. The return value is normalized from 0 to scaleFactor.
func SelectionRangeAbs ¶
SelectionRangeAbs returns a fitness function that is used as a limit for selection to operate, above which the performance of a program on a particular fitness case contributes nothing to its fitness. The precision is the limit for improvement as it allows the fine-tuning of the evolved solutions as accurately as possible. The maximum fitness possible is N*selectionRange*scaleFactor, where N=len(target).
func SelectionRangeRel ¶
SelectionRangeRel returns a fitness function that is used as a limit for selection to operate, above which the performance of a program on a particular fitness case contributes nothing to its fitness. The precision is the limit for improvement as it allows the fine-tuning of the evolved solutions as accurately as possible. The error is calculated relative to the target value. The maximum fitness possible is N*selectionRange*scaleFactor, where N=len(target).