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

sus.js

v1.1.0

Published

A simple and easy to use neural network library. Do not use for serious projects that need high preformance. I'm too lazy to learn to use the gpu for neural networks.

Downloads

3

Readme

About

sus.js is a neural network modules for nodejs. You can create, run, and train networks. See the example for more information on how to do this.

Limitations

sus.js does not use the GPU at all, making it less efficient than the main ml libararies like tensorflow. I would recommend you use one of those libararies because not only are they more efficient but they have more features. I created this because I was interested in how neural nets worked, not to replace tensorflow.

Example

Here we will create a network that approximates the xor function:

To create a network you will need to specify an array for the structure. The structure for this network is [2, 3, 5, 1]. The number of inputs is the first item in your array and the number of outputs is the last. Each item between represent a hidden layer. In our case we need 2 inputs and 1 output. The amount of hidden layers and neurons in each hidden layer is arbitrary for our network.

const { Network } = require("sus.js");
const struct = [2, 3, 5, 1];
const net = new Network(struct);

We now need to train our network. For the example I will do 500000 iterations. Our data needs to be the input to the xor function. We will just generate to random bits for this. The data that you are entering need to a list with the same length as the amount of inputs you have. The target values need to be a list of the same length as the outputs. The targets should be the correct answer for the neural network. The third paramater for the Train function is the learning rate. This should be a number from 0.001-0.1.

for (let i = 0; i < 500000; i++) {
  let data = [Math.round(Math.random()), Math.round(Math.random())];
  net.Train(data, [data[0]^data[1]], 0.01);
}

We have succsessfully trained our network now. Time to test the results. This step is not needed.

console.log(net.run([0, 0])); // Output should be close to 0
console.log(net.run([0, 1])); // Output should be close to 1
console.log(net.run([1, 0])); // Output should be close to 1
console.log(net.run([1, 1])); // Output should be close to 0

You can run this repl to see how our network preformed. It will take awhile because the network needs to retrain, and the outputs will be different every time you run because the network starts off randomly.