TimeBridge<T>
Models & Types · AiDotNet.Finance.Forecasting.Foundation
TimeBridge — Non-Stationarity Matters for Time Series Foundation Models.
Inheritance: NeuralNetworkBase<T> → FinancialModelBase<T> → ForecastingModelBase<T> → TimeSeriesFoundationModelBase<T> → TimeBridge<T>
For Beginners
Most forecasting models normalize data (remove trends and scale to a standard range) before processing, which can lose important information about long-term trends and sudden shifts. TimeBridge solves this by “bridging” the gap: it saves the non-stationary information that normalization removes and adds it back to the predictions, giving you forecasts that correctly capture upward trends, seasonal shifts, and level changes.
How It Works
TimeBridge addresses the critical non-stationarity gap in time series foundation models. It introduces a bridge mechanism that preserves and restores non-stationary information (trends, level shifts) that is typically lost during standard normalization.
Reference: “TimeBridge: Non-Stationarity Matters for Long-term Time Series Forecasting”, 2024.
Example
// Create a TimeBridge model addressing non-stationarity in foundation models
// Preserves and restores trend/level shift information lost during normalization
var architecture = new NeuralNetworkArchitecture<double>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.Regression,
inputHeight: 512, inputWidth: 1, inputDepth: 1, outputSize: 24);
// Training mode with bridge mechanism for non-stationary information
var model = new TimeBridge<double>(architecture);
// ONNX inference mode with pre-trained model
var onnxModel = new TimeBridge<double>(architecture, "timebridge.onnx");
Constructors
| Constructor | Summary |
|---|---|
TimeBridge(NeuralNetworkArchitecture<T> architecture, TimeBridgeOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Creates a TimeBridge model in native mode for training or fine-tuning. |
TimeBridge(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, TimeBridgeOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Creates a TimeBridge model using a pretrained ONNX model. |
Properties
| Property | Summary |
|---|---|
FoundationModelSize ModelSize { get; } |
|
bool IsChannelIndependent { get; } |
|
bool SupportsTraining { get; } |
|
bool UseNativeMode { get; } |
|
int MaxContextLength { get; } |
|
int MaxPredictionHorizon { get; } |
|
int NumFeatures { get; } |
|
int PatchSize { get; } |
|
int PredictionHorizon { get; } |
|
int SequenceLength { get; } |
|
int Stride { get; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T> Evaluate(Tensor<T> predictions, Tensor<T> actuals) |
|
Dictionary<string, T> GetFinancialMetrics() |
|
Dictionary<string, Tensor<T>> GetNamedLayerActivations(Tensor<T> input) |
|
ModelMetadata<T> GetModelMetadata() |
|
Tensor<T> ApplyInstanceNormalization(Tensor<T> input) |
|
Tensor<T> AutoregressiveForecast(Tensor<T> input, int steps) |