preprocessing.Imputer
Usage
import { Imputer } from 'preprocessing/Imputer';
const testX = [[1, 2], [null, 3], [7, 6]];
const imp = new Imputer({ missingValues: null, axis: 0 });
imp.fit(testX);
const impResult = imp.fit_transform([[null, 2], [6, null], [7, 6]]);
// [ [ 4, 2 ], [ 6, 3.6666666666666665 ], [ 7, 6 ] ]
Constructors
Methods
Constructors
constructor
⊕ Imputer(__namedParameters: `object`)
Defined in preprocessing/Imputer.ts:33
Parameters:
Param | Type | Default | Description |
---|---|---|---|
options.axis | number | 0 | |
options.copy | boolean | false | |
options.missingValues | any | null | |
options.strategy | string | 'mean' |
Returns: Imputer
Methods
λ fit
Fit the imputer on X.
Defined in preprocessing/Imputer.ts:52
Parameters:
Param | Type | Default | Description |
---|---|---|---|
X | any[][] | null | Input data in array or sparse matrix format |
Returns:
void
λ fit_transform
Fit to data, then transform it.
Defined in preprocessing/Imputer.ts:78
Parameters:
Param | Type | Default | Description |
---|---|---|---|
X | any[][] | null | Input data in array or sparse matrix format |
Returns:
any[]