fitness

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package fitness provides common fitness functions.

Index

Constants

This section is empty.

Variables

View Source
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

type FloatFunc func(predicted, target []float64) (float64, error)

FloatFunc ...

func MeanSquaredErrorAbs

func MeanSquaredErrorAbs(scaleFactor float64) (FloatFunc, error)

MeanSquaredErrorAbs returns a fitness function that calculates the mean square error and is normalized from 0 to scaleFactor.

func MeanSquaredErrorAbsRoot

func MeanSquaredErrorAbsRoot(scaleFactor float64) (FloatFunc, error)

MeanSquaredErrorAbsRoot returns a fitness function that calculates the square root of the mean square error and is normalized from 0 to scaleFactor.

func MeanSquaredErrorRel

func MeanSquaredErrorRel(scaleFactor float64) (FloatFunc, error)

MeanSquaredErrorRel returns a fitness function that calculates the mean square relative error and is normalized from 0 to scaleFactor.

func MeanSquaredErrorRelRoot

func MeanSquaredErrorRelRoot(scaleFactor float64) (FloatFunc, error)

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

func NumHitsAbs(precision, scaleFactor float64) (FloatFunc, error)

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

func NumHitsRel(precision, scaleFactor float64) (FloatFunc, error)

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

func RSquare(scaleFactor float64) (FloatFunc, error)

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

func SelectionRangeAbs(selectionRange, scaleFactor float64) (FloatFunc, error)

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

func SelectionRangeRel(selectionRange, scaleFactor float64) (FloatFunc, error)

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL