mutator

package
v0.0.0-...-e130fdf Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2016 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activation

type Activation struct {
	ActivationSettings
}

func (Activation) Mutate

func (m Activation) Mutate(g *neat.Genome) error

Mutates a genome's weights

type ActivationSettings

type ActivationSettings interface {
	MutateActivationProbability() float64 // Probability that the node's activation will be mutated
}

type Classic

type Classic struct {
	Complexify
	Weight
	Trait
}

func (Classic) Mutate

func (c Classic) Mutate(g *neat.Genome) error

func (*Classic) SetContext

func (m *Classic) SetContext(x neat.Context) error

type Complete

type Complete struct {
	Phased
	Weight
	Trait
	Activation
}

func (Complete) Mutate

func (c Complete) Mutate(g *neat.Genome) error

func (*Complete) SetContext

func (m *Complete) SetContext(x neat.Context) error

func (*Complete) SetPopulation

func (m *Complete) SetPopulation(p neat.Population) error

Sets the population

type Complexify

type Complexify struct {
	ComplexifySettings
	// contains filtered or unexported fields
}

func (*Complexify) Mutate

func (m *Complexify) Mutate(g *neat.Genome) error

Mutates a genome's weights

func (*Complexify) SetContext

func (m *Complexify) SetContext(x neat.Context) error

type ComplexifySettings

type ComplexifySettings interface {
	WeightRange() float64                  // The mutation range of the weight. If x, range is [-x,x]
	AddNodeProbability() float64           // Probablity a node will be added to the genome
	AddConnProbability() float64           // Probability a connection will be added to the genome
	HiddenActivation() neat.ActivationType // Activation type to assign to new nodes
}

Complexifying mutation settings

type Phased

type Phased struct {
	PhasedSettings

	// Inner mutators
	Complexify
	Pruning
	// contains filtered or unexported fields
}

Phased Searching As an alternative to blended searching I propose the use of 'phased' searching, so called because the NEAT search switches between a complexifying phase and a simplifying(or pruning) phase.

Phased searching works as follows:

  1. Before the search starts proper, calculate a threshold at which the prune phase will begin. This threshold is the current mean population complexity (MPC)** plus a specified pruning phase threshold value which typically might be between 30-100 depending on the type of experiment.
  2. The search begins in complexifying mode and continues as traditional NEAT until the prune phase threshold is reached.
  3. The search now enters a prune phase. The prune phase is almost algorithmically identical to the complexifying phase, and the normal process of selecting genomes for reproduction, generating offspring, monitoring species compatibility, etc. all takes place. The difference is that the additive mutations are disabled and subtractive ones enabled in their place. In addition only asexual reproduction (with mutation) is allowed. Crossover is disabled because this can allow genes to propagate through a population, thus increasing complexity.
  4. During each generation of the pruning phase a reading of the MPC is taken, this will normally be seen to fall as functionally redundant structures are removed from the population. As pruning progresses the MPC will eventually reach a floor level when no more redundant structure remains in the population to be removed. Therefore once MPC has not fallen for some number of generations (this is configurable, between 10-50 works well), we can reset the next pruning phase's threshold to be the current MPC floor level + the pruning phase threshold parameter and switch into a complexifying phase. The whole process then begins again at (2).

One small modification was made to the above process, and that is to not enter prune phase unless the population fitness has not risen for some specified number of generations. Therefore if the complexity has risen past the pruning phase threshold but the population fitness is still rising then we hold off the pruning phase until the fitness stops rising.

from Colin Green (http://sharpneat.sourceforge.net/phasedsearch.html)

func (*Phased) Mutate

func (m *Phased) Mutate(g *neat.Genome) (err error)

Mutates the Genome by through complexifiying or pruning depending on current phase

func (*Phased) SetContext

func (m *Phased) SetContext(x neat.Context) error

func (*Phased) SetPopulation

func (m *Phased) SetPopulation(p neat.Population) error

Updates the statistics of the population and determines if a phase switch is required.

type PhasedSettings

type PhasedSettings interface {
	PruningPhaseThreshold() float64
	MaxMPCAge() int
	MaxImprovementAge() int
	ImprovementType() neat.FitnessType
}

Phased mutatation settings

type Pruning

type Pruning struct {
	PruningSettings
}

func (Pruning) Mutate

func (m Pruning) Mutate(g *neat.Genome) error

Mutates a genome's structure by selectiving removing nodes and connections

type PruningSettings

type PruningSettings interface {
	DelNodeProbability() float64 // Probablity a node will be removed to the genome
	DelConnProbability() float64 // Probability a connection will be removed to the genome
}

Pruning mutation settings

type Trait

type Trait struct {
	TraitSettings
}

func (Trait) Mutate

func (m Trait) Mutate(g *neat.Genome) error

Mutates a genome's traits

type TraitSettings

type TraitSettings interface {
	Traits() neat.Traits                // Repository of traits
	MutateTraitProbability() float64    // Probability that the trait will be mutated
	ReplaceTraitProbability() float64   // Probability that the trait will be replaced
	MutateSettingProbability() float64  // Probability that the setting will be mutated
	ReplaceSettingProbability() float64 // Probability that the setting will be replaced
}

type Weight

type Weight struct {
	WeightSettings
}

func (Weight) Mutate

func (m Weight) Mutate(g *neat.Genome) error

Mutates a genome's weights

type WeightSettings

type WeightSettings interface {
	WeightRange() float64              // The mutation range of the weight. If x, range is [-x,x]
	MutateWeightProbability() float64  // Probability that the weight will be mutated
	ReplaceWeightProbability() float64 // Probability that the weight will be replaced
}

Jump to

Keyboard shortcuts

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