-
Notifications
You must be signed in to change notification settings - Fork 0
Preprocessing labelencoder inversetransform
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
Reads codes back as labels.
public T[] InverseTransform(ReadOnlySpan<int> codes)Parameters — codes are indices into Classes.
Returns — one label per code.
Exceptions — ArgumentOutOfRangeException when a code is negative or past the last class.
Example — a classifier's predictions, read back as what they name.
using Lodestar.Preprocessing;
string[] cities = ["paris", "lyon", "paris", "nice"];
LabelEncoder<string> encoder = Encoders.Label<string>(cities);
string predicted = string.Join(",", encoder.InverseTransform([2, 0])); // => paris,lyonRemarks — this is the round trip the transformers in this package cannot offer, and the reason the encoder is worth holding onto after fitting: nothing was approximated on the way in, so the codes and the labels are the same information under two spellings. A model that reports class 2 is reporting Paris, and this is what says so.
Applies to — net10.0, netstandard2.0.
See also — LabelEncoder.Transform,
LabelEncoder.