class_docstr: Thin wrapper for `StackedEnsemble` that enables forecasting support.
class_docstr_tok: ["Thin","wrapper","for","`","StackedEnsemble","`","that","enables","forecasting","support","."]
code: def __call__(
      self, ds: EncodedDs, args: PredictionArguments
  ) -> pd.DataFrame:
      assert self.prepared
      mixer_weights = (
          torch.tensor(args.mixer_weights)
          if args.mixer_weights
          else self.mixer_weights
      )
      output = pd.DataFrame()
      predictions = torch.tensor(
          np.concatenate(self.predict(ds, args), axis=2)
      )
      predictions = (predictions * mixer_weights).sum(axis=self.agg_dim)
      output["prediction"] = predictions.detach().numpy().tolist()
      return output
  
file_path: lightwood/lightwood/ensemble/ts_stacked_ensemble.py
imports: from copy import deepcopy
  from typing import List, Optional
  import torch
  from torch import nn
  from torch.optim import SGD
  import numpy
  import pandas
  from lightwood.mixer.base import BaseMixer
  from lightwood.ensemble.stacked_ensemble import StackedEnsemble
  from lightwood.encoder.array.ts_num_array import TsArrayNumericEncoder
  from lightwood.api.types import PredictionArguments
  from type_infer.dtype import dtype
  from lightwood.data.encoded_ds import EncodedDs
  from lightwood.helpers.log import log
label_desc: Use image node_id 2 for calling the TsStackedEnsemble obj's underlying member method code with example usage: obj.__call__(ds, args) and returns: output