GPT4TSOptions<T>

Options & Configuration · AiDotNet.Models.Options

Configuration options for GPT4TS (One Fits All: Power General Time Series Analysis by Pretrained LM).

Inheritance: ModelOptions → RegressionOptions<T> → TimeSeriesRegressionOptions<T> → GPT4TSOptions<T>

For Beginners

GPT4TS repurposes GPT-2 (a language model) for time series:

How It Works:

  1. Time series are split into patches (like “words”)
  2. Patches are fed through a frozen GPT-2 backbone (no weight updates)
  3. A lightweight task-specific head is trained on top

Key Advantages:

  • Leverages pretrained language model knowledge
  • Only the small task head needs training (fast + low data)
  • Supports multiple tasks: forecasting, classification, anomaly detection

When to Use:

  • When you have limited training data (the frozen backbone provides strong priors)
  • When you need multi-task support from a single model

How It Works

GPT4TS uses a frozen GPT-2 backbone with task-specific heads for time series forecasting, classification, and anomaly detection. It demonstrates that pretrained language models transfer effectively to time series tasks without fine-tuning the backbone.

Reference: Zhou et al., “One Fits All: Power General Time Series Analysis by Pretrained LM”, 2023.

Constructors

Constructor Summary
GPT4TSOptions() Initializes a new instance with default values.
GPT4TSOptions(GPT4TSOptions<T> other) Initializes a new instance by copying from another instance.

Properties

Property Summary
FoundationModelSize ModelSize { get; set; } Gets or sets the model size variant.
TimeSeriesFoundationModelTask Task { get; set; } Gets or sets the downstream task for the model.
bool FreezeBackbone { get; set; } Gets or sets whether to freeze the GPT-2 backbone weights.
double DropoutRate { get; set; } Gets or sets the dropout rate for regularization.
int ContextLength { get; set; } Gets or sets the number of historical time steps used as input context.
int ForecastHorizon { get; set; } Gets or sets the number of future time steps to forecast.
int HiddenDimension { get; set; } Gets or sets the hidden dimension of the GPT-2 backbone.
int NumHeads { get; set; } Gets or sets the number of attention heads.
int NumLayers { get; set; } Gets or sets the number of transformer layers.
int PatchLength { get; set; } Gets or sets the patch length for input tokenization.