preprocessing.Imputer

Imputation transformer for completing missing values.

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

new Imputer(__namedParameters: `object`)

Defined in preprocessing/Imputer.ts:24

Parameters:

ParamTypeDefaultDescription
options.axisnumber0Direction to impute
options.copybooleanfalseTo clone the input value
options.missingValuesanynullTarget missing value to impute
options.strategystring"mean"Missing value replacement strategy

Returns: Imputer

Methods


λ fit

Fit the imputer on X.

Defined in preprocessing/Imputer.ts:52

Parameters:

ParamTypeDefaultDescription
Xany[][]nullInput data in array or sparse matrix format

Returns:

void

λ fit_transform

Fit to data, then transform it.

Defined in preprocessing/Imputer.ts:78

Parameters:

ParamTypeDefaultDescription
Xany[][]nullInput data in array or sparse matrix format

Returns:

any[]