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

numnormalize

v1.0.1

Published

functions of the normalization of numerical data for the training of neural networks

Downloads

11

Readme

Number normalize

Instalation

$ npm i numnormalize --save

The need for the normalization of data samples is conditioned by the very nature of the variables used in neural network models. Being different in physical sense, they can often differ greatly in absolute values. So, for example, the sample can contain both concentration, measured in tenths or hundredths of percent, and pressure in hundreds of thousands of pascals. Normalization of data allows you to bring all used numerical values ​​of variables to the same area of ​​their change, which makes it possible to bring them together in one neural network model.

In order to normalize the data, you need to know exactly the limits of the changes in the values ​​of the corresponding variables (minimum and maximum theoretically possible values). Then the limits of the normalization interval will correspond to them. When it is impossible to set the limits of variable changes precisely, they are set taking into account the minimum and maximum values ​​in the available data sample.

The most common way to normalize input and output variables is linear normalization.

Example:

const brain = require('brain.js');
const net = new brain.NeuralNetwork();
const { linearNormalize, linearDeNormalize, getMaxMin } = require('../index');

const inputData = [
    [ 0,     1,     2,        3,     4],
    [34,    45,    23,       43,   -54],
    [ 3,  0.23,  0.25, -0.92324,   0.1],
    [ 2,  0.23, -0.25,  0.92324,   0.1],
    [ 1, -0.12,  2.32,    54.24, 123.1]
];

const outputData = [[
    102,
     35,
     56,
     43,
     84
]];

const maxminInput = getMaxMin(inputData);
const maxminOutput = getMaxMin(outputData);

const normInput = linearNormalize({ data: inputData, maxmin: maxminInput });
const normOutput = linearNormalize({ data: outputData, maxmin: maxminOutput });

const trainData = normInput.map((row, i) => ({
    input: row,
    output: normOutput[0]
}));

console.log('trainData');
console.log(trainData);
net.train(trainData);

const data = linearNormalize({ data: [ [36, 23, 10, 53, 4] ], maxmin: maxminInput });

console.log('Search for solutions for');
console.log(data);

let answer = net.run(data[0]);

console.log('ANSWER norm:');
console.log(answer);

answer = linearDeNormalize({ data: [answer], maxmin: maxminOutput });

console.log('ANSWER de norm:');
console.log(answer);

One way of non-linear normalization is using a sigmoid logistic function or a hyperbolic tangent.

Example:

const { nonLinearNormalize, nonLinearDeNormalize, getMaxMin } = require('numnormolize');

Links