TimeSeriesTransformerPipeline<T>
Models & Types · AiDotNet.Preprocessing.TimeSeries
A pipeline that chains multiple time series transformers together.
Implements: ITimeSeriesFeatureExtractor<T>
For Beginners
Think of this like an assembly line in a factory:
Raw Material -> [Machine 1] -> [Machine 2] -> [Machine 3] -> Final Product
Similarly, your data flows through each transformer in order:
Raw Data -> [Lag Features] -> [Rolling Stats] -> [Technical Indicators] -> Enhanced Features
This makes it easy to build complex feature engineering workflows by combining simple, focused transformers.
How It Works
This class allows you to compose multiple transformers into a single pipeline, applying them in sequence. Each transformer’s output becomes the next transformer’s input.
Example
var data = Tensor<double>.CreateRandom(2, 4);
// One window configuration, shared by every transformer in the pipeline.
var featureOptions = new TimeSeriesFeatureOptions { WindowSizes = [7, 30] };
var lagTransformer = new LagLeadTransformer<double>(featureOptions);
var statsTransformer = new RollingStatsTransformer<double>(featureOptions);
var indicatorTransformer = new TechnicalIndicatorsTransformer<double>(featureOptions);
// Build a pipeline
var pipeline = new TimeSeriesTransformerPipeline<double>()
.AddTransformer(lagTransformer)
.AddTransformer(statsTransformer)
.AddTransformer(indicatorTransformer);
// Fit and transform
var enrichedData = pipeline.FitTransform(data);
Constructors
| Constructor | Summary |
|---|---|
TimeSeriesTransformerPipeline() |
Creates a new pipeline with default settings. |
TimeSeriesTransformerPipeline(bool includeOriginalFeatures, PipelineMode pipelineMode) |
Creates a new pipeline with the specified settings. |
Properties
| Property | Summary |
|---|---|
ITimeSeriesFeatureExtractor<T> Item { get; } |
|
bool AutoDetectEnabled { get; } |
|
bool IsFitted { get; set; } |
|
bool SupportsIncrementalTransform { get; } |
|
bool SupportsInverseTransform { get; } |
|
int InputFeatureCount { get; } |
|
int OutputFeatureCount { get; } |
|
int TransformerCount { get; } |
Gets the number of transformers in the pipeline. |
int[] ColumnIndices { get; } |
|
int[] WindowSizes { get; } |
|
string[] FeatureNames { get; } |
Methods
| Method | Summary |
|---|---|
IncrementalState<T> GetIncrementalState() |
|
List<string> GetValidationErrors(Tensor<T> data) |
|
T[] TransformIncremental(T[] newDataPoint) |
|
Tensor<T> FitTransform(Tensor<T> data) |
|
Tensor<T> InverseTransform(Tensor<T> data) |
|
Tensor<T> Transform(Tensor<T> data) |
|
TimeSeriesTransformerPipeline<T> AddTransformer(ITimeSeriesFeatureExtractor<T> transformer) |
Adds a transformer to the end of the pipeline. |
TimeSeriesTransformerPipeline<T> AddTransformers(IEnumerable<ITimeSeriesFeatureExtractor<T>> transformers) |
Adds multiple transformers to the pipeline. |
TimeSeriesTransformerPipeline<T> AddTransformers(ITimeSeriesFeatureExtractor<T>[] transformers) |
Adds multiple transformers to the pipeline. |
TimeSeriesTransformerPipeline<T> Clone() |
Creates a deep copy of this pipeline (transformers are not copied, only the pipeline structure). |
bool ValidateInput(Tensor<T> data) |
|
int[] DetectOptimalWindowSizes(Tensor<T> data) |
|
string GetSummary() |
Gets a summary of the pipeline configuration. |
string[] GetFeatureNamesOut(string[] inputFeatureNames) |
|
void Fit(Tensor<T> data) |
|
void InitializeIncremental(Tensor<T> historicalData) |
|
void SetIncrementalState(IncrementalState<T> state) |