wagenaartje / neataptic

:rocket: Blazing fast neuro-evolution & backpropagation for the browser and Node.js
https://wagenaartje.github.io/neataptic/
Other
1.19k stars 279 forks source link

Consistent return with train and evolve methods. #78

Open eugenioclrc opened 7 years ago

eugenioclrc commented 7 years ago

If i run network.evolve the function return a promise with the result, but if i run network.train i get a result.

Shouldnt they be consistent? shouldnt both of them return a promise?

wagenaartje commented 7 years ago

That is because network.evolve is an async function and network.train is a sync function. There is not a lot I can do about it, except for creating two seperate functions for network.evolve, e.g.:

network.evolveSync();
network.evolve()

But network.evolveSync wouldn't be able to use multithreading capabilities then. However, it seems a good idea to add a network.trainAsync() function.