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
- Patched #115; Missing Tests — committed to liquidcarrot/carrot by luiscarbonell 5 years ago
- Fixed #115; Missing Tests — committed to liquidcarrot/carrot by luiscarbonell 5 years ago
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 itThe 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 thenew Neat({ fitness: null })
casesAwesome 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:
otherSet
dataset
otherSet
.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 listYeah 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.
This looks like these commits that broke it. https://github.com/liquidcarrot/carrot/commit/72d6beae6a5013728fbec627db924c87c7770066 https://github.com/liquidcarrot/carrot/commit/31f8e87cc0ded1a3f1eb3a450ccafa4d426153f1
And this one expanded on it: https://github.com/liquidcarrot/carrot/commit/639213b08759ec830752456c2b926c2f85e9644a
I’m looking into now @dan-ryan