class_docstr: Base Multivariate
  
  Base class for all multivariate models. The forecasts for all time-series are produced simultaneously
  within each window, which are randomly sampled during training.
  
  This class implements the basic functionality for all windows-based models, including:
  - PyTorch Lightning's methods training_step, validation_step, predict_step.<br>
  - fit and predict methods used by NeuralForecast.core class.<br>
  - sampling and wrangling methods to generate multivariate windows.
class_docstr_tok: ["Base","Multivariate","Base","class","for","all","multivariate","models",".","The","forecasts","for","all","time-series","are","produced","simultaneously","within","each","window",",","which","are","randomly","sampled","during","training",".","This","class","implements","the","basic","functionality","for","all","windows-based","models",",","including",":","-","PyTorch","Lightning","'s","methods","training_step",",","validation_step",",","predict_step.","<","br",">","-","fit","and","predict","methods","used","by","NeuralForecast.core","class.","<","br",">","-","sampling","and","wrangling","methods","to","generate","multivariate","windows","."]
docstr: Predict.
  
  Neural network prediction with PL's `Trainer` execution of `predict_step`.
  
  **Parameters:**<br>
  `dataset`: NeuralForecast's `TimeSeriesDataset`, see [documentation](https://nixtla.github.io/neuralforecast/tsdataset.html).<br>
  `test_size`: int=None, test size for temporal cross-validation.<br>
  `step_size`: int=1, Step size between each window.<br>
  `**data_module_kwargs`: PL's TimeSeriesDataModule args, see [documentation](https://pytorch-lightning.readthedocs.io/en/1.6.1/extensions/datamodules.html#using-a-datamodule).
docstr_tok: ["Predict",".","Neural","network","prediction","with","PL","'s","`","Trainer","`","execution","of","`","predict_step","`",".","*","*","Parameters",":","*","*","<","br",">","`","dataset","`",":","NeuralForecast","'s","`","TimeSeriesDataset","`",",","see","[","documentation","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/tsdataset.html",")",".","<","br",">","`","test_size","`",":","int=None",",","test","size","for","temporal","cross-validation.","<","br",">","`","step_size","`",":","int=1",",","Step","size","between","each","window.","<","br",">","`","*","*","data_module_kwargs","`",":","PL","'s","TimeSeriesDataModule","args",",","see","[","documentation","]","(","https",":","\/\/pytorch-lightning.readthedocs.io\/en\/1.6.1\/extensions\/datamodules.html","#","using-a-datamodule",")","."]
code: def predict(
      self,
      dataset,
      test_size=None,
      step_size=1,
      random_seed=None,
      **data_module_kwargs,
  ):
      """Predict.
  
      Neural network prediction with PL's `Trainer` execution of `predict_step`.
  
      **Parameters:**<br>
      `dataset`: NeuralForecast's `TimeSeriesDataset`, see [documentation](https://nixtla.github.io/neuralforecast/tsdataset.html).<br>
      `test_size`: int=None, test size for temporal cross-validation.<br>
      `step_size`: int=1, Step size between each window.<br>
      `**data_module_kwargs`: PL's TimeSeriesDataModule args, see [documentation](https://pytorch-lightning.readthedocs.io/en/1.6.1/extensions/datamodules.html#using-a-datamodule).
      """
  
      # Check exogenous variables are contained in dataset
      temporal_cols = set(dataset.temporal_cols.tolist())
      static_cols = set(
          dataset.static_cols.tolist()
          if dataset.static_cols is not None
          else []
      )
      if len(set(self.hist_exog_list) - temporal_cols) > 0:
          raise Exception(
              f"{set(self.hist_exog_list) - temporal_cols} historical exogenous variables not found in input dataset"
          )
      if len(set(self.futr_exog_list) - temporal_cols) > 0:
          raise Exception(
              f"{set(self.futr_exog_list) - temporal_cols} future exogenous variables not found in input dataset"
          )
      if len(set(self.stat_exog_list) - static_cols) > 0:
          raise Exception(
              f"{set(self.stat_exog_list) - static_cols} static exogenous variables not found in input dataset"
          )
  
      # Restart random seed
      if random_seed is None:
          random_seed = self.random_seed
      torch.manual_seed(random_seed)
  
      self.predict_step_size = step_size
      self.decompose_forecast = False
      datamodule = TimeSeriesDataModule(
          dataset=dataset,
          batch_size=self.n_series,
          **data_module_kwargs,
      )
  
      # Protect when case of multiple gpu. PL does not support return preds with multiple gpu.
      pred_trainer_kwargs = self.trainer_kwargs.copy()
      if (pred_trainer_kwargs.get("accelerator", None) == "gpu") and (
          torch.cuda.device_count() > 1
      ):
          pred_trainer_kwargs["devices"] = [0]
  
      trainer = pl.Trainer(**pred_trainer_kwargs)
      fcsts = trainer.predict(self, datamodule=datamodule)
      fcsts = torch.vstack(fcsts).numpy()
  
      fcsts = np.transpose(fcsts, (2, 0, 1))
      fcsts = fcsts.flatten()
      fcsts = fcsts.reshape(-1, len(self.loss.output_names))
      return fcsts
  
imports: import random
  import warnings
  import numpy
  import torch
  import torch.nn
  import pytorch_lightning
  from pytorch_lightning.callbacks import TQDMProgressBar
  from pytorch_lightning.callbacks.early_stopping import EarlyStopping
  from ._scalers import TemporalNorm
  from ..tsdataset import TimeSeriesDataModule
  from ..utils import get_indexer_raise_missing
label_desc: Use image node_id 15 for calling the BaseMultivariate obj's underlying member method code with example usage: obj.predict(dataset, test_size, step_size, random_seed) and returns: fcsts