Feedforward Neural Network
A implementation of feedforward neural networks in javascript based on the mrbo answer
found here:
[Implementation] (http://stackoverflow.com/questions/9951487/implementing-a-neural-network-in-java-training-and-backpropagation-issues)
Methods
Arguments
layersSize
- Array of numbers with sizes of each layer.
Example
var FNN = new FeedforwardNeuralNetwork([2, 4, 1]);
train(trainingSet, predictions, learningRate, momentum)
Train the Neural Network with a given training set, predictions, learning rate and a
momentum (Regularization term).
Arguments
trainingSet
- A matrix of the training set.predictions
- A matrix of predictions with the same size of rows of the trainingSet.learningRate
- The learning rate (number).momentum
- The regularization term (number).
Example
var trainingSet = [[0, 0], [0, 1], [1, 0], [1, 1]];
var predictions = [[0], [0], [0], [1]];
FNN.train(trainingSet, predictions, 0.3, 0.3);
predict(dataset)
Predict the values of the dataset.
Arguments
dataset
- A matrix that contains the dataset.
Example
var dataset = [[0, 0], [0, 1], [1, 0], [1, 1]];
var ans = FNN.predict(dataset);
export()
Exports the actual Neural Network to an Javascript Object.
load(model)
Returns a new Neural Network with the given model.
Arguments
model
- Javascript Object generated from export() function.
Authors
License
MIT