class_docstr: Constructs a weighted ensemble using the greedy Ensemble Selection algorithm.
class_docstr_tok: ["Constructs","a","weighted","ensemble","using","the","greedy","Ensemble","Selection","algorithm","."]
code: def _fit_ensemble(
      self,
      predictions_per_window: Dict[str, List[TimeSeriesDataFrame]],
      data_per_window: List[TimeSeriesDataFrame],
      time_limit: Optional[int] = None,
      verbosity: int = 2,
      **kwargs,
  ):
      set_logger_verbosity(verbosity, logger=logger)
      if self.eval_metric_seasonal_period is None:
          self.eval_metric_seasonal_period = get_seasonality(self.freq)
      ensemble_selection = TimeSeriesEnsembleSelection(
          ensemble_size=self.ensemble_size,
          metric=self.eval_metric,
          prediction_length=self.prediction_length,
          target=self.target,
          eval_metric_seasonal_period=self.eval_metric_seasonal_period,
      )
      ensemble_selection.fit(
          predictions=list(predictions_per_window.values()),
          labels=data_per_window,
          time_limit=time_limit,
      )
      self.model_to_weight = {}
      for model_name, weight in zip(
          predictions_per_window.keys(), ensemble_selection.weights_
      ):
          if weight != 0:
              self.model_to_weight[model_name] = weight
  
      weights_for_printing = {
          model: round(weight, 2)
          for model, weight in self.model_to_weight.items()
      }
      logger.info(
          f"\tEnsemble weights: {pprint.pformat(weights_for_printing, width=200)}"
      )
  
imports: import copy
  import logging
  import pprint
  from typing import Dict, List, Optional
  import numpy
  import autogluon.core
  from autogluon.common.utils.log_utils import set_logger_verbosity
  from autogluon.core.models.greedy_ensemble.ensemble_selection import EnsembleSelection
  from autogluon.timeseries import TimeSeriesDataFrame
  from autogluon.timeseries.metrics import TimeSeriesScorer
  from autogluon.timeseries.models.ensemble import AbstractTimeSeriesEnsembleModel
  from autogluon.timeseries.utils.datetime import get_seasonality
label_desc: Use image node_id 2 for calling the TimeSeriesGreedyEnsemble obj's underlying member method code with example usage: obj._fit_ensemble(predictions_per_window, data_per_window, time_limit, verbosity) without return types