npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dn2a

v0.2.0

Published

DN2A - Digital Neural Networks Architecture

Downloads

17

Readme

DN2A - Digital Neural Networks Architecture

Build Status Code Climate Coverage Status Dependency Status MIT licensed npm version


About

DN2A is a set of highly decoupled JavaScript modules for Neural Networks and Artificial Intelligence development.

Each module is based on injection by configuration.

You can use a single module alone, more of them together or just the complete set.

DN2A main goal is to allow you to design, train and use without pain Single Neural Networks as well as very powerful Neural Networks Chains through which implement your Artificial Intelligence solution.

DN2A side goals are to simplify integration, to speed up training/querying, to allow clustering and to represent the architecture and the relative data of each Neural Network as a (re)combinable string strain that will be usable within genetics optimization techniques.


Features

  • Modularized components: helps the development and the clear separation of concerns with great benefits for who wants to use mixed solutions.
  • Configurable precision: helps to avoid the noise deriving from operation errors and default system precision limits with great improvement of the learning speed and performance stability.
  • Configuration checker: helps to write less details about configuration and to keep compatibility with older version while the project evolves.
  • StepByStep training: helps to train neural networks doing a single iteration over the passed information without trying to reach a specific parametric condition.
  • StepByGoal training: helps to train neural networks doing a finite or infinite number of iterations over the passed information unless a specific parametric condition is reached.
  • Continuous training: helps to train neural networks doing an infinite number of iterations over the passed information.
  • TODO (Bios) Data normalization: helps to simplify the interaction within your real domain.
  • TODO (Host) Networks composition: helps to create very effective architectures of multiple neural networks able to obtain advanced behaviours like in deep learning.
  • TODO (Host) Computation parallelization: helps to improve the scalability of your whole system.
  • TODO (Bios) Sessions intercommunication: helps to improve the scalability of your whole system.

Modules

Node (Neuron)

Module able to facilitate the representation of the data structure around Neurons and to hold relative common functionalities.

Link (Synapse)

Module able to facilitate the representation of the data structure around Synapses and to hold relative common functionalities.

Network (Neural Network or Cortical Column)

Module, available in different variations, able to use Neurons and Synapses to implement configurable and autonomous Neural Networks.

Available Network Types

  1. alpha: standard feed forward neural network with error back propagation controlled by layer dimensions, learning mode, learning rate, momentum rate, maximum allowed error and maximum number of epochs.

Host (Cerebrum)

Module for the management of multiple Neural Networks in terms of configuration/coordination, training/querying chaining and parallel computing.

Bios (Brain)

Module for the management of data normalization, integration/intercommunication with other external software and monitoring of the whole session.


Tutorials

Using in Node

To install the library through NPM:

npm install dn2a

Using in the Browser

To install the library through Bower:

bower install dn2a

Training and Querying a Single Network with default parametrization (ES5)

// Importation
var DN2A = require("dn2a");

// Instantiation
var neuralNetwork = new DN2A.NetworkAlpha();

// Training
var trainingPatterns = [
    {
        input: [0, 0],
        output: [0]
    },
    {
        input: [0, 1],
        output: [1]
    },
    {
        input: [1, 0],
        output: [1]
    },
    {
        input: [1, 1],
        output: [0]
    }
];
neuralNetwork.train(trainingPatterns);

// Querying
var inputPatterns = [
    [0, 0],
    [0, 1],
    [1, 0],
    [1, 1]
];
neuralNetwork.query(inputPatterns, function(queryingStatus) {
    inputPatterns.forEach(function(inputPatten, inputPatternIndex) {
        console.log("[" + inputPatterns[inputPatternIndex].join(", ") + "] => [" + queryingStatus.outputPatterns[inputPatternIndex].join(", ") + "]");
    });
});

Training and Querying a Single Network with custom parametrization (ES5)

// Importation
var DN2A = require("dn2a");

// Instantiation
// The object expected by the constructor can specify properties that describe the neural network.
// The list of the valid properties together their accepted ranges and default values is reported in this README file.
// The object can be completely omitted and in this case default values are used for all properties.
var neuralNetwork = new DN2A.NetworkAlpha();

var neuralNetwork = new DN2A.NetworkAlpha({
    layerDimensions: [2, 4, 4, 1],
    learningMode: "continuous",
    learningRate: 0.3,
    momentumRate: 0.7,
    maximumError: 0.005,
    maximumEpoch: 20000,
    dataRepository: {},
    neuron: {
        generator: DN2A.Neuron
    },
    synapse: {
        generator: DN2A.Synapse
    },
    numbersPrecision: 32
});

// Training
var trainingPatterns = [
    {
        input: [0, 0],
        output: [0]
    },
    {
        input: [0, 1],
        output: [1]
    },
    {
        input: [1, 0],
        output: [1]
    },
    {
        input: [1, 1],
        output: [0]
    }
];
neuralNetwork.train(trainingPatterns);

// Querying
var inputPatterns = [
    [0, 0],
    [0, 1],
    [1, 0],
    [1, 1]
];
neuralNetwork.query(inputPatterns, function(queryingStatus) {
    inputPatterns.forEach(function(inputPatten, inputPatternIndex) {
        console.log("[" + inputPatterns[inputPatternIndex].join(", ") + "] => [" + queryingStatus.outputPatterns[inputPatternIndex].join(", ") + "]");
    });
});

Training and Querying a Single Network with evolution feedback (ES5)

// Importation
var DN2A = require("dn2a");

// Instantiation
var neuralNetwork = new DN2A.NetworkAlpha();

// Training
// The object passed to the callback function contains information about the training process.
// The list of the valid properties together their accepted ranges and default values is reported in this README file.
var trainingPatterns = [
    {
        input: [0, 0],
        output: [0]
    },
    {
        input: [0, 1],
        output: [1]
    },
    {
        input: [1, 0],
        output: [1]
    },
    {
        input: [1, 1],
        output: [0]
    }
];
neuralNetwork.train(trainingPatterns, function(trainingStatus) {
    console.log("Epoch: " + trainingStatus.elapsedEpochCounter);
});

// Querying
var inputPatterns = [
    [0, 0],
    [0, 1],
    [1, 0],
    [1, 1]
];
neuralNetwork.query(inputPatterns, function(queryingStatus) {
    inputPatterns.forEach(function(inputPatten, inputPatternIndex) {
        console.log("[" + inputPatterns[inputPatternIndex].join(", ") + "] => [" + queryingStatus.outputPatterns[inputPatternIndex].join(", ") + "]");
    });
});

Training and Querying a Single Network through the Host (ES5)

// Importation
var DN2A = require("dn2a");

// Instantiation
var cerebrum = new DN2A.Cerebrum({
    minds: [
        {
            name: "firstNeuralNetwork",
            network: {
                generator: DN2A.NetworkAlpha,
                configuration: {
                    layerDimensions: [2, 4, 1],
                    learningMode: "continuous",
                    learningRate: 0.3,
                    momentumRate: 0.7,
                    maximumError: 0.005,
                    maximumEpoch: 1000,
                    dataRepository: {},
                    neuron: {
                        generator: DN2A.Neuron
                    },
                    synapse: {
                        generator: DN2A.Synapse
                    },
                    numbersPrecision: 32
                }
            },
            inputsFrom: [
                "cerebrum"
            ]
        }
    ],
    outputsFrom: [
        "firstNeuralNetwork"
    ]
});

// Training
// The name expected as third parameter by the trainMind method specifies which specific mind to train
var trainingPatterns = [
    {
        input: [0, 0],
        output: [0]
    },
    {
        input: [0, 1],
        output: [1]
    },
    {
        input: [1, 0],
        output: [1]
    },
    {
        input: [1, 1],
        output: [0]
    }
];
cerebrum.trainMind(trainingPatterns, function(trainingStatus) {
    console.log("Epoch: " + trainingStatus.elapsedEpochCounter);
}, "firstNeuralNetwork");

// Querying
// The name expected as third parameter by the queryMind method specifies which specific mind to query
var inputPatterns = [
    [0, 0],
    [0, 1],
    [1, 0],
    [1, 1]
];
cerebrum.queryMind(inputPatterns, function(queryingStatus) {
    inputPatterns.forEach(function(inputPatten, inputPatternIndex) {
        console.log("[" + inputPatterns[inputPatternIndex].join(", ") + "] => [" + queryingStatus.outputPatterns[inputPatternIndex].join(", ") + "]");
    });
}, "firstNeuralNetwork");

Training and Querying an entire Networks Chain through the Host (ES5)

TODO

Training and Querying a Single Network through the Bios (ES5)

TODO

Training and Querying an entire Networks Chain through the Bios (ES5)

TODO

Creator

Antonio De Luca


License

MIT