Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IndividalFitness ¶
IndividalFitness used as output fitess of individual Fitness - result of specific network in absolute numbers Index - index of individual in population
type Mutagen ¶
type Mutagen interface {
Mutate(network *neuralnetwork.NeuralNetwork)
}
Mutagen is interface that applies mutations to provided neuralnetwork.NeuralNetwork
type Population ¶
type Population struct { Networks []*neuralnetwork.NeuralNetwork // contains filtered or unexported fields }
Population is main class for genetic and natural selection of neuralnetwork.NeuralNetwork
func NewPopulation ¶
func NewPopulation(verifier PopulationVerifier, mutagen Mutagen, populationConfig PopulationConfig, sizes []int) (p *Population)
NewPopulation is constructor of new Population with specified PopulationVerifier, Mutagen and PopulationConfig. sizes parameter also specified neuralnetwork.NeuralNetwork layers configuration
func (*Population) GetBestNetwork ¶
func (p *Population) GetBestNetwork() *neuralnetwork.NeuralNetwork
GetBestNetwork method returns best network in population according to it fitness
func (*Population) NaturalSelection ¶
func (p *Population) NaturalSelection(generationCount int)
NaturalSelection invokes natural selection process for specified number of generation
type PopulationConfig ¶
type PopulationConfig struct { PopulationSize int SelectionSize float64 // 0..1 percentage of success individuals to be used as parents for population CrossbreedPart float64 // 0..1 percentage of weights and biases to be exchanged beetween individuals while Crossbreed }
PopulationConfig is structure that is used to specify population parameters PopulationSize - size of population SelectionSize - percentage of best individuals used for next generation CrossbreedPart - percentage of weigts and biases used for crossbreed
type PopulationVerifier ¶
type PopulationVerifier interface {
Verify(*Population) []*IndividalFitness
}
PopulationVerifier is interface that used to get fitness results of population