🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

array-normalize

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
a

array-normalize

Normalize array (possibly n-dimensional) to zero mean and unit variance

2.0.0
latest
100

Supply Chain Security

100

Vulnerability

73

Quality

79

Maintenance

100

License

Version published
Weekly downloads
221K
8.54%
Maintainers
2
Weekly downloads
 
Created
Issues
0

array-normalize experimental Build Status

Normalize array to unit length, that is 0..1 range. See feature scaling.

npm install array-normalize

const normalize = require('array-normalize')

normalize([0, 50, 100]) // [0, .5, 1]
normalize([0, 0, .1, .2, 1, 2], 2) // [0, 0, .1, .1, 1, 1]
normalize([0, .25, 1, .25], 2, [0, .5, 1, .5]) // [0, .5, 1, .5])

API

array = normalize(array, stride=1, bounds?)

Normalizes n-dimensional array in-place using optional stride for n-dimensions, ie. for 2d data layout is [x, y, x, y, ...].

Every dimension is normalized independently, eg. 2d array is normalized to unit square [0, 0, 1, 1].

Optional bounds box can predefine min/max to skip bounds detection.

FAQs

Package last updated on 22 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts