Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved: mutate() must skip elitist genomes #153

Closed
christianechevarria opened this issue Aug 12, 2019 · 1 comment
Closed

Moved: mutate() must skip elitist genomes #153

christianechevarria opened this issue Aug 12, 2019 · 1 comment
Labels
😌 code quality For improvements to the syntax, structure, dependencies, etc... ✨ enhancement Something could be better 🚀 performance Regarding the computational performance of something

Comments

@christianechevarria
Copy link
Member

Description

This suggestion has been moved from Neataptic:
wagenaartje/neataptic#160

neataptic version: 1.4.7
As commented in the source (neat.js)
// Elitist genomes should not be included
but code on next line does
for (var i = 0; i < this.population.length; i++) {

(includes elitist genomes to roll for mutation)
Fixing this improves network performance for me.

I will create a pull request to patch this

It seems like @egtzori already added a pull request so it's something we may want to incorporate into the codebase

Files

Neat.js

@christianechevarria christianechevarria added ✨ enhancement Something could be better 😌 code quality For improvements to the syntax, structure, dependencies, etc... 🚀 performance Regarding the computational performance of something labels Aug 12, 2019
@christianechevarria
Copy link
Member Author

The comment that mentions including elitist genomes is misleading as this would most likely refer to .evolve which excludes elitist genomes from mutation for the generation. The relevant code being linked below

'''
// Elitism, assumes population is sorted by fitness
const elitists = []
for (let i = 0; i < self.elitism; i++) elitists.push(population[i].clone())

// Provenance
const new_population = []
for(let i = 0; i < self.provenance; i++) new_population.push(self.template.clone())

// Breed the next individuals
for (let i = 0; i < self.population_size - self.elitism - self.provenance; i++) {
  new_population.push(self.getOffspring())
}

// Replace the old population with the new population
population = self.population = new_population // not purely functional yet so resorting to this

// Mutate the new population
self.mutate()

// Add the elitists
for (let i = 0; i < elitists.length; i++) population.push(elitists[i])

'''

We may consider adding some type of flag for elitist genomes that may confer some trans-generational survivability (with a decay rate before they are mutated / re-evaluated), but for now will not be implementing changes to the .mutate for loop start index as proposed in the pull-request

Closing this for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😌 code quality For improvements to the syntax, structure, dependencies, etc... ✨ enhancement Something could be better 🚀 performance Regarding the computational performance of something
Projects
None yet
Development

No branches or pull requests

1 participant