Table of Contents

Class DeepAROptions<T>

Namespace
AiDotNet.Models.Options
Assembly
AiDotNet.dll

Configuration options for the DeepAR (Deep Autoregressive) model.

public class DeepAROptions<T> : TimeSeriesRegressionOptions<T>

Type Parameters

T

The numeric type used for calculations (typically double or float).

Inheritance
DeepAROptions<T>
Inherited Members

Remarks

DeepAR is a probabilistic forecasting methodology based on autoregressive recurrent neural networks. Unlike traditional methods that provide point forecasts, DeepAR produces probabilistic forecasts that include prediction intervals. It's particularly effective for: - Handling multiple related time series simultaneously - Cold-start problems (forecasting for new items with limited history) - Capturing complex seasonal patterns and trends - Quantifying forecast uncertainty

For Beginners: DeepAR is an advanced forecasting model that not only predicts what will happen, but also how confident it is in those predictions. Instead of saying "sales will be exactly 100 units," it might say "sales will likely be between 80 and 120 units, with 100 being most probable."

This is especially useful when:

  • You need to plan for worst-case and best-case scenarios
  • You have many related time series (e.g., sales across many stores)
  • You have some series with very little historical data

The "autoregressive" part means it uses its own predictions as inputs for future predictions, and "deep" refers to the use of deep neural networks (specifically, LSTM networks).

Constructors

DeepAROptions()

Initializes a new instance of the DeepAROptions<T> class.

public DeepAROptions()

DeepAROptions(DeepAROptions<T>)

Initializes a new instance by copying from another instance.

public DeepAROptions(DeepAROptions<T> other)

Parameters

other DeepAROptions<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.

CovariateSize

Gets or sets the number of covariates (external features).

public int CovariateSize { get; set; }

Property Value

int

The covariate size, defaulting to 0.

Remarks

For Beginners: Covariates are additional features that might influence your forecast, like holidays, promotions, weather, etc. Set this to the number of such features you want to include.

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 helps prevent overfitting by randomly ignoring some neurons during training. A value of 0.1 means 10% are ignored.

EmbeddingDimension

Gets or sets the embedding dimension for categorical features.

public int EmbeddingDimension { get; set; }

Property Value

int

The embedding dimension, defaulting to 10.

Remarks

For Beginners: If you have categorical features (like store ID, product category), embeddings convert them into numerical representations that the model can understand. This sets how many dimensions to use.

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 (prediction length).

public int ForecastHorizon { get; set; }

Property Value

int

The forecast horizon, defaulting to 7.

HiddenSize

Gets or sets the hidden state size of the LSTM layers.

public int HiddenSize { get; set; }

Property Value

int

The hidden size, defaulting to 40.

Remarks

For Beginners: The capacity of the model's memory. Larger values allow the model to remember more complex patterns but require more training data.

LearningRate

Gets or sets the learning rate for training.

public double LearningRate { get; set; }

Property Value

double

The learning rate, defaulting to 0.001.

LikelihoodType

Gets or sets the likelihood distribution type.

public string LikelihoodType { get; set; }

Property Value

string

The likelihood type, defaulting to "Gaussian".

Remarks

Supported values: "Gaussian", "StudentT", "NegativeBinomial" - Gaussian: For continuous data that can be negative (e.g., temperature, stock returns) - StudentT: For continuous data with heavy tails (outliers) - NegativeBinomial: For count data (e.g., number of sales, website visits)

For Beginners: This determines what kind of randomness the model assumes in your data. Choose based on your data type: - Gaussian (Normal): Most common, works for temperatures, prices, etc. - StudentT: When you have occasional extreme outliers - NegativeBinomial: When counting things (must be non-negative integers)

LookbackWindow

Gets or sets the lookback window size (context length).

public int LookbackWindow { get; set; }

Property Value

int

The lookback window, defaulting to 30.

Remarks

For Beginners: How many past time steps the model looks at before making a prediction. For daily data, 30 would mean looking at the past month.

NumLayers

Gets or sets the number of LSTM layers.

public int NumLayers { get; set; }

Property Value

int

The number of layers, defaulting to 2.

NumSamples

Gets or sets the number of samples to draw for probabilistic forecasts.

public int NumSamples { get; set; }

Property Value

int

The number of samples, defaulting to 100.

Remarks

For Beginners: DeepAR generates multiple possible futures (samples) to create prediction intervals. More samples give more accurate probability estimates but take longer to compute. 100 is a good balance.