class_docstr: TimesNet
  
  The TimesNet univariate model tackles the challenge of modeling multiple intraperiod and interperiod temporal variations.
  
  Parameters
  ----------
  h : int
      Forecast horizon.
  input_size : int
      Length of input window (lags).
  futr_exog_list : list of str, optional (default=None)
      Future exogenous columns.
  hist_exog_list : list of str, optional (default=None)
      Historic exogenous columns.
  stat_exog_list : list of str, optional (default=None)
      Static exogenous columns.
  exclude_insample_y : bool (default=False)
      The model skips the autoregressive features y[t-input_size:t] if True
  hidden_size : int (default=64)
      Size of embedding for embedding and encoders.
  dropout : float between [0, 1) (default=0.1)
      Dropout for embeddings.
      conv_hidden_size: int (default=64)
      Channels of the Inception block.
  top_k: int (default=5)
      Number of periods.
  num_kernels: int (default=6)
      Number of kernels for the Inception block.
  encoder_layers : int, (default=2)
      Number of encoder layers.
  loss: PyTorch module (default=MAE())
      Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).
  valid_loss: PyTorch module (default=None, uses loss)
      Instantiated validation loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).
  max_steps: int (default=1000)
      Maximum number of training steps.
  learning_rate : float (default=1e-4)
      Learning rate.
  num_lr_decays`: int (default=-1)
      Number of learning rate decays, evenly distributed across max_steps. If -1, no learning rate decay is performed.
  early_stop_patience_steps : int (default=-1)
      Number of validation iterations before early stopping. If -1, no early stopping is performed.
  val_check_steps : int (default=100)
      Number of training steps between every validation loss check.
  batch_size : int (default=32)
      Number of different series in each batch.
  valid_batch_size : int (default=None)
      Number of different series in each validation and test batch, if None uses batch_size.
  windows_batch_size : int (default=64)
      Number of windows to sample in each training batch.
  inference_windows_batch_size : int (default=256)
      Number of windows to sample in each inference batch.
  start_padding_enabled : bool (default=False)
      If True, the model will pad the time series with zeros at the beginning by input size.
  scaler_type : str (default='standard')
      Type of scaler for temporal inputs normalization see [temporal scalers](https://nixtla.github.io/neuralforecast/common.scalers.html).<br>
  random_seed : int (default=1)
      Random_seed for pytorch initializer and numpy generators.
  num_workers_loader : int (default=0)
      Workers to be used by `TimeSeriesDataLoader`.
  drop_last_loader : bool (default=False)
      If True `TimeSeriesDataLoader` drops last non-full batch.
  **trainer_kwargs
      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)
  
      References
      ----------
  Haixu Wu and Tengge Hu and Yong Liu and Hang Zhou and Jianmin Wang and Mingsheng Long. TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis. https://openreview.net/pdf?id=ju_Uqw384Oq
class_docstr_tok: ["TimesNet","The","TimesNet","univariate","model","tackles","the","challenge","of","modeling","multiple","intraperiod","and","interperiod","temporal","variations",".","Parameters","--","--","--","--","--","h",":","int","Forecast","horizon",".","input_size",":","int","Length","of","input","window","(","lags",")",".","futr_exog_list",":","list","of","str",",","optional","(","default=None",")","Future","exogenous","columns",".","hist_exog_list",":","list","of","str",",","optional","(","default=None",")","Historic","exogenous","columns",".","stat_exog_list",":","list","of","str",",","optional","(","default=None",")","Static","exogenous","columns",".","exclude_insample_y",":","bool","(","default=False",")","The","model","skips","the","autoregressive","features","y","[","t-input_size",":","t","]","if","True","hidden_size",":","int","(","default=64",")","Size","of","embedding","for","embedding","and","encoders",".","dropout",":","float","between","[","0",",","1",")","(","default=0.1",")","Dropout","for","embeddings",".","conv_hidden_size",":","int","(","default=64",")","Channels","of","the","Inception","block",".","top_k",":","int","(","default=5",")","Number","of","periods",".","num_kernels",":","int","(","default=6",")","Number","of","kernels","for","the","Inception","block",".","encoder_layers",":","int",",","(","default=2",")","Number","of","encoder","layers",".","loss",":","PyTorch","module","(","default=MAE","(",")",")","Instantiated","train","loss","class","from","[","losses","collection","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/losses.pytorch.html",")",".","valid_loss",":","PyTorch","module","(","default=None",",","uses","loss",")","Instantiated","validation","loss","class","from","[","losses","collection","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/losses.pytorch.html",")",".","max_steps",":","int","(","default=1000",")","Maximum","number","of","training","steps",".","learning_rate",":","float","(","default=1e-4",")","Learning","rate",".","num_lr_decays","`",":","int","(","default=-1",")","Number","of","learning","rate","decays",",","evenly","distributed","across","max_steps",".","If","-1",",","no","learning","rate","decay","is","performed",".","early_stop_patience_steps",":","int","(","default=-1",")","Number","of","validation","iterations","before","early","stopping",".","If","-1",",","no","early","stopping","is","performed",".","val_check_steps",":","int","(","default=100",")","Number","of","training","steps","between","every","validation","loss","check",".","batch_size",":","int","(","default=32",")","Number","of","different","series","in","each","batch",".","valid_batch_size",":","int","(","default=None",")","Number","of","different","series","in","each","validation","and","test","batch",",","if","None","uses","batch_size",".","windows_batch_size",":","int","(","default=64",")","Number","of","windows","to","sample","in","each","training","batch",".","inference_windows_batch_size",":","int","(","default=256",")","Number","of","windows","to","sample","in","each","inference","batch",".","start_padding_enabled",":","bool","(","default=False",")","If","True",",","the","model","will","pad","the","time","series","with","zeros","at","the","beginning","by","input","size",".","scaler_type",":","str","(","default='standard","'",")","Type","of","scaler","for","temporal","inputs","normalization","see","[","temporal","scalers","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/common.scalers.html",")",".","<","br",">","random_seed",":","int","(","default=1",")","Random_seed","for","pytorch","initializer","and","numpy","generators",".","num_workers_loader",":","int","(","default=0",")","Workers","to","be","used","by","`","TimeSeriesDataLoader","`",".","drop_last_loader",":","bool","(","default=False",")","If","True","`","TimeSeriesDataLoader","`","drops","last","non-full","batch",".","*","*","trainer_kwargs","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",")","References","--","--","--","--","--","Haixu","Wu","and","Tengge","Hu","and","Yong","Liu","and","Hang","Zhou","and","Jianmin","Wang","and","Mingsheng","Long",".","TimesNet",":","Temporal","2D-Variation","Modeling","for","General","Time","Series","Analysis",".","https",":","\/\/openreview.net\/pdf","?","id=ju_Uqw384Oq"]
code: def __init__(
      self,
      h: int,
      input_size: int,
      stat_exog_list=None,
      hist_exog_list=None,
      futr_exog_list=None,
      exclude_insample_y=False,
      hidden_size: int = 64,
      dropout: float = 0.1,
      conv_hidden_size: int = 64,
      top_k: int = 5,
      num_kernels: int = 6,
      encoder_layers: int = 2,
      loss=MAE(),
      valid_loss=None,
      max_steps: int = 1000,
      learning_rate: float = 1e-4,
      num_lr_decays: int = -1,
      early_stop_patience_steps: int = -1,
      val_check_steps: int = 100,
      batch_size: int = 32,
      valid_batch_size: Optional[int] = None,
      windows_batch_size=64,
      inference_windows_batch_size=256,
      start_padding_enabled=False,
      step_size: int = 1,
      scaler_type: str = "standard",
      random_seed: int = 1,
      num_workers_loader: int = 0,
      drop_last_loader: bool = False,
      **trainer_kwargs,
  ):
      super(TimesNet, self).__init__(
          h=h,
          input_size=input_size,
          hist_exog_list=hist_exog_list,
          stat_exog_list=stat_exog_list,
          futr_exog_list=futr_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)
  
      if self.stat_input_size > 0:
          raise Exception(
              "TimesNet does not support static variables yet"
          )
      if self.hist_input_size > 0:
          raise Exception(
              "TimesNet does not support historical variables yet"
          )
  
      self.c_out = self.loss.outputsize_multiplier
      self.enc_in = 1
      self.dec_in = 1
  
      self.model = nn.ModuleList(
          [
              TimesBlock(
                  input_size=input_size,
                  h=h,
                  k=top_k,
                  hidden_size=hidden_size,
                  conv_hidden_size=conv_hidden_size,
                  num_kernels=num_kernels,
              )
              for _ in range(encoder_layers)
          ]
      )
  
      self.enc_embedding = DataEmbedding(
          c_in=self.enc_in,
          exog_input_size=self.futr_input_size,
          hidden_size=hidden_size,
          pos_embedding=True,  # Original implementation uses true
          dropout=dropout,
      )
      self.encoder_layers = encoder_layers
      self.layer_norm = nn.LayerNorm(hidden_size)
      self.predict_linear = nn.Linear(
          self.input_size, self.h + self.input_size
      )
      self.projection = nn.Linear(hidden_size, self.c_out, bias=True)
  
imports: from typing import Optional
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.fft
  from ..common._modules import DataEmbedding
  from ..common._base_windows import BaseWindows
  from ..losses.pytorch import MAE
label_desc: Use image node_id 1 to create a new TimesNet object from inherited base classes: BaseWindows with example: obj = TimesNet(h, input_size, stat_exog_list, hist_exog_list, futr_exog_list, exclude_insample_y, hidden_size, dropout, conv_hidden_size, top_k, num_kernels, encoder_layers, 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)