C# 클래스 AForge.Genetic.SymbolicRegressionFitness

Fitness function for symbolic regression (function approximation) problem

The fitness function calculates fitness value of GP and GEP chromosomes with the aim of solving symbolic regression problem. The fitness function's value is computed as: 100.0 / ( error + 1 ) where error equals to the sum of absolute differences between function values (computed using the function encoded by chromosome) and input values (function to be approximated).

Sample usage:

// constants double[] constants = new double[5] { 1, 2, 3, 5, 7 }; // function to be approximated double[,] data = new double[5, 2] { {1, 1}, {2, 3}, {3, 6}, {4, 10}, {5, 15} }; // create population Population population = new Population( 100, new GPTreeChromosome( new SimpleGeneFunction( 1 + constants.Length ) ), new SymbolicRegressionFitness( data, constants ), new EliteSelection( ) ); // run one epoch of the population population.RunEpoch( );
상속: IFitnessFunction
파일 보기 프로젝트 열기: holisticware-admin/MonoVersal.AForgeNET 1 사용 예제들

공개 메소드들

메소드 설명
Evaluate ( IChromosome chromosome ) : double

Evaluates chromosome.

The method calculates fitness value of the specified chromosome.

SymbolicRegressionFitness ( double data, double constants ) : System

Initializes a new instance of the SymbolicRegressionFitness class.

The data parameter defines the function to be approximated and represents a two dimensional array of (x, y) points.

The constants parameter is an array of constants, which can be used as additional variables for a genetic expression. The actual amount of variables for genetic expression equals to the amount of constants plus one - the x variable.

Translate ( IChromosome chromosome ) : string

Translates genotype to phenotype .

The method returns string value, which represents approximation expression written in polish postfix notation.

메소드 상세

Evaluate() 공개 메소드

Evaluates chromosome.
The method calculates fitness value of the specified chromosome.
public Evaluate ( IChromosome chromosome ) : double
chromosome IChromosome Chromosome to evaluate.
리턴 double

SymbolicRegressionFitness() 공개 메소드

Initializes a new instance of the SymbolicRegressionFitness class.

The data parameter defines the function to be approximated and represents a two dimensional array of (x, y) points.

The constants parameter is an array of constants, which can be used as additional variables for a genetic expression. The actual amount of variables for genetic expression equals to the amount of constants plus one - the x variable.

public SymbolicRegressionFitness ( double data, double constants ) : System
data double Function to be approximated.
constants double Array of constants to be used as additional /// paramters for genetic expression.
리턴 System

Translate() 공개 메소드

Translates genotype to phenotype .
The method returns string value, which represents approximation expression written in polish postfix notation.
public Translate ( IChromosome chromosome ) : string
chromosome IChromosome Chromosome, which genoteype should be /// translated to phenotype.
리턴 string