Skip to content

Preprocessing 0.2.0 simpleimputer

github-actions[bot] edited this page Sep 24, 2026 · 1 revision

Lodestar.Preprocessing 0.2.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

Home › Encoding 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

Properties — FeatureCount 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

Remarks — NaN 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 also — SimpleImputerOptions, 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.

Clone this wiki locally