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

neural-network-node

v1.4.7

Published

A simple neural network coded from scratch with no external modules. Lets you train your own neural network in a simple and easy to learn way.

Downloads

28

Readme

Neural-Network-Module

A simple easy to use Node JS, HTML JS, and Java module which lets you create your own neural network and train it. This was coded from scratch and uses my numpy-matrix-js module for the Matrix math.

About

Types of Neural Networks supported

  • Standard (Feed Forward)
  • DFF (Deep Feed Forward) aka multiple hidden layers module

Set up

Quick Start Standard

Creating a neural network

The function to create a new neural network is just:

const nn = new NeuralNetwork.Standard(input_nodes, hidden_nodes, output_nodes);

In this case, you will have to change some of these.

  1. replace the input_nodes with however many inputs you give the network
  2. replace the hidden_nodes with however many hidden nodes you want. this number is arbitrary. You can choose whatever you want but might have to tweak it for optimal results.
  3. replace the output_nodes with however many outputs you want.

Once you're done with this, you have finished creating the neural network. The next step is to train it with data.

Training the model

To train the model, use the following function:

nn.train(input, output)

where input is the value that you input and output is the value the computer should output.

Testing the model

To test the model, use this function:

nn.predict(input)

This will make the computer use it's previous tested data to make a guess for what the output should be.

You're done creating a basic neural network. For more functionality, take a look at the documentation.

Quick Start DFF

Creating a neural network

The function to create a new neural network is just:

const nn = new NeuralNetwork.DFF(input_nodes, hidden_nodes, output_nodes);

In this case, you will have to change some of these.

  1. replace the input_nodes with however many inputs you give the network
  2. replace the hidden_nodes with an array. The first element in the array is the number of hidden nodes for the first hidden layer, the second element is for the second layer, and so on.
  3. replace the output_nodes with however many outputs you want.

Once you're done with this, you have finished creating the neural network. The next step is to train it with data.

Training the model

To train the model, use the following function:

nn.train(input, output)

where input is the value that you input and output is the value the computer should output.

Testing the model

To test the model, use this function:

nn.predict(input)

Finished.

Examples

Documentation

nn.getWeights()

Returns all of the current weights of the neural network

nn.getBias()

Returns all of the current biases of the neural network

nn.getLearningRate()

Returns the current learning rate of the neural network

nn.setWeights()

| Parameters | What it is | Required | | ------------- | ---------------- | -------- | | weights_array | Array of weights | Yes |

nn.setBias()

| Parameters | What it is | Required | | ---------- | --------------- | -------- | | bias_array | Array of biases | Yes |

nn.setLearningRate()

| Parameters | What it is | Required | | ------------- | ----------------- | -------- | | learning_rate | New learning rate | Yes |

nn.predict()

| Parameters | What it is | Required | | ----------- | ---------------------------------------------------------- | -------- | | input_array | Array of input data that matches the number of input_nodes | Yes |

nn.train()

| Parameters | What it is | Required | | ------------ | ------------------------------- | -------- | | input_array | the input data | Yes | | output_array | what the computer should output | Yes |

Versions

Current Version: 1.3.9

Stable Versions:

1.3.9 - Changed Matrix library to my numpy-matrix-js module for NPM versions only.

1.3.1 - Added DFF for browser support

1.2.9 - Added browser support

1.2.1 - Succesfully added Deep Feed Forward Network. Removed error message for mismatched input data client-side.

1.1.7 - Failed to add Perceptron support. Forced to remove it temporarily

1.1.0 - First stable version