HelmertEncoder<T>

Models & Types · AiDotNet.Preprocessing.Encoders

Encodes categorical features using Helmert coding.

Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → HelmertEncoder<T>

For Beginners

Helmert coding is useful when order matters:

  • Compares each level to the “future average”
  • First level vs. average of all others
  • Second level vs. average of third, fourth, etc.
  • Good for detecting trends or cumulative effects

How It Works

HelmertEncoder compares each level of a categorical variable to the mean of all subsequent levels. This is useful when you want to understand how each level differs from the average of all levels that come after it.

For k categories, creates k-1 columns. Column i compares level i to the mean of levels i+1 through k.

Constructors

Constructor Summary
HelmertEncoder(HelmertHandleUnknown handleUnknown, bool reversed, int[] columnIndices) Creates a new instance of HelmertEncoder.

Properties

Property Summary
HelmertHandleUnknown HandleUnknown { get; } Gets how unknown categories are handled.
bool Reversed { get; } Gets whether reversed Helmert coding is used.
bool SupportsInverseTransform { get; } Gets whether this transformer supports inverse transformation.
int NOutputFeatures { get; } Gets the number of output features.

Methods

Method Summary
string[] GetFeatureNamesOut(string[] inputFeatureNames) Gets the output feature names after transformation.