Class PreprocessingInfo<T, TInput, TOutput>
- Namespace
- AiDotNet.Preprocessing
- Assembly
- AiDotNet.dll
Stores the fitted preprocessing pipeline for inference.
public class PreprocessingInfo<T, TInput, TOutput>
Type Parameters
TThe numeric type used for calculations.
TInputThe input data type (typically Matrix<T>).
TOutputThe output data type (typically Vector<T>).
- Inheritance
-
PreprocessingInfo<T, TInput, TOutput>
- Inherited Members
Remarks
This class encapsulates the preprocessing state needed to transform new data during inference. It stores the fitted feature pipeline and optionally a target pipeline for inverse transformation of predictions.
For Beginners: After training, your preprocessing pipeline has "learned" things like the mean and standard deviation for scaling. This class stores all that learned information so you can apply the same transformations to new data during predictions.
Constructors
PreprocessingInfo()
Creates a new instance of PreprocessingInfo<T, TInput, TOutput>.
public PreprocessingInfo()
PreprocessingInfo(PreprocessingPipeline<T, TInput, TInput>)
Creates a new instance with the specified fitted pipeline.
public PreprocessingInfo(PreprocessingPipeline<T, TInput, TInput> pipeline)
Parameters
pipelinePreprocessingPipeline<T, TInput, TInput>The fitted feature preprocessing pipeline.
PreprocessingInfo(PreprocessingPipeline<T, TInput, TInput>, PreprocessingPipeline<T, TOutput, TOutput>?)
Creates a new instance with both feature and target pipelines.
public PreprocessingInfo(PreprocessingPipeline<T, TInput, TInput> pipeline, PreprocessingPipeline<T, TOutput, TOutput>? targetPipeline)
Parameters
pipelinePreprocessingPipeline<T, TInput, TInput>The fitted feature preprocessing pipeline.
targetPipelinePreprocessingPipeline<T, TOutput, TOutput>The fitted target preprocessing pipeline.
Properties
IsFitted
Gets whether the feature pipeline has been fitted to data.
public bool IsFitted { get; }
Property Value
IsTargetFitted
Gets whether the target pipeline has been fitted to data.
public bool IsTargetFitted { get; }
Property Value
Pipeline
Gets or sets the fitted feature preprocessing pipeline.
public PreprocessingPipeline<T, TInput, TInput>? Pipeline { get; set; }
Property Value
- PreprocessingPipeline<T, TInput, TInput>
Remarks
This pipeline transforms input features (X) before they are passed to the model. It must be fitted before use during inference.
For Beginners: This is the pipeline that transforms your input data (like scaling, encoding, and imputation) before making predictions.
TargetPipeline
Gets or sets the fitted target preprocessing pipeline.
public PreprocessingPipeline<T, TOutput, TOutput>? TargetPipeline { get; set; }
Property Value
- PreprocessingPipeline<T, TOutput, TOutput>
Remarks
This optional pipeline transforms targets (y) during training and can perform inverse transformation on predictions during inference.
For Beginners: If you scaled your target values during training (like log-transforming prices), this pipeline knows how to "unscale" the predictions back to the original range.
Methods
InverseTransformPredictions(TOutput)
Inverse transforms predictions using the target pipeline.
public TOutput InverseTransformPredictions(TOutput predictions)
Parameters
predictionsTOutputThe predictions to inverse transform.
Returns
- TOutput
The inverse transformed predictions in original scale.
Exceptions
- InvalidOperationException
Thrown if the target pipeline is not configured or doesn't support inverse transform.
TransformFeatures(TInput)
Transforms input features using the fitted pipeline.
public TInput TransformFeatures(TInput input)
Parameters
inputTInputThe input features to transform.
Returns
- TInput
The transformed features.
Exceptions
- InvalidOperationException
Thrown if the pipeline is not fitted.