NeuralNetworkJS is a simple library to demonstrate supervised learning with an Artificial Neural Network. The library allows you to create a NeuralNetwork object which represents a fully connected network of an arbitrary size.
First clone the repository into the node_modules folder of your npm project:
git clone https://github.com/mcjcloud/NeuralNetworkJS.gitInstall the dependencies:
cd NeuralNetworkJS && npm install
From your code:
constNeuralNetwork=require('NeuralNetworkJS');varnn=newNeuralNetwork([3,3,2]);The input for this constructor is an array of layer sizes. The size of the array is the number of layers (including the input and output layer), and each number in the array is the number of nodes in that layer.
Feedfoward data
// input is an array of numbers which is fed into the input layernn.feedforward([0,1,1]);Train using back-propogation
// the first array is the input data and the second is the expected output datann.train([0,1,1],[0.5,0.5]);