TargetStandardScaler<T, TOutput>

Models & Types · AiDotNet.Preprocessing

Standard (z-score) scaling for regression TARGETS — the IDataTransformer that AiModelBuilder.ConfigureTargetScaling() installs into the (previously always-null) TargetPipeline.

Implements: IDataTransformer<T, TOutput, TOutput>

How It Works

Why: the facade has always scaled FEATURES (ConfigurePreprocessing) but never the target — raw targets on wide scales (prices, dollar P&L) make gradient training diverge, so every consumer hand-rolled a target scaler plus the inverse transform on the way out. The carrier (PreprocessingInfo.TargetPipeline + InverseTransformPredictions) existed but nothing ever populated or invoked it; this transformer + the builder/predict wiring completes the feature.

Shapes: targets are adapted to a column matrix for the underlying StandardScaler — Vector<T> ↔ Matrix[n,1]; Tensor<T> rank-1 ↔ Matrix[n,1]; Tensor<T> rank-2 [n,k] ↔ Matrix[n,k] (each output column scaled independently). Other output types are rejected at construction.

Constructors

Constructor Summary
TargetStandardScaler(StandardScaler<T> scaler)

Properties

Property Summary
bool IsFitted { get; set; }
bool SupportsInverseTransform { get; }
int[] ColumnIndices { get; }

Methods

Method Summary
TOutput FitTransform(TOutput data)
TOutput InverseTransform(TOutput data)
TOutput Transform(TOutput data)
string[] GetFeatureNamesOut(string[] inputFeatures)
void Fit(TOutput data)