genetic

package
v0.0.0-...-7591e67 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndividalFitness

type IndividalFitness struct {
	Fitness float64
	Index   int
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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