npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

layerganza

2.4.0 • Public • Published

This is a feed forward neural network with injectable layers, activation functions, and optimizers.

Installation:

npm install layerganza

Example usage:

import {
    Network,
    InputLayer,
    HiddenLayer,
    OutputLayer,
    Linear,
    LeakyRelu,
    AdamOptimizer,
    shuffleTrain
} from 'layerganza'
 
//Create the model
var network = new Network(
    [
        new InputLayer(2),
        new HiddenLayer(100, new LeakyRelu(), new AdamOptimizer()),
        new OutputLayer(6, new Linear(), new AdamOptimizer())
    ],
);
 
//Train the model
var trainingSets = [//Outputs: [XOR, OR, AND, GreaterThan, LessThan, NotBoth]
    [[0, 0], [0, 0, 0, 0, 0, 1]],
    [[0, 1], [1, 1, 0, 0, 1, 0]],
    [[1, 0], [1, 1, 0, 1, 0, 0]],
    [[1, 1], [0, 1, 1, 0, 0, 0]],
];
shuffleTrain(network, trainingSets, 200);
 
//Get some output from the model
console.log('Output for input [1,1]:', network.invoke([1, 1]));

install

npm i layerganza

Downloadsweekly downloads

17

version

2.4.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability