preprocessing.normalize
▸ normalize(X: `object`, norm: `object`)
Usage
import { normalize } from 'machinelearn/preprocessing';
const result = normalize([
[1, -1, 2],
[2, 0, 0],
[0, 1, -1],
], { norm: 'l2' });
console.log(result);
// [ [ 0.4082482904638631, -0.4082482904638631, 0.8164965809277261 ],
// [ 1, 0, 0 ],
// [ 0, 0.7071067811865475, -0.7071067811865475 ] ]
Defined in preprocessing/data.ts:700
Parameters:
Param | Type | Default | Description |
---|---|---|---|
X | number[][] | null | The data to normalize |
options.norm | string | 'l2' |
Returns:
number[][]