Preprocessing simpleimputer - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Preprocessing is 0.1.0 — read its documentation.

HomePreprocessingEncoding and imputation

SimpleImputer

Fills the missing values of each feature with a statistic of the ones present, at sklearn.impute.SimpleImputer parity.

public sealed class SimpleImputer

PropertiesFeatureCount and SampleCount are the shape it was fitted on, and Statistics is what each feature's missing values are filled with — the reference's statistics_.

Example — the mean of what is present, per feature.

using Lodestar.Preprocessing;

// Two features; each is missing one value.
double[] samples = [1.0, 10.0, 2.0, double.NaN, double.NaN, 30.0];

SimpleImputer imputer = SimpleImputer.Fit(samples, featureCount: 2);

double first = imputer.Statistics[0];   // => 1.5
double second = imputer.Statistics[1];  // => 20

RemarksNaN is what marks a value missing, as it does in the reference: there is no separate mask, and a matrix with no NaN comes back unchanged. An infinity is refused — it marks nothing and would carry into every statistic.

Applies to — net10.0, netstandard2.0.

See alsoSimpleImputerOptions, ImputationStrategy.

Members

Member What it does
SimpleImputer.Fit Fits an imputer on a row-major sample matrix.
SimpleImputer.Transform Fills the missing values of a matrix.