carrot: neat.evolve() crashes when fitness set to null

Running my code I now have this error ReferenceError: Parameter "dataset" is required; parameter "dataset" is missing.

Code: neat.evolve(null, filter, adjust);

It seems that evolve no longer allows null datasets.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 32 (22 by maintainers)

Commits related to this issue

Most upvoted comments

I added a null check for fitness. It’s now working poorly. Again it will never increase the generation number. It never returns from this method: await self.evaluate(evolve_dataset);

Think I just found the culprit, turns out the default fitness is just a regular synchronous function so we shouldn’t be using await for it

The tests we had weren’t checking the default self.fitness so I’m going to make sure that we explicitly test for it and also for the new Neat({ fitness: null }) cases

Awesome catch @dan-ryan 🎆

I added a null check for fitness. It’s now working poorly. Again it will never increase the generation number. It never returns from this method: await self.evaluate(evolve_dataset);

@nicolares20 “based on what would a network be evolved if there is no dataset supplied” Games. This was created in Neataptic: https://github.com/zonetti/snake-neural-network/

In my example, I do have a dataset, but I can’t do what I need. No way to get Carrot to create my custom bot class which I use to store all the data about the bot so I can calculate its score.

Nice, glad you found the problem.

The changes should support these use-cases now:

  • new Neat(dataset) | Neat.evolve(otherSet), prioritizes otherSet
  • new Neat(dataset) | Neat.evolve(), falls back to dataset
  • new Neat() | Neat.evolve(otherSet), uses otherSet
  • new Neat() | Neat.evolve(), uses .score property to evolve

@dan-ryan We finished the cleaning portion yesterday (https://github.com/liquidcarrot/carrot/projects/11); I think we found a few things. We’re taking a couple hours today to plan how to fix them all, we’ll put this (and other .evolve() related things) on top on the priority list

Yeah no rush 😃

I cherry-picked those fixes but it now expects fitness to not be null.

@dan-ryan Just created a PR - I basically reverted some of the changes, temporarily.

We’ve been cleaning, to start writing cleaner tests. Hoping to have these testing/clean code issues resolved in ❤️ weeks.

I’ll send a quick patch and leave this issue open - till tests are created.

I’m looking into now @dan-ryan