Documentation ¶
Overview ¶
The package neatns contains Novelty Search implementation for NEAT method of ANN's evolving
Index ¶
- Constants
- type ItemsDistance
- type ItemsDistances
- type NoveltyArchive
- func (a *NoveltyArchive) EndOfGeneration()
- func (a *NoveltyArchive) EvaluateIndividualNovelty(org *genetics.Organism, pop *genetics.Population, onlyFitness bool)
- func (a *NoveltyArchive) EvaluatePopulationNovelty(pop *genetics.Population, onlyFitness bool)
- func (a *NoveltyArchive) PrintFittest(w io.Writer) error
- func (a *NoveltyArchive) PrintNoveltyPoints(w io.Writer) error
- func (a *NoveltyArchive) UpdateFittestWithOrganism(org *genetics.Organism) error
- type NoveltyItem
- type NoveltyItemsByFitness
- type NoveltyMetric
Constants ¶
const KNNNoveltyScore = 15
how many nearest neighbors to consider for calculating novelty score?
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ItemsDistance ¶
type ItemsDistance struct {
// contains filtered or unexported fields
}
the structure to hold distance between two items
type ItemsDistances ¶
type ItemsDistances []ItemsDistance
The sortable list of distances between two items
func (ItemsDistances) Len ¶
func (f ItemsDistances) Len() int
func (ItemsDistances) Less ¶
func (f ItemsDistances) Less(i, j int) bool
func (ItemsDistances) Swap ¶
func (f ItemsDistances) Swap(i, j int)
type NoveltyArchive ¶
type NoveltyArchive struct { // the all the novel items we have found so far NovelItems []*NoveltyItem // the all novel items with fittest organisms associated found so far FittestItems NoveltyItemsByFitness // the current generation Generation int // contains filtered or unexported fields }
The novelty archive contains all of the novel items we have encountered thus far. Using a novelty metric we can determine how novel a new item is compared to everything currently in the novelty set
func NewNoveltyArchive ¶
func NewNoveltyArchive(threshold float64, metric NoveltyMetric) *NoveltyArchive
Creates new instance of novelty archive
func (*NoveltyArchive) EndOfGeneration ¶
func (a *NoveltyArchive) EndOfGeneration()
the steady-state end of generation call
func (*NoveltyArchive) EvaluateIndividualNovelty ¶
func (a *NoveltyArchive) EvaluateIndividualNovelty(org *genetics.Organism, pop *genetics.Population, onlyFitness bool)
evaluate the novelty of a single individual organism within population and update its fitness (onlyFitness = true) or store individual's novelty item into archive
func (*NoveltyArchive) EvaluatePopulationNovelty ¶
func (a *NoveltyArchive) EvaluatePopulationNovelty(pop *genetics.Population, onlyFitness bool)
evaluate the novelty of the whole population and update organisms fitness (onlyFitness = true) or store each population individual's novelty items into archive
func (*NoveltyArchive) PrintFittest ¶
func (a *NoveltyArchive) PrintFittest(w io.Writer) error
prints collected individuals with maximal fitness
func (*NoveltyArchive) PrintNoveltyPoints ¶
func (a *NoveltyArchive) PrintNoveltyPoints(w io.Writer) error
prints collected novelty points to provided writer
func (*NoveltyArchive) UpdateFittestWithOrganism ¶
func (a *NoveltyArchive) UpdateFittestWithOrganism(org *genetics.Organism) error
to maintain list of fittest organisms so far
type NoveltyItem ¶
type NoveltyItem struct { // The generation when item was added to archive Generation int // The ID of associated individual organism */ IndividualID int // The fitness of the associated organism Fitness float64 // The novelty of this item Novelty float64 // The item's age Age float64 // The data associated with item Data []float64 // contains filtered or unexported fields }
The data holder for novel item's genome and phenotype
type NoveltyItemsByFitness ¶
type NoveltyItemsByFitness []*NoveltyItem
The sortable list of novelty items by fitness
func (NoveltyItemsByFitness) Len ¶
func (f NoveltyItemsByFitness) Len() int
func (NoveltyItemsByFitness) Less ¶
func (f NoveltyItemsByFitness) Less(i, j int) bool
func (NoveltyItemsByFitness) Swap ¶
func (f NoveltyItemsByFitness) Swap(i, j int)
type NoveltyMetric ¶
type NoveltyMetric func(x, y *NoveltyItem) float64
The novelty metric function type. The function to compare two novelty items and return distance/difference between them