liquidcarrot / carrot

🥕 Evolutionary Neural Networks in JavaScript
https://liquidcarrot.io/carrot/
MIT License
293 stars 34 forks source link

gitFittest & gitAverage are sync functions calling async ones. #211

Closed missionz3r0 closed 4 years ago

missionz3r0 commented 4 years ago

As a precursor, I'm willing to make these changes myself. But want to make sure there is not a reason for these functions to be the way they are before doing so.

Description

In neat:

getFittest and getAverage both call the async method evaluate while being sync methods. This causes unexpected behavior when calling getFittest or getAverage. Seems this was an issue back in neataptic too.

See wagenaartje/neataptic#137 and wagenaartje/neataptic#100

Files

You can see the function I am talking about here.

To Reproduce

Just call getFittest, or getAverage.

Tasks

Include specific tasks in the order they need to be done in. Include links to specific lines of code where the task should happen at.

christianechevarria commented 4 years ago

@missionz3r0 thanks for writing such a well articulated issue; this was an issue that we noted but seemed to slip through the cracks as we were working on the codebase. I'll merge your PR now 👍

missionz3r0 commented 4 years ago

@christianechevarria Thank you very much.

It was something I noticed in neataptic a couple days ago before I realized Carrot was a thing. Was surprised when the same issue was over here as well. Though, if not for the issue in neataptic I would not have known carrot was a thing. So all is well that ends well.

christianechevarria commented 4 years ago

@missionz3r0 Welcome to the community then! 😄 We have a few projects going on, as of late we are working to refactor the library and migrate to TS to make it more maintainable in preparation to add more features + new algo implementations