Table of Contents

Class NHiTSOptions<T>

Namespace
AiDotNet.Models.Options
Assembly
AiDotNet.dll

Configuration options for the N-HiTS (Neural Hierarchical Interpolation for Time Series) model.

public class NHiTSOptions<T> : TimeSeriesRegressionOptions<T>

Type Parameters

T

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

Inheritance
NHiTSOptions<T>
Inherited Members

Remarks

N-HiTS is an evolution of N-BEATS that incorporates hierarchical interpolation and multi-rate signal sampling. It achieves better accuracy on long-horizon forecasting tasks while being more parameter-efficient. Key improvements over N-BEATS include: - Hierarchical multi-rate data pooling for capturing patterns at different frequencies - Interpolation-based basis functions for smoother forecasts - More efficient parameter usage through stack-specific pooling

For Beginners: N-HiTS is an advanced neural network for time series forecasting that works by looking at your data at multiple resolutions simultaneously - similar to how you might zoom in and out when analyzing a chart. This multi-scale approach helps it capture both short-term patterns (like daily fluctuations) and long-term trends (like seasonal cycles).

Constructors

NHiTSOptions()

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

public NHiTSOptions()

NHiTSOptions(NHiTSOptions<T>)

Initializes a new instance by copying from another instance.

public NHiTSOptions(NHiTSOptions<T> other)

Parameters

other NHiTSOptions<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 (memorizing the training data instead of learning general patterns).

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 24.

HiddenLayerSize

Gets or sets the hidden layer size for fully connected layers within each block.

public int HiddenLayerSize { get; set; }

Property Value

int

The hidden layer size, defaulting to 512.

InterpolationModes

Gets or sets the interpolation modes for each stack.

public string[] InterpolationModes { get; set; }

Property Value

string[]

Array of interpolation modes, defaulting to ["Linear", "Linear", "Linear"].

Remarks

For Beginners: Interpolation determines how the model fills in values between known data points. "Linear" interpolation draws straight lines between points, while other methods like "Cubic" use curves for smoother results.

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 48.

NumBlocksPerStack

Gets or sets the number of blocks per stack.

public int NumBlocksPerStack { get; set; }

Property Value

int

The number of blocks per stack, defaulting to 1.

NumHiddenLayers

Gets or sets the number of hidden layers within each block.

public int NumHiddenLayers { get; set; }

Property Value

int

The number of hidden layers, defaulting to 2.

NumStacks

Gets or sets the number of stacks in the N-HiTS architecture.

public int NumStacks { get; set; }

Property Value

int

The number of stacks, defaulting to 3.

Remarks

For Beginners: N-HiTS typically uses 3 stacks, each operating at a different time resolution. The first stack captures high-frequency patterns, the second captures medium-frequency patterns, and the third captures low-frequency trends.

PoolingKernelSizes

Gets or sets the pooling kernel sizes for each stack.

public int[] PoolingKernelSizes { get; set; }

Property Value

int[]

Array of kernel sizes, defaulting to [8, 4, 1].

Remarks

For Beginners: Kernel size controls how much downsampling occurs in each stack. Larger kernel sizes (like 8) create coarser representations that capture long-term trends, while smaller sizes (like 1) preserve fine-grained details.

PoolingModes

Gets or sets the pooling modes for each stack.

public string[] PoolingModes { get; set; }

Property Value

string[]

Array of pooling modes, defaulting to ["MaxPool", "AvgPool", "AvgPool"].

Remarks

For Beginners: Pooling is a downsampling technique that reduces the resolution of the input data. Different stacks use different pooling strategies to capture patterns at different time scales. "MaxPool" keeps the maximum values, while "AvgPool" averages values.