-
Notifications
You must be signed in to change notification settings - Fork 0
Preprocessing 0.2.0 unknowncategory
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
What OneHotEncoder does with a value the fit never saw.
public enum UnknownCategoryFields — Refuse raises naming the feature, and Ignore encodes the value as all zeros —
handle_unknown="error" and "ignore", with Refuse the default as "error" is.
Example — the same value under both settings.
using Lodestar.Preprocessing;
OneHotEncoder<string> lenient = Encoders.OneHot(
["a", "b"], 1, new OneHotEncoderOptions { Unknown = UnknownCategory.Ignore });
string unknown = string.Join(",", lenient.Transform(["zzz"])); // => 0,0Remarks — refusing is the default because the alternative is silent: an unknown category becomes a row of zeros that a model reads as a category of its own, and no exception marks the point where the data stopped matching the fit.
Applies to — net10.0, netstandard2.0.
See also — OneHotEncoderOptions, OneHotEncoder.Transform.