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

nanonet

v0.1.4

Published

A lightweight neural network class for JavaScript.

Downloads

4

Readme

nanonet

A lightweight neural network class for JavaScript.

Install Instructions

via npm

  • run install command from terminal
npm install nanonet
  • Import the NanoNet class into your project, e.g.,
import NanoNet from 'nanonet'

via download

  • Download or Clone repository and unzip.
  • Import the NanoNet class into your project, e.g.,
import NanoNet from './nanonet'

How to Use NanoNet

Initialise

  • After importing the NanoNet class into your project (see above), you can create a new neural network instance as follows:
let neuralNetwork = new NanoNet();

This initialises a neural network with one input layer, one hidden layer and one output layer by default.

  • To define the structure of the network, pass in an array to the class constructor as follows:
// The structure can be any array of integers >= 1 and with length >= 2.  
let structure = [8,4,2];
let neuralNetwork = new NanoNet(structure);

The array length defines the number of layers in the network, whilst the integer values define how many neurons should be initialised in each layer, e.g., a network with an input layer with 16 neurons and an output layer with 9 neurons would have a structure [16,9]. To add in 3 hidden layers, with 4,5 and 6 neurons respectively, the structure becomes [16,4,5,6,9].

The default structure is [2,2,2].

Methods

.feedForward(inputData)

let inputData = [7.5,0.40576,8];
let fed = neuralNetwork.feedForward(inputData);

Given an array of input data, the feedForward method feeds the data forwards through the network and returns the NanoNet instance that was fed. Data must be numeric.

Important - The length of the array must match the length of the input layer to the network. Hopefully this is intuitive as each piece of data corresponds to an input activation.

.train(trainingData)

Given an array of training data, the network will be trained (i.e., will update its weights and biases using SGD style backpropagation).

Training data must be numeric and structured as follows:

let trainingData = [
  // Each element in the array is a training instance.
  [
    // Each training instance is expected to hold two arrays, the first
    // holding the input data (see .feedForward)
    [7.5,0.40576,8],
    // and the second holding the expected output
    [0,1],
  ], // ...
];
let trained = neuralNetwork.train(trainingData);

The train method returns the updated instance of the NanoNet class.

Important - The length of the input and expected output arrays must match the input and output structure of the network.

Properties

.learningRate

The learning rate can be manually updated by reassigning the value of the property:

let neuralNetwork = new NanoNet();
neuralNetwork.learningRate = 0.02;

The default learning rate is 0.1;

License

MIT