preprocessing.Binarizer
Usage
import { Binarizer } from 'machinelearn/preprocessing';
const binX = [[1, -1, 2], [2, 0, 0], [0, 1, -1]];
const binarizer = new Binarizer({ threshold: 0 });
const result = binarizer.transform(binX);
// [ [ 1, 0, 1 ], [ 1, 0, 0 ], [ 0, 1, 0 ] ]
Constructors
Methods
Constructors
constructor
⊕ Binarizer(__namedParameters: `object`)
Defined in preprocessing/data.ts:520
Parameters:
Param | Type | Default | Description |
---|---|---|---|
options.copy | boolean | true | |
options.threshold | number | 0 |
Returns: Binarizer
Methods
λ fit
Currently fit does nothing
Defined in preprocessing/data.ts:543
Parameters:
Param | Type | Default | Description |
---|---|---|---|
X | number[][] | null | Does nothing |
Returns:
void
λ transform
Transforms matrix into binarized form X = [[ 1., -1., 2.], [ 2., 0., 0.], [ 0., 1., -1.]] becomes array([[ 1., 0., 1.], [ 1., 0., 0.], [ 0., 1., 0.]])
Defined in preprocessing/data.ts:562
Parameters:
Param | Type | Default | Description |
---|---|---|---|
X | number[][] | null | The data to binarize. |
Returns:
any[]