Documentation ¶
Overview ¶
The experiments package holds various experiments with NEAT.
Index ¶
- func OutDirForTrial(outDir string, trialID int) string
- type ActionType
- type Experiment
- func (e *Experiment) AvgEpochDuration() time.Duration
- func (e *Experiment) AvgGenerationsPerTrial() int
- func (e *Experiment) AvgTrialDuration() time.Duration
- func (e *Experiment) AvgWinner() (avg_nodes, avg_genes, avg_evals, avg_diversity float64)
- func (e *Experiment) BestAge() Floats
- func (e *Experiment) BestComplexity() Floats
- func (e *Experiment) BestFitness() Floats
- func (e *Experiment) BestOrganism(onlySolvers bool) (*genetics.Organism, int, bool)
- func (ex *Experiment) Decode(dec *gob.Decoder) error
- func (e *Experiment) Diversity() Floats
- func (ex *Experiment) Encode(enc *gob.Encoder) error
- func (e *Experiment) Epochs() Floats
- func (ex *Experiment) Execute(context *neat.NeatContext, start_genome *genetics.Genome, executor interface{}) (err error)
- func (e *Experiment) LastExecuted() time.Time
- func (ex *Experiment) PrintStatistics()
- func (ex *Experiment) Read(r io.Reader) error
- func (e *Experiment) Solved() bool
- func (e *Experiment) TrialsSolved() int
- func (ex *Experiment) Write(w io.Writer) error
- type Experiments
- type Floats
- type Generation
- type GenerationEvaluator
- type Generations
- type Trial
- func (t *Trial) Average() (fitness, age, complexity Floats)
- func (t *Trial) AvgEpochDuration() time.Duration
- func (t *Trial) BestAge() Floats
- func (t *Trial) BestComplexity() Floats
- func (t *Trial) BestFitness() Floats
- func (t *Trial) BestOrganism(onlySolvers bool) (*genetics.Organism, bool)
- func (t *Trial) Decode(dec *gob.Decoder) error
- func (t *Trial) Diversity() Floats
- func (t *Trial) Encode(enc *gob.Encoder) error
- func (t *Trial) LastExecuted() time.Time
- func (t *Trial) Solved() bool
- func (t *Trial) Winner() (nodes, genes, evals, diversity int)
- type TrialRunObserver
- type Trials
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OutDirForTrial ¶
To provide standard output directory syntax based on current trial Method checks if directory should be created
Types ¶
type ActionType ¶
type ActionType byte
The type of action to be applied to environment
const ( // The continuous action type meaning continuous values to be applied to environment ContinuousAction ActionType = iota // The discrete action assumes that there are only discrete values of action (e.g. 0, 1) DiscreteAction )
The supported action types
type Experiment ¶
An Experiment is a collection of trials for one experiment. It's useful for statistical analysis of a series of experiments
func (*Experiment) AvgEpochDuration ¶
func (e *Experiment) AvgEpochDuration() time.Duration
Calculates average duration of evaluations among all generations of organism populations in this experiment
func (*Experiment) AvgGenerationsPerTrial ¶
func (e *Experiment) AvgGenerationsPerTrial() int
Calculates average number of generations evaluated per trial during this experiment. This can be helpful when estimating algorithm efficiency, because when winner organism is found the trial is terminated, i.e. less evaluations - more fast convergence.
func (*Experiment) AvgTrialDuration ¶
func (e *Experiment) AvgTrialDuration() time.Duration
Calculates average duration of experiment's trial Note, that most trials finish after solution solved, so this metric can be used to represent how efficient the solvers was generated
func (*Experiment) AvgWinner ¶
func (e *Experiment) AvgWinner() (avg_nodes, avg_genes, avg_evals, avg_diversity float64)
Returns average number of nodes, genes, organisms evaluations, and species diversity of winner genomes among all trials, i.e. for all trials where winning solution was found
func (*Experiment) BestAge ¶
func (e *Experiment) BestAge() Floats
The age values of the organisms for each trial
func (*Experiment) BestComplexity ¶
func (e *Experiment) BestComplexity() Floats
The complexity values of the best organisms for each trial
func (*Experiment) BestFitness ¶
func (e *Experiment) BestFitness() Floats
The fitness values of the best organisms for each trial
func (*Experiment) BestOrganism ¶
Finds the most fit organism among all epochs in this trial. It's also possible to get the best organism only among the ones which was able to solve the experiment's problem. Returns the best fit organism in this experiment among with ID of trial where it was found and boolean value to indicate if search was successful.
func (*Experiment) Decode ¶
func (ex *Experiment) Decode(dec *gob.Decoder) error
Decodes experiment data
func (*Experiment) Diversity ¶
func (e *Experiment) Diversity() Floats
Diversity returns the average number of species in each trial
func (*Experiment) Encode ¶
func (ex *Experiment) Encode(enc *gob.Encoder) error
Encodes experiment with GOB encoding
func (*Experiment) Epochs ¶
func (e *Experiment) Epochs() Floats
Trials returns the number of epochs in each trial
func (*Experiment) Execute ¶
func (ex *Experiment) Execute(context *neat.NeatContext, start_genome *genetics.Genome, executor interface{}) (err error)
The Experiment execution entry point
func (*Experiment) LastExecuted ¶
func (e *Experiment) LastExecuted() time.Time
Returns time of last trial's execution
func (*Experiment) PrintStatistics ¶
func (ex *Experiment) PrintStatistics()
Prints experiment statistics
func (*Experiment) Read ¶
func (ex *Experiment) Read(r io.Reader) error
Reads experiment data from provided reader and decodes it
func (*Experiment) Solved ¶
func (e *Experiment) Solved() bool
func (*Experiment) TrialsSolved ¶
func (e *Experiment) TrialsSolved() int
The number of trials solved
type Experiments ¶
type Experiments []Experiment
Experiments is a sortable list of experiments by execution time and Id
func (Experiments) Len ¶
func (es Experiments) Len() int
func (Experiments) Less ¶
func (es Experiments) Less(i, j int) bool
func (Experiments) Swap ¶
func (es Experiments) Swap(i, j int)
type Floats ¶
type Floats []float64
Floats provides descriptive statistics on a slice of float64 values
type Generation ¶
type Generation struct { // The generation ID for this epoch Id int // The time when epoch was evaluated Executed time.Time // The elapsed time between generation execution start and finish Duration time.Duration // The best organism of best species Best *genetics.Organism // The flag to indicate whether experiment was solved in this epoch Solved bool // The list of organisms fitness values per species in population Fitness Floats // The age of organisms per species in population Age Floats // The list of organisms complexities per species in population Compexity Floats // The number of species in population at the end of this epoch Diversity int // The number of evaluations done before winner found WinnerEvals int // The number of nodes in winner genome or zero if not solved WinnerNodes int // The numbers of genes (links) in winner genome or zero if not solved WinnerGenes int // The ID of Trial this Generation was evaluated in TrialId int }
The structure to represent execution results of one generation
func (*Generation) Average ¶
func (epoch *Generation) Average() (fitness, age, complexity float64)
Returns average fitness, age, and complexity among all organisms from population at the end of this epoch
func (*Generation) Encode ¶
func (epoch *Generation) Encode(enc *gob.Encoder) error
Encodes generation with provided GOB encoder
func (*Generation) FillPopulationStatistics ¶
func (epoch *Generation) FillPopulationStatistics(pop *genetics.Population)
Collects statistics about given population
type GenerationEvaluator ¶
type GenerationEvaluator interface { // Invoked to evaluate one generation of population of organisms within given // execution context. GenerationEvaluate(pop *genetics.Population, epoch *Generation, context *neat.NeatContext) (err error) }
The interface describing evaluator for one generation of evolution.
type Generations ¶
type Generations []Generation
Generations is a sortable collection of generations by execution time and Id
func (Generations) Len ¶
func (is Generations) Len() int
func (Generations) Less ¶
func (is Generations) Less(i, j int) bool
func (Generations) Swap ¶
func (is Generations) Swap(i, j int)
type Trial ¶
type Trial struct { // The trial number Id int // The results per generation in this trial Generations Generations // The winner generation WinnerGeneration *Generation // The elapsed time between trial start and finish Duration time.Duration }
The structure to hold statistics about one experiment run (trial)
func (*Trial) Average ¶
Returns average fitness, age, and complexity of population of organisms for each epoch in this trial
func (*Trial) AvgEpochDuration ¶
Calculates average duration of evaluations among all generations of organism populations in this trial
func (*Trial) BestComplexity ¶
Complexity returns the complexity of the best species for each epoch in this trial
func (*Trial) BestFitness ¶
Fitness returns the fitnesses of the best organisms for each epoch in this trial
func (*Trial) BestOrganism ¶
Finds the most fit organism among all epochs in this trial. It's also possible to get the best organism only among the ones which was able to solve the experiment's problem.
func (*Trial) LastExecuted ¶
type TrialRunObserver ¶
type TrialRunObserver interface { // Invoked to notify that new trial run just started before any epoch evaluation in that trial run TrialRunStarted(trial *Trial) }
The interface to describe trial lifecycle observer interested to receive lifecycle notifications
Directories ¶
Path | Synopsis |
---|---|
The pole balancing experiments is classic Reinforced Learning task proposed by Richard Sutton and Charles Anderson.
|
The pole balancing experiments is classic Reinforced Learning task proposed by Richard Sutton and Charles Anderson. |
The XOR experiment serves to actually check that network topology actually evolves and everything works as expected.
|
The XOR experiment serves to actually check that network topology actually evolves and everything works as expected. |