Just another NN-learning library for personal usage and education
On Linux after cloning you can already import this lib (src/src.ts
file) to your TS project, but to import to JS project you need to build TS code.
npm install
will install devDependencies and compile TS code (example and src) into /build
folder
After importing lib as NN you can:
- create NN with specific layout like this:
const nn = new NeuralNetwork(1, 2, 1); //makes NN with 3 layers with 1, 2 and 1 neuron respectively
- get output of NN via
feedforward()
:
const out = nn.feedforward(data);
Note that input data should match first layer's size or exception will be thrown
- learn dataset with
train()
:
const dataset = [[input1, output1], [input2, output2], [input3, output3],...];
nn.train(...dataset);
Note that dimensions of input and output should match first and last layer's size respectively
-
dynamically change NN's structure with
addNeuron()
/addLayer()
andremoveNeuron()
/removeLayer()
functions -
import/export NN from file with
saveTo()
andloadFrom()
Other available function is described in Docs.md
Tests can be run with npm test
(after npm install
was once called) which will lint and run test scripts from /tests
folder
Tests check wheather code works for simplest case of NNs and some features. More information about tests is available Docs.md
Examples of usage are available in Examples.md
You can run sources after building project with node ./build/*example*