class_docstr: An ensemble predictor for N-BEATS. Calling '.predict' will result in::
  
      |predictors|x|dataset|
  
  predictions, if aggregation_method is 'none', otherwise in::
  
      |dataset|
  
  Parameters
  ----------
  prediction_length
      Prediction horizon.
  predictors
      The list of 'RepresentableBlockPredictor' that the ensemble consists
      of.
  aggregation_method
      The method by which to aggregate the individual predictions of the
      models. Either 'median', 'mean' or 'none', in which case no aggregation
      happens. Default is 'median'.
code: def predict(
      self, dataset: Dataset, num_samples: Optional[int] = 1, **kwargs
  ) -> Iterator[Forecast]:
      if num_samples != 1:
          logging.warning(
              "NBEATSEnsemblePredictor does not support sampling. "
              "Therefore 'num_samples' will be ignored and set to 1."
          )
      iterators = []
  
      # create the iterators from the predictors
      for predictor in self.predictors:
          iterators.append(predictor.predict(dataset, num_samples=1))
  
      # we always have to predict for one series in the dataset with
      # all models and return it as a 'SampleForecast' so that it is
      # clear that all these prediction concern the same series
      for item in dataset:
          output = []
          start_date = None
  
          for iterator in iterators:
              prediction = next(iterator)
  
              # on order to avoid mypys complaints
              assert isinstance(prediction, SampleForecast)
  
              output.append(prediction.samples)
  
              # get the forecast start date
              if start_date is None:
                  start_date = prediction.start_date
          output = np.concatenate(output, axis=0)
  
          # aggregating output of different models
          # default according to paper is median,
          # but we can also make use of not aggregating
          if self.aggregation_method == "median":
              output = np.median(output, axis=0, keepdims=True)
          elif self.aggregation_method == "mean":
              output = np.mean(output, axis=0, keepdims=True)
          else:  # "none": do not aggregate
              pass
  
          # on order to avoid mypys complaints
          assert start_date is not None
  
          yield SampleForecast(
              output,
              start_date=start_date,
              item_id=item[FieldName.ITEM_ID]
              if FieldName.ITEM_ID in item
              else None,
              info=item["info"] if "info" in item else None,
          )
  
imports: import copy
  import logging
  import os
  from itertools import product
  from pathlib import Path
  from typing import Iterator, List, Optional
  import mxnet
  import numpy
  from gluonts.core import fqname_for
  from gluonts.core.component import from_hyperparameters, validated
  from gluonts.core.serde import dump_json, load_json
  from gluonts.dataset.common import Dataset
  from gluonts.dataset.field_names import FieldName
  from gluonts.dataset.loader import DataBatch
  from gluonts.exceptions import GluonTSHyperparametersError
  from gluonts.model import Estimator, Predictor
  from gluonts.model.forecast import Forecast, SampleForecast
  from gluonts.mx.model.predictor import RepresentableBlockPredictor
  from gluonts.mx.trainer import Trainer
  from gluonts.pydantic import ValidationError
  from ._estimator import NBEATSEstimator
  from ._network import VALID_LOSS_FUNCTIONS
label_desc: Use image node_id 6 for calling the NBEATSEnsemblePredictor obj's underlying member method code with example usage: obj.predict(dataset, num_samples) without return types