wagenaartje / neataptic

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

Fix to test and webpack version upgrade #72

Closed eugenioclrc closed 6 years ago

eugenioclrc commented 6 years ago

I have found some errors in the test file test/network.js

assert.isBelow(0.9, lstm.activate([0]), 'LSTM error');

lstm.activate([0]) returns arrays of numbers, but assert.isBelow expects a number, so this is how it should be;

assert.isBelow(0.9, lstm.activate([0])[0], 'LSTM error');

Also i have upgrade webpack and configure babel to work in a ES6 sintax

wagenaartje commented 6 years ago

Hi! Thanks for the pull request. I did not notice the errors in the assertions during the Travis testing. Thanks for fixing that.

About Babel: Neataptic is micro-optimized to the fullest, e.g. changing a single var to let could reduce training time by a factor of 2. That is reason one why I don't think Babel is a good idea. It could possibly kill performance of the library.

But ECMAScript 6 is almost fully supported by all major browsers and supported Node versions. What i'm saying is: there is no need for Babel (right now) - and if your browser or runtime doesn't support Neataptic, then I recommend you to switch browser/runtime.

If there is any specific reason why you want to include Babel, please let me know.

eugenioclrc commented 6 years ago

You are totally right, there is no need to use babel.

wagenaartje commented 6 years ago

Hi, I see you removed babel. I'm testing your commits and i'm getting this error:

ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in '/home/travis/build/wagenaartje/neataptic'
eugenioclrc commented 6 years ago

I forget to remove babel from the webpack config.

wagenaartje commented 6 years ago

What does new webpack.optimize.ModuleConcatenationPlugin(), do?

eugenioclrc commented 6 years ago

From https://webpack.js.org/plugins/module-concatenation-plugin/

In the past, one of webpack’s trade-offs when bundling was that each module in your bundle would be wrapped in individual function closures. These wrapper functions made it slower for your JavaScript to execute in the browser. In comparison, tools like Closure Compiler and RollupJS ‘hoist’ or concatenate the scope of all your modules into one closure and allow for your code to have a faster execution time in the browser.

El 28 sep. 2017 18:21, "Thomas Wagenaar" notifications@github.com escribió:

What does new webpack.optimize.ModuleConcatenationPlugin(), do?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wagenaartje/neataptic/pull/72#issuecomment-332967440, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUSiq-ulmzQWgXDYJA5zkdKIK115hIVks5snA3BgaJpZM4Pi2UM .

eugenioclrc commented 6 years ago

Yeha, have you update webpack to webpack2? Run 'npm i' after pull so your packages upgrade.

El 1 oct. 2017 2:39 PM, "Thomas Wagenaar" notifications@github.com escribió:

Any idea why it's throwing the following error on me upon building;

new webpack.optimize.ModuleConcatenationPlugin(),
^

TypeError: webpack.optimize.ModuleConcatenationPlugin is not a constructor at Object. (C:\Users\20173591\Documents\GitHub\neataptic\webpack.config.js:37:5) at Module._compile (module.js:573:30) at Object.Module._extensions..js (module.js:584:10) at Module.load (module.js:507:32) at tryModuleLoad (module.js:470:12) at Function.Module._load (module.js:462:3) at Module.require (module.js:517:17) at require (internal/module.js:11:18) at requireConfig (C:\Users\20173591\AppData\Roaming\npm\node_modules\webpack\bin\convert-argv.js:97:18) at C:\Users\20173591\AppData\Roaming\npm\node_modules\webpack\bin\convert-argv.js:104:17 at Array.forEach () at module.exports (C:\Users\20173591\AppData\Roaming\npm\node_modules\webpack\bin\convert-argv.js:102:15) at yargs.parse (C:\Users\20173591\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js:171:41) at Object.Yargs.self.parse (C:\Users\20173591\AppData\Roaming\npm\node_modules\webpack\node_modules\yargs\yargs.js:533:18) at Object. (C:\Users\20173591\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js:152:7)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wagenaartje/neataptic/pull/72#issuecomment-333393142, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUSigTKLkyFBhRjnrlXewt6rEZShEi4ks5sn848gaJpZM4Pi2UM .