Preprocessing simpleimputer transform - 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.
Home › Preprocessing › Encoding and imputation
Fills the missing values of a row-major sample matrix.
public double[] Transform(ReadOnlySpan<double> samples)Parameters — samples is the matrix to fill, row-major, with FeatureCount values per row.
Returns — a new array of the same length, with every NaN replaced.
Exceptions — ArgumentException when samples holds no row, a partial one, or an infinity.
Example — the statistic is the fit's, not the transform's.
using Lodestar.Preprocessing;
double[] fitted = [1.0, 2.0, 3.0];
SimpleImputer imputer = SimpleImputer.Fit(fitted, featureCount: 1);
// The mean of 1, 2 and 3 — the row being filled has no say in it.
string filled = string.Join(",", imputer.Transform([double.NaN, 99.0])); // => 2,99Remarks — the width never changes, which is the divergence
Fit explains: the reference's default returns one column fewer when a
feature was empty at fit time.
Never writes to the input.
Applies to — net10.0, netstandard2.0.
See also — SimpleImputer, SimpleImputerOptions.