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

fwd-ann

v2.0.1

Published

Feedforward Artificial Neural Network Library

Downloads

4

Readme

About

fwd-ann is a Feedforward Artificial Neural Network Library developed with TypeScript. This project was started as experiment to explore TypeScript abilities to be used in data processing tasks. You can use this library for experimental data processing on Node.js server or in a browser. Very early version of this library was successfully used in AMAKids company as core for building browser games results analyzer platform.

Installation

npm i --save fwd-ann

Examples

Go to the src/examples to explore examples. To run example run ts-node <example-name> your console. Better way to understand how this library works is to explore these examples. Another good way to understand this library — explore src library and create small projects. Feel free to create anything you want using this library!

Below you can find short introduction to the API. It will help you to get started with fwd-ann.

API

LayerType

This enum represents possible types of ANN's layers. There are three possible types:

  • INPUT
  • HIDDEN
  • OUTPUT

These types are used to create ANN's instance with aim architecture.

activationFuncs

Activation function determines how signals will be modified in neurons. There are lots of available activation functions:

  • Logistic
  • UnitLinear
  • BinaryStep
  • Areasinus
  • ...and so on

Signals

Signals class represents numbers vector that can be used as input for ANN (Artificial Neural Network). To create Signals you simply should pass numbers array to the Signals.create static method:

import { Signals } from 'fwd-ann';

const signals = new Signals([1, 0, 0, 1]);

You can also create Signals by passing Matrix to Signal's class constructor. Matrix is a special class that you can import from matrix-calculus library.

import { Signals } from 'fwd-ann';
import { SingleColMatrixFactory } from 'matrix-calculus/factories';

const signalsMatrix = SingleColMatrixFactory.create([1, 0, 0, 1]);
const signals = new Signals(signalsMatrix);

You can pass second (optional) parameter to the Signals.create or Signals's constructor that represents names for every passed signal. In some cases it is useful to have signals' names.

ANN, createANN

To create ANN object you can use ANN class or createANN utility. Prefer second one. ANN instance represents Artificial Neural Network that can be taught by Teacher and used to process some input Signals and respond with some output Signals.

import createANN, { LayerType, activationFuncs } from 'fwd-ann';

const { ReLU } = activationFuncs;

const ann = createANN(
    {
        id: 'ExampleANN',
        layersData: [
            {
                type: LayerType.INPUT,
                unitsData: [{
                    qty: 6,
                    ActivationFunction: ReLU,
                }],
            },
            {
                type: LayerType.HIDDEN,
                unitsData: [{
                    qty: 7,
                    ActivationFunction: ReLU,
                }],
            },
            {
                type: LayerType.OUTPUT,
                unitsData: [{
                    qty: 1,
                    ActivationFunction: ReLU,
                }],
            },
        ],
    },
    {
        learningSpeed: .01,
    },
);

First parameter represents data of the Neural Network. Second parameter (optional) represents parameters such as learningSpeed.

Teacher

The Teacher is that core thing that teaches your Neural Network to perform some actions you need. Teacher's API is vary simple and allows you concentrate on data and behavior but not on the teaching process implementation.

import createANN, { Teacher } from 'fwd-ann';

const ann = createANN({
    id: 'ExampleANN',
    layersData: [/*...*/],
});

Teacher.teach({
    ann,
    sets: [/*...*/],
}).then(({ ann, log }) => {/*...*/});

Do notice! Teacher mutates your ann instance.

GitHub repository

https://github.com/balovbohdan/fwd-ann

Contributing

Pull requests are welcome. You can use this code freely for your own projects and/or experiments. If you have some questions or proposals feel free to message me.

License

MIT