Class PreprocessingRegistry<T, TInput>
- Namespace
- AiDotNet.Preprocessing
- Assembly
- AiDotNet.dll
Global registry for the preprocessing pipeline.
public static class PreprocessingRegistry<T, TInput>
Type Parameters
TThe numeric type for calculations (e.g., float, double).
TInputThe input data type.
- Inheritance
-
PreprocessingRegistry<T, TInput>
- Inherited Members
Remarks
PreprocessingRegistry provides a singleton pattern for managing the active preprocessing pipeline. By default, a standard pipeline with imputation and scaling is used. Users can configure custom preprocessing via AiModelBuilder.ConfigurePreprocessing().
For Beginners: This is like a global settings panel for data preprocessing. You don't need to interact with this directly - just use AiModelBuilder:
var result = new AiModelBuilder<double, Matrix<double>, Vector<double>>()
.ConfigurePreprocessing(pipeline => pipeline
.Add(new SimpleImputer<double>(ImputationStrategy.Mean))
.Add(new StandardScaler<double>()))
.ConfigureModel(new LogisticRegression<double>())
.Build(X, y);
The configured preprocessing is automatically applied to all models.
Properties
Current
Gets or sets the current preprocessing pipeline.
public static IDataTransformer<T, TInput, TInput>? Current { get; set; }
Property Value
- IDataTransformer<T, TInput, TInput>
Remarks
This is set automatically when you call AiModelBuilder.ConfigurePreprocessing(). The pipeline is global and thread-safe.
For Beginners: You typically don't set this directly. Use AiModelBuilder.ConfigurePreprocessing() instead.
IsConfigured
Gets whether a preprocessing pipeline is currently configured.
public static bool IsConfigured { get; }
Property Value
Methods
Clear()
Clears the current preprocessing pipeline.
public static void Clear()
Remarks
This resets the preprocessing to no-op (pass-through) behavior.
FitTransform(TInput)
Fits the current preprocessing pipeline to data and transforms it.
public static TInput FitTransform(TInput input)
Parameters
inputTInputThe data to fit and transform.
Returns
- TInput
The preprocessed data, or the original input if no pipeline is configured.
Transform(TInput)
Transforms input data using the current preprocessing pipeline.
public static TInput Transform(TInput input)
Parameters
inputTInputThe input data to preprocess.
Returns
- TInput
The preprocessed data, or the original input if no pipeline is configured.
Remarks
If no preprocessing pipeline has been configured, this method returns the input unchanged. This allows models to safely call this method without checking if preprocessing is configured.