Categorical Encoding Class
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
[SerializableAttribute]
public abstract class CategoricalEncoding
- Inheritance
- Object → CategoricalEncoding
Remarks
Use the CategoricalEncoding class to specify how a categorical variable should be encoded as indicator variables. An encoding is a set of mappings from categories to real numbers. The mappings are returned as Index<T> objects.
Encodings can have two forms: full rank and reduced rank. A full rank encoding means that, when the encoding is applied to each category, the resulting matrix has full rank. Reduced rank encoding means that the resulting matrix does not have full rank. This is useful when specifying models that include a constant term. In such cases, the full rank encoding and the constant term are linearly dependent.
To create an encoding, use one of the static methods of the CategoricalEncoding class. You can then use the GetFullRankEncoding(Int32) or GetReducedRankEncoding(Int32) to get the encoding. Alternatively, you can inherit from CategoricalEncoding
The creation of indicator variables is mostly transparent. To create an indicator variable, use the index with the WithCategories<U>(IList<U>) method.
Constructors
Categorical | Constructs a new encoding object. |
Methods
Backward | Returns an encoding where every level is compared to the prior level. |
Backward | Returns an encoding where every level is compared to the prior level. |
Deviation | Returns an encoding where every level except the reference level is encoded using one of three values: 1 if the value equals the level, -1 if the value equals the reference level, and 0 otherwise. |
Dummy | Also called one hot encoding. Every level except the reference level is encoded using a binary variable. |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
Forward | Returns an encoding where every level is compared to the next level. |
Forward | Returns an encoding where every level is compared to the next level. |
Get | Returns a matrix whose columns contain the contrasts for the encoding. |
Get | Returns the encoding with full rank of the specified position |
Get | Returns the encoding with full rank of the specified position |
Get | Returns the encoding with full rank of the specified position |
Get | Serves as the default hash function. (Inherited from Object) |
Get | Returns a string representation for the specified level. |
Get | Returns the encoding with reduced rank of the specified position |
Get | Returns the encoding with reduced rank of the specified position |
Get | Returns the encoding with reduced rank of the specified position |
Get | Gets the Type of the current instance. (Inherited from Object) |
Helmert( | Returns an encoding where every level is compared to all the next levels. |
Helmert( | Returns an encoding where every level is compared to all the next levels. |
Memberwise | Creates a shallow copy of the current Object. (Inherited from Object) |
Orthogonal | Returns an encoding where levels are encoded to reflect trends in the levels. This encoding only makes sense for evenly spaced ordinal factors. |
Reverse | Returns an encoding where every level is compared to all the next levels. |
Reverse | Returns an encoding where every level is compared to all the next levels. |
Simple | Returns an encoding where every level is compared to the reference level. |
ToString | Returns a string that represents the current object. (Inherited from Object) |