-
Notifications
You must be signed in to change notification settings - Fork 0
Preprocessing 0.2.0 simpleimputer transform
Lodestar.Preprocessing 0.2.0. This page is frozen at that release. Read the current documentation for what
mainsays now. A link to a decision or a migration page followsmain, and leaves the archive.
Home › 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.