A small lite weight JS library for your fun project
Inspried by Tensorflow.js but faster in terms of multiple Neural Networks,TF.js works superb when it comes to single Neural Network and allows hardware acceleration. But when used for creating multiple Neural Networks for applications under Genetic Algorithm or Multiple Simulation it kind of lags or consume high resources.
Lite Neural Networks Library allows you to create multiple Neural Networks and perform opeartions on them iteratively
https://cdn.jsdelivr.net/gh/suyashsonawane/Lite-Neural-Networks@latest/lib/nn-v0.js
Creating Neural Network
let nn = new NeuralNetwork([2,3,1]);
let nn = new NeuralNetwork([2,3,5,10,10]);
Training Neural Network
let data = [ { X: [1, 2, 3], Y: [1], }, , , , , { X: [7, 8, 9], Y:
[7], }, ];
let epochs = 1000
let l_rate = 0.1 // default learning rate is set to 0.01
let verbose = 1
nn.fit(data , epochs , l_rate? , verbose? )
Predictions using Neural Network
let X_test = [1,2,3]
nn.predict(X_test) // returns 1d array
Smaple Program XOR Implementation
let data = [ { X: [0, 1], Y: [1], }, { X: [1, 0], Y: [1], }, { X:
[0, 0], Y: [0], }, { X: [1, 1], Y: [0], }, ];
let nn = new NeuralNetwork([2, 5, 1]);
nn.fit(data, 50000, 0.1);
console.log(nn.predict([0, 1]));
console.log(nn.predict([1, 1]));
console.log(nn.predict([1, 0]));
console.log(nn.predict([0, 0]));
This is just a fun project in which I tried to create a simple and light weight Neural Network Library
It's actually still in development but can be used for your fun projects, I'll be pushing change logs on this website and also on my Github repo Lite Neural Network
If you find any bugs or have any ideas do create a issue on this link