Preprocessing 0.2.0 labelencoder inversetransform - CyrilB1531/lodestar GitHub Wiki

Lodestar.Preprocessing 0.2.0. This page is frozen at that release. Read the current documentation for what main says now. A link to a decision or a migration page follows main, and leaves the archive.

Home › Encoding and imputation

LabelEncoder.InverseTransform

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,lyon

Remarks — 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.

⚠️ **GitHub.com Fallback** ⚠️