BackwardDifferenceEncoder<T>
Models & Types · AiDotNet.Preprocessing.Encoders
Encodes categorical features using backward difference coding.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → BackwardDifferenceEncoder<T>
For Beginners
Backward difference coding is useful for ordinal data:
- Education: High School vs Some College vs Bachelor’s vs Master’s
- Each coefficient shows the “step up” from the previous level
- Good when you expect gradual progression through levels
How It Works
BackwardDifferenceEncoder compares each level of a categorical variable to the previous level. This is useful for ordinal variables where the difference between adjacent levels is meaningful.
For k categories, creates k-1 columns. Each column represents the difference between level n and level n-1.
Constructors
| Constructor | Summary |
|---|---|
BackwardDifferenceEncoder(BackwardDifferenceHandleUnknown handleUnknown, int[] columnIndices) |
Creates a new instance of BackwardDifferenceEncoder. |
Properties
| Property | Summary |
|---|---|
BackwardDifferenceHandleUnknown HandleUnknown { get; } |
Gets how unknown categories are handled. |
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. |