ColumnTransformer<T>
Models & Types ยท AiDotNet.Preprocessing
Applies different transformers to different columns of the input.
Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> โ ColumnTransformer<T>
For Beginners
Different columns often need different treatment:
- Numeric columns: scaling, normalization
- Categorical columns: one-hot encoding
- Text columns: vectorization
ColumnTransformer lets you apply the right transformation to each column type.
How It Works
ColumnTransformer allows you to specify which transformer should be applied to which columns. This is useful when different columns require different preprocessing (e.g., scaling numeric columns, encoding categorical columns).
Output columns are concatenated in the order transformers are added. Columns not specified in any transformer can be passed through or dropped.
Constructors
| Constructor | Summary |
|---|---|
ColumnTransformer(ColumnTransformerRemainder remainder) |
Creates a new instance of ColumnTransformer. |
Properties
| Property | Summary |
|---|---|
ColumnTransformerRemainder Remainder { get; } |
Gets how columns not specified in any transformer are handled. |
bool SupportsInverseTransform { get; } |
Gets whether this transformer supports inverse transformation. |
Methods
| Method | Summary |
|---|---|
ColumnTransformer<T> Add(IDataTransformer<T, Matrix<T>, Matrix<T>> transformer, int[] columns) |
Adds a transformer to be applied to specific columns. |
ColumnTransformer<T> Add(string name, IDataTransformer<T, Matrix<T>, Matrix<T>> transformer, int[] columns) |
Adds a transformer to be applied to specific columns. |
IDataTransformer<T, Matrix<T>, Matrix<T>> GetTransformer(string name) |
Gets the transformer with the specified name. |
string[] GetFeatureNamesOut(string[] inputFeatureNames) |
Gets the output feature names after transformation. |
string[] GetTransformerNames() |
Gets all transformer names. |