Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
array-normalize
Advanced tools
Normalize array (possibly n-dimensional) to zero mean and unit variance
Normalize array to unit length, that is 0..1 range. See feature scaling.
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])
Normalizes n-dimensional array in-place using dimensions
as stride, ie. for 1d array the expected data layout is [x, x, x, ...]
for 2d is [x, y, x, y, ...]
, etc.
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 optimize calculations.
FAQs
Normalize array (possibly n-dimensional) to zero mean and unit variance
The npm package array-normalize receives a total of 146,590 weekly downloads. As such, array-normalize popularity was classified as popular.
We found that array-normalize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.