JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 184
  • Score
    100M100P100Q91645F
  • License MIT

feedforward neural networks library

Package Exports

  • ml-fnn

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ml-fnn) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Feedforward Neural Network

NPM version build status David deps npm download

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

new FeedforwardNeuralNetwork([LayersSize])

Arguments

  • layersSize - Array of numbers with sizes of each layer.

Example

var fnn = new FeedforwardNeuralNetwork();

train(trainingSet, predictions, iterations, 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.
  • options - A Javascript object with the configuration of the FNN.

Options

  • hiddenLayers - Array with the size of each hidden layer in the FNN.
  • iterations - Maximum number of iterations of the algorithm.
  • 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]];
var options = {
  hiddenLayers: [4],
  iterations: 100,
  learningRate: 0.3,
  momentum: 0.3
};

fnn.train(trainingSet, predictions, options);

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