CodingTrain / Toy-Neural-Network-JS

Neural Network JavaScript library for Coding Train tutorials
MIT License
425 stars 242 forks source link

More tests! #53

Open shiffman opened 6 years ago

shiffman commented 6 years ago

Neural Network class needs tests?

AR-234 commented 6 years ago

One problem with that is that node needs to import the matrix lib into nn and i haven't found a way to bypass the browser error with the require statement.. otherwise i would be happy to do some tests.

shiffman commented 6 years ago

Well I guess this should eventually move to a more proper build system, but for now would a solution like I'm doing here work, but with require instead?

if (typeof module !== 'undefined') {
  module.exports = Matrix;
}
MTRNord commented 6 years ago

There is also still the solution by me in #13 to rely on ES6 which plays fine with browsers. It would remove the if completly (but has as stated in that PR other side effects)

shiffman commented 6 years ago

Thank you for this reminder @MTRNord, apologies I haven't had the time yet to learn more about ES6 modules and review in more detail.

MTRNord commented 6 years ago

@shiffman no problem :) take your time to learn it 👍 It isn't urgent to have it but it is a "Nice to have" from my perspective :)

AR-234 commented 6 years ago

ah ok, awesome, and the typeof approach doesn't work, because Matrix is defined but i guess i will try the ES6 thing

MTRNord commented 6 years ago

@AR-234 keep in mind what I wrote in my PR the ES6 way doesn't work "out of the box" until the PR is merged. (thats the side effect)

AR-234 commented 6 years ago

but maybe there should be a building process: if the lib keeps expanding and stuff like a class for training methods get added, or even more advanced stuff, it could get really bad with the readability of the file

Adil-Iqbal commented 6 years ago

I remember something being mentioned about the Neural network library being expanded to include a flexible number of hidden layers. If that's true, it would help to know what that looks like before tests are written. There are a few ways it could be implemented.