-
Notifications
You must be signed in to change notification settings - Fork 0
Preprocessing onehotencoder
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
One column per category, at sklearn.preprocessing.OneHotEncoder parity.
public sealed class OneHotEncoder<T> where T : IComparable<T>, IEquatable<T>Type parameters — T is the category type; string and int are the two the reference takes.
Properties — FeatureCount and SampleCount are the shape it was fitted on.
EncodedFeatureCount is how many columns Transform produces, which
is fewer than the total number of categories when one is dropped. Categories is each feature's
categories, sorted — the reference's categories_.
Example — a fitted encoder reports what it will produce before it produces it.
using Lodestar.Preprocessing;
OneHotEncoder<string> encoder = Encoders.OneHot(["a", "b", "c", "a"], featureCount: 1);
int rows = encoder.SampleCount; // => 4
int columns = encoder.EncodedFeatureCount; // => 3Remarks — fitted through Encoders.OneHot rather than a static Fit
here: a public static on a generic type is what CA1000 refuses, and the factory infers T.
Applies to — net10.0, netstandard2.0.
See also — OneHotEncoderOptions, OrdinalEncoder.
| Member | What it does |
|---|---|
OneHotEncoder.Transform |
Encodes a matrix as one column per category. |