Class TemporalFusionTransformerOptions<T>
Configuration options for the Temporal Fusion Transformer (TFT) model.
public class TemporalFusionTransformerOptions<T> : TimeSeriesRegressionOptions<T>
Type Parameters
TThe numeric type used for calculations (typically double or float).
- Inheritance
-
TemporalFusionTransformerOptions<T>
- Inherited Members
Remarks
Temporal Fusion Transformer is a state-of-the-art deep learning architecture for multi-horizon forecasting. It combines high-performance multi-horizon forecasting with interpretable insights into temporal dynamics. TFT uses self-attention mechanisms to learn temporal relationships at different scales and integrates static metadata, time-varying known inputs, and time-varying unknown inputs.
For Beginners: TFT is an advanced neural network designed specifically for forecasting that can handle multiple types of input data: - Static features (e.g., store location, product category) that don't change over time - Known future inputs (e.g., holidays, promotions) that we know ahead of time - Unknown inputs (e.g., past sales) that we can only observe historically
The model uses "attention" mechanisms to focus on the most relevant time periods and features, making it both accurate and interpretable.
Constructors
TemporalFusionTransformerOptions()
Initializes a new instance of the TemporalFusionTransformerOptions<T> class.
public TemporalFusionTransformerOptions()
TemporalFusionTransformerOptions(TemporalFusionTransformerOptions<T>)
Initializes a new instance by copying from another instance.
public TemporalFusionTransformerOptions(TemporalFusionTransformerOptions<T> other)
Parameters
otherTemporalFusionTransformerOptions<T>
Properties
BatchSize
Gets or sets the batch size for training.
public int BatchSize { get; set; }
Property Value
- int
The batch size, defaulting to 32.
DropoutRate
Gets or sets the dropout rate for regularization.
public double DropoutRate { get; set; }
Property Value
- double
The dropout rate, defaulting to 0.1.
Remarks
For Beginners: Dropout randomly ignores some neurons during training to prevent overfitting. A value of 0.1 means 10% of neurons are ignored in each training step.
Epochs
Gets or sets the number of training epochs.
public int Epochs { get; set; }
Property Value
- int
The number of epochs, defaulting to 100.
ForecastHorizon
Gets or sets the forecast horizon (number of future time steps to predict).
public int ForecastHorizon { get; set; }
Property Value
- int
The forecast horizon, defaulting to 6.
HiddenSize
Gets or sets the hidden state size for the model.
public int HiddenSize { get; set; }
Property Value
- int
The hidden state size, defaulting to 128.
Remarks
For Beginners: This controls the capacity of the model's internal representations. Larger values allow the model to capture more complex patterns but require more memory and computation.
LearningRate
Gets or sets the learning rate for training.
public double LearningRate { get; set; }
Property Value
- double
The learning rate, defaulting to 0.001.
LookbackWindow
Gets or sets the lookback window size (number of historical time steps used as input).
public int LookbackWindow { get; set; }
Property Value
- int
The lookback window size, defaulting to 24.
NumAttentionHeads
Gets or sets the number of attention heads in the multi-head attention mechanism.
public int NumAttentionHeads { get; set; }
Property Value
- int
The number of attention heads, defaulting to 4.
Remarks
For Beginners: Attention heads allow the model to focus on different aspects of the time series simultaneously. More heads can capture more diverse patterns.
NumLayers
Gets or sets the number of transformer layers.
public int NumLayers { get; set; }
Property Value
- int
The number of layers, defaulting to 2.
QuantileLevels
Gets or sets the quantile levels for probabilistic forecasting.
public double[] QuantileLevels { get; set; }
Property Value
- double[]
Array of quantile levels, defaulting to [0.1, 0.5, 0.9].
Remarks
For Beginners: Quantile forecasting provides prediction intervals. For example, [0.1, 0.5, 0.9] gives you the 10th percentile (pessimistic), median (most likely), and 90th percentile (optimistic) predictions.
StaticCovariateSize
Gets or sets the number of static covariates (features that don't change over time).
public int StaticCovariateSize { get; set; }
Property Value
- int
The number of static covariates, defaulting to 0.
TimeVaryingKnownSize
Gets or sets the number of time-varying known inputs (future values that are known).
public int TimeVaryingKnownSize { get; set; }
Property Value
- int
The number of time-varying known inputs, defaulting to 0.
TimeVaryingUnknownSize
Gets or sets the number of time-varying unknown inputs (past observations only).
public int TimeVaryingUnknownSize { get; set; }
Property Value
- int
The number of time-varying unknown inputs, defaulting to 1.
UseVariableSelection
Gets or sets whether to use variable selection networks.
public bool UseVariableSelection { get; set; }
Property Value
- bool
True to use variable selection, defaulting to true.
Remarks
For Beginners: Variable selection automatically determines which input features are most important for making predictions, improving both accuracy and interpretability.