Sundial<T>
Models & Types · AiDotNet.Finance.Forecasting.Foundation
Sundial — A Family of Highly Capable Time Series Foundation Models.
Inheritance: NeuralNetworkBase<T> → FinancialModelBase<T> → ForecastingModelBase<T> → TimeSeriesFoundationModelBase<T> → Sundial<T>
For Beginners
Sundial is a time series forecasting model that works like GPT but for numbers instead of words. It groups data into patches (chunks) and predicts future patches one at a time. Despite using fewer parameters than competing models, it achieves better accuracy, making it a practical choice when you need strong forecasting performance without enormous computational resources.
How It Works
Sundial is a decoder-only time series foundation model that outperforms Time-MoE with fewer parameters (4.71% average MSE reduction). It uses a GPT-style autoregressive architecture with patch-based tokenization and quantile forecasting.
Reference: “Sundial: A Family of Highly Capable Time Series Foundation Models”, 2025.
https://arxiv.org/abs/2502.00816
Example
// Create a Sundial GPT-style foundation model for time series forecasting
// Decoder-only architecture with patch tokenization and quantile forecasting
var architecture = new NeuralNetworkArchitecture<double>(
inputType: InputType.OneDimensional,
taskType: NeuralNetworkTaskType.Regression,
inputHeight: 512, inputWidth: 1, inputDepth: 1, outputSize: 24);
// Training mode with autoregressive patch prediction
var model = new Sundial<double>(architecture);
// ONNX inference mode with pre-trained model
var onnxModel = new Sundial<double>(architecture, "sundial.onnx");
Constructors
| Constructor | Summary |
|---|---|
Sundial(NeuralNetworkArchitecture<T> architecture, SundialOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Creates a Sundial model in native mode for training or fine-tuning. |
Sundial(NeuralNetworkArchitecture<T> architecture, string onnxModelPath, SundialOptions<T> options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Creates a Sundial 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() |
|
ModelMetadata<T> GetModelMetadata() |
|
Tensor<T> ApplyInstanceNormalization(Tensor<T> input) |
|
Tensor<T> AutoregressiveForecast(Tensor<T> input, int steps) |