class_docstr: NHITS
  
  The Neural Hierarchical Interpolation for Time Series (NHITS), is an MLP-based deep
  neural architecture with backward and forward residual links. NHITS tackles volatility and
  memory complexity challenges, by locally specializing its sequential predictions into
  the signals frequencies with hierarchical interpolation and pooling.
  
  **Parameters:**<br>
  `h`: int, Forecast horizon. <br>
  `input_size`: int, autorregresive inputs size, y=[1,2,3,4] input_size=2 -> y_[t-2:t]=[1,2].<br>
  `stat_exog_list`: str list, static exogenous columns.<br>
  `hist_exog_list`: str list, historic exogenous columns.<br>
  `futr_exog_list`: str list, future exogenous columns.<br>
  `exclude_insample_y`: bool=False, the model skips the autoregressive features y[t-input_size:t] if True.<br>
  `activation`: str, activation from ['ReLU', 'Softplus', 'Tanh', 'SELU', 'LeakyReLU', 'PReLU', 'Sigmoid'].<br>
  `stack_types`: List[str], stacks list in the form N * ['identity'], to be deprecated in favor of `n_stacks`. Note that len(stack_types)=len(n_freq_downsample)=len(n_pool_kernel_size).<br>
  `n_blocks`: List[int], Number of blocks for each stack. Note that len(n_blocks) = len(stack_types).<br>
  `mlp_units`: List[List[int]], Structure of hidden layers for each stack type. Each internal list should contain the number of units of each hidden layer. Note that len(n_hidden) = len(stack_types).<br>
  `n_freq_downsample`: List[int], list with the stack's coefficients (inverse expressivity ratios). Note that len(stack_types)=len(n_freq_downsample)=len(n_pool_kernel_size).<br>
  `interpolation_mode`: str='linear', interpolation basis from ['linear', 'nearest', 'cubic'].<br>
  `n_pool_kernel_size`: List[int], list with the size of the windows to take a max/avg over. Note that len(stack_types)=len(n_freq_downsample)=len(n_pool_kernel_size).<br>
  `pooling_mode`: str, input pooling module from ['MaxPool1d', 'AvgPool1d'].<br>
  `dropout_prob_theta`: float, Float between (0, 1). Dropout for NHITS basis.<br>
  `loss`: PyTorch module, instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).<br>
  `valid_loss`: PyTorch module=`loss`, instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).<br>
  `max_steps`: int=1000, maximum number of training steps.<br>
  `learning_rate`: float=1e-3, Learning rate between (0, 1).<br>
  `num_lr_decays`: int=-1, Number of learning rate decays, evenly distributed across max_steps.<br>
  `early_stop_patience_steps`: int=-1, Number of validation iterations before early stopping.<br>
  `val_check_steps`: int=100, Number of training steps between every validation loss check.<br>
  `batch_size`: int=32, number of different series in each batch.<br>
  `valid_batch_size`: int=None, number of different series in each validation and test batch, if None uses batch_size.<br>
  `windows_batch_size`: int=1024, number of windows to sample in each training batch, default uses all.<br>
  `inference_windows_batch_size`: int=-1, number of windows to sample in each inference batch, -1 uses all.<br>
  `start_padding_enabled`: bool=False, if True, the model will pad the time series with zeros at the beginning, by input size.<br>
  `step_size`: int=1, step size between each window of temporal data.<br>
  `scaler_type`: str='identity', type of scaler for temporal inputs normalization see [temporal scalers](https://nixtla.github.io/neuralforecast/common.scalers.html).<br>
  `random_seed`: int, random_seed for pytorch initializer and numpy generators.<br>
  `num_workers_loader`: int=os.cpu_count(), workers to be used by `TimeSeriesDataLoader`.<br>
  `drop_last_loader`: bool=False, if True `TimeSeriesDataLoader` drops last non-full batch.<br>
  `alias`: str, optional,  Custom name of the model.<br>
  `**trainer_kwargs`: int,  keyword trainer arguments inherited from [PyTorch Lighning's trainer](https://pytorch-lightning.readthedocs.io/en/stable/api/pytorch_lightning.trainer.trainer.Trainer.html?highlight=trainer).<br>
  
  **References:**<br>
  -[Cristian Challu, Kin G. Olivares, Boris N. Oreshkin, Federico Garza,
  Max Mergenthaler-Canseco, Artur Dubrawski (2023). "NHITS: Neural Hierarchical Interpolation for Time Series Forecasting".
  Accepted at the Thirty-Seventh AAAI Conference on Artificial Intelligence.](https://arxiv.org/abs/2201.12886)
class_docstr_tok: ["NHITS","The","Neural","Hierarchical","Interpolation","for","Time","Series","(","NHITS",")",",","is","an","MLP-based","deep","neural","architecture","with","backward","and","forward","residual","links",".","NHITS","tackles","volatility","and","memory","complexity","challenges",",","by","locally","specializing","its","sequential","predictions","into","the","signals","frequencies","with","hierarchical","interpolation","and","pooling",".","*","*","Parameters",":","*","*","<","br",">","`","h","`",":","int",",","Forecast","horizon",".","<","br",">","`","input_size","`",":","int",",","autorregresive","inputs","size",",","y=","[","1,2,3,4","]","input_size=2","-",">","y_","[","t-2",":","t","]","=","[","1,2","]",".","<","br",">","`","stat_exog_list","`",":","str","list",",","static","exogenous","columns.","<","br",">","`","hist_exog_list","`",":","str","list",",","historic","exogenous","columns.","<","br",">","`","futr_exog_list","`",":","str","list",",","future","exogenous","columns.","<","br",">","`","exclude_insample_y","`",":","bool=False",",","the","model","skips","the","autoregressive","features","y","[","t-input_size",":","t","]","if","True.","<","br",">","`","activation","`",":","str",",","activation","from","[","'ReLU","'",",","'Softplus","'",",","'Tanh","'",",","'SELU","'",",","'LeakyReLU","'",",","'PReLU","'",",","'Sigmoid","'","]",".","<","br",">","`","stack_types","`",":","List","[","str","]",",","stacks","list","in","the","form","N","*","[","'identity","'","]",",","to","be","deprecated","in","favor","of","`","n_stacks","`",".","Note","that","len","(","stack_types",")","=len","(","n_freq_downsample",")","=len","(","n_pool_kernel_size",")",".","<","br",">","`","n_blocks","`",":","List","[","int","]",",","Number","of","blocks","for","each","stack",".","Note","that","len","(","n_blocks",")","=","len","(","stack_types",")",".","<","br",">","`","mlp_units","`",":","List","[","List","[","int","]","]",",","Structure","of","hidden","layers","for","each","stack","type",".","Each","internal","list","should","contain","the","number","of","units","of","each","hidden","layer",".","Note","that","len","(","n_hidden",")","=","len","(","stack_types",")",".","<","br",">","`","n_freq_downsample","`",":","List","[","int","]",",","list","with","the","stack","'s","coefficients","(","inverse","expressivity","ratios",")",".","Note","that","len","(","stack_types",")","=len","(","n_freq_downsample",")","=len","(","n_pool_kernel_size",")",".","<","br",">","`","interpolation_mode","`",":","str='linear","'",",","interpolation","basis","from","[","'linear","'",",","'nearest","'",",","'cubic","'","]",".","<","br",">","`","n_pool_kernel_size","`",":","List","[","int","]",",","list","with","the","size","of","the","windows","to","take","a","max\/avg","over",".","Note","that","len","(","stack_types",")","=len","(","n_freq_downsample",")","=len","(","n_pool_kernel_size",")",".","<","br",">","`","pooling_mode","`",":","str",",","input","pooling","module","from","[","'MaxPool1d","'",",","'AvgPool1d","'","]",".","<","br",">","`","dropout_prob_theta","`",":","float",",","Float","between","(","0",",","1",")",".","Dropout","for","NHITS","basis.","<","br",">","`","loss","`",":","PyTorch","module",",","instantiated","train","loss","class","from","[","losses","collection","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/losses.pytorch.html",")",".","<","br",">","`","valid_loss","`",":","PyTorch","module=","`","loss","`",",","instantiated","valid","loss","class","from","[","losses","collection","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/losses.pytorch.html",")",".","<","br",">","`","max_steps","`",":","int=1000",",","maximum","number","of","training","steps.","<","br",">","`","learning_rate","`",":","float=1e-3",",","Learning","rate","between","(","0",",","1",")",".","<","br",">","`","num_lr_decays","`",":","int=-1",",","Number","of","learning","rate","decays",",","evenly","distributed","across","max_steps.","<","br",">","`","early_stop_patience_steps","`",":","int=-1",",","Number","of","validation","iterations","before","early","stopping.","<","br",">","`","val_check_steps","`",":","int=100",",","Number","of","training","steps","between","every","validation","loss","check.","<","br",">","`","batch_size","`",":","int=32",",","number","of","different","series","in","each","batch.","<","br",">","`","valid_batch_size","`",":","int=None",",","number","of","different","series","in","each","validation","and","test","batch",",","if","None","uses","batch_size.","<","br",">","`","windows_batch_size","`",":","int=1024",",","number","of","windows","to","sample","in","each","training","batch",",","default","uses","all.","<","br",">","`","inference_windows_batch_size","`",":","int=-1",",","number","of","windows","to","sample","in","each","inference","batch",",","-1","uses","all.","<","br",">","`","start_padding_enabled","`",":","bool=False",",","if","True",",","the","model","will","pad","the","time","series","with","zeros","at","the","beginning",",","by","input","size.","<","br",">","`","step_size","`",":","int=1",",","step","size","between","each","window","of","temporal","data.","<","br",">","`","scaler_type","`",":","str='identity","'",",","type","of","scaler","for","temporal","inputs","normalization","see","[","temporal","scalers","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/common.scalers.html",")",".","<","br",">","`","random_seed","`",":","int",",","random_seed","for","pytorch","initializer","and","numpy","generators.","<","br",">","`","num_workers_loader","`",":","int=os.cpu_count","(",")",",","workers","to","be","used","by","`","TimeSeriesDataLoader","`",".","<","br",">","`","drop_last_loader","`",":","bool=False",",","if","True","`","TimeSeriesDataLoader","`","drops","last","non-full","batch.","<","br",">","`","alias","`",":","str",",","optional",",","Custom","name","of","the","model.","<","br",">","`","*","*","trainer_kwargs","`",":","int",",","keyword","trainer","arguments","inherited","from","[","PyTorch","Lighning","'s","trainer","]","(","https",":","\/\/pytorch-lightning.readthedocs.io\/en\/stable\/api\/pytorch_lightning.trainer.trainer.Trainer.html","?","highlight=trainer",")",".","<","br",">","*","*","References",":","*","*","<","br",">","-","[","Cristian","Challu",",","Kin","G.","Olivares",",","Boris","N.","Oreshkin",",","Federico","Garza",",","Max","Mergenthaler-Canseco",",","Artur","Dubrawski","(","2023",")",".","``","NHITS",":","Neural","Hierarchical","Interpolation","for","Time","Series","Forecasting","''",".","Accepted","at","the","Thirty-Seventh","AAAI","Conference","on","Artificial","Intelligence",".","]","(","https",":","\/\/arxiv.org\/abs\/2201.12886",")"]
code: def __init__(
      self,
      h,
      input_size,
      futr_exog_list=None,
      hist_exog_list=None,
      stat_exog_list=None,
      exclude_insample_y=False,
      stack_types: list = ["identity", "identity", "identity"],
      n_blocks: list = [1, 1, 1],
      mlp_units: list = 3 * [[512, 512]],
      n_pool_kernel_size: list = [2, 2, 1],
      n_freq_downsample: list = [4, 2, 1],
      pooling_mode: str = "MaxPool1d",
      interpolation_mode: str = "linear",
      dropout_prob_theta=0.0,
      activation="ReLU",
      loss=MAE(),
      valid_loss=None,
      max_steps: int = 1000,
      learning_rate: float = 1e-3,
      num_lr_decays: int = 3,
      early_stop_patience_steps: int = -1,
      val_check_steps: int = 100,
      batch_size: int = 32,
      valid_batch_size: Optional[int] = None,
      windows_batch_size: int = 1024,
      inference_windows_batch_size: int = -1,
      start_padding_enabled=False,
      step_size: int = 1,
      scaler_type: str = "identity",
      random_seed: int = 1,
      num_workers_loader=0,
      drop_last_loader=False,
      **trainer_kwargs,
  ):
      # Inherit BaseWindows class
      super(NHITS, self).__init__(
          h=h,
          input_size=input_size,
          futr_exog_list=futr_exog_list,
          hist_exog_list=hist_exog_list,
          stat_exog_list=stat_exog_list,
          exclude_insample_y=exclude_insample_y,
          loss=loss,
          valid_loss=valid_loss,
          max_steps=max_steps,
          learning_rate=learning_rate,
          num_lr_decays=num_lr_decays,
          early_stop_patience_steps=early_stop_patience_steps,
          val_check_steps=val_check_steps,
          batch_size=batch_size,
          windows_batch_size=windows_batch_size,
          valid_batch_size=valid_batch_size,
          inference_windows_batch_size=inference_windows_batch_size,
          start_padding_enabled=start_padding_enabled,
          step_size=step_size,
          scaler_type=scaler_type,
          num_workers_loader=num_workers_loader,
          drop_last_loader=drop_last_loader,
          random_seed=random_seed,
          **trainer_kwargs,
      )
  
      # Architecture
      self.futr_input_size = len(self.futr_exog_list)
      self.hist_input_size = len(self.hist_exog_list)
      self.stat_input_size = len(self.stat_exog_list)
  
      blocks = self.create_stack(
          h=h,
          input_size=input_size,
          stack_types=stack_types,
          futr_input_size=self.futr_input_size,
          hist_input_size=self.hist_input_size,
          stat_input_size=self.stat_input_size,
          n_blocks=n_blocks,
          mlp_units=mlp_units,
          n_pool_kernel_size=n_pool_kernel_size,
          n_freq_downsample=n_freq_downsample,
          pooling_mode=pooling_mode,
          interpolation_mode=interpolation_mode,
          dropout_prob_theta=dropout_prob_theta,
          activation=activation,
      )
      self.blocks = torch.nn.ModuleList(blocks)
  
imports: from typing import Tuple, Optional
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from ..losses.pytorch import MAE
  from ..common._base_windows import BaseWindows
label_desc: Use image node_id 1 to create a new NHITS object from inherited base classes: BaseWindows with example: obj = NHITS(h, input_size, futr_exog_list, hist_exog_list, stat_exog_list, exclude_insample_y, stack_types, n_blocks, mlp_units, n_pool_kernel_size, n_freq_downsample, pooling_mode, interpolation_mode, dropout_prob_theta, activation, loss, valid_loss, max_steps, learning_rate, num_lr_decays, early_stop_patience_steps, val_check_steps, batch_size, valid_batch_size, windows_batch_size, inference_windows_batch_size, start_padding_enabled, step_size, scaler_type, random_seed, num_workers_loader, drop_last_loader)