class_docstr: Automatically find best weights for the ensembled forecasters.
  
  The AutoEnsembleForecaster finds optimal weights for the ensembled forecasters
  using given method or a meta-model (regressor) .
  The regressor has to be sklearn-like and needs to have either an attribute
  ``feature_importances_`` or ``coef_``, as this is used as weights.
  Regressor can also be a sklearn.Pipeline.
  
  Parameters
  ----------
  forecasters : list of (str, estimator) tuples
      Estimators to apply to the input series.
  method : str, optional, default="feature-importance"
      Strategy used to compute weights. Available choices:
  
      - feature-importance:
          use the ``feature_importances_`` or ``coef_`` from
          given ``regressor`` as optimal weights.
      - inverse-variance:
          use the inverse variance of the forecasting error
          (based on the internal train-test-split) to compute optimal
          weights, a given ``regressor`` will be omitted.
  regressor : sklearn-like regressor, optional, default=None.
      Used to infer optimal weights from coefficients (linear models) or from
      feature importance scores (decision tree-based models). If None, then
      a GradientBoostingRegressor(max_depth=5) is used.
      The regressor can also be a sklearn.Pipeline().
  test_size : int or float, optional, default=None
      Used to do an internal temporal_train_test_split(). The test_size data
      will be the endog data of the regressor and it is the most recent data.
      The exog data of the regressor are the predictions from the temporarily
      trained ensemble models. If None, it will be set to 0.25.
  random_state : int, RandomState instance or None, default=None
      Used to set random_state of the default regressor.
  n_jobs : int or None, optional, default=None
      The number of jobs to run in parallel for fit. None means 1 unless
      in a joblib.parallel_backend context.
      -1 means using all processors.
  
  Attributes
  ----------
  regressor_ : sklearn-like regressor
      Fitted regressor.
  weights_ : np.array
      The weights based on either ``regressor.feature_importances_`` or
      ``regressor.coef_`` values.
  
  See Also
  --------
  EnsembleForecaster
  
  Examples
  --------
  >>> from sktime.forecasting.compose import AutoEnsembleForecaster
  >>> from sktime.forecasting.naive import NaiveForecaster
  >>> from sktime.forecasting.trend import PolynomialTrendForecaster
  >>> from sktime.datasets import load_airline
  >>> y = load_airline()
  >>> forecasters = [
  ...     ("trend", PolynomialTrendForecaster()),
  ...     ("naive", NaiveForecaster()),
  ... ]
  >>> forecaster = AutoEnsembleForecaster(forecasters=forecasters)
  >>> forecaster.fit(y=y, fh=[1,2,3])
  AutoEnsembleForecaster(...)
  >>> y_pred = forecaster.predict()
class_docstr_tok: ["Automatically","find","best","weights","for","the","ensembled","forecasters",".","The","AutoEnsembleForecaster","finds","optimal","weights","for","the","ensembled","forecasters","using","given","method","or","a","meta-model","(","regressor",")",".","The","regressor","has","to","be","sklearn-like","and","needs","to","have","either","an","attribute","``","feature_importances_","``","or","``","coef_","``",",","as","this","is","used","as","weights",".","Regressor","can","also","be","a","sklearn.Pipeline",".","Parameters","--","--","--","--","--","forecasters",":","list","of","(","str",",","estimator",")","tuples","Estimators","to","apply","to","the","input","series",".","method",":","str",",","optional",",","default=","''","feature-importance","''","Strategy","used","to","compute","weights",".","Available","choices",":","-","feature-importance",":","use","the","``","feature_importances_","``","or","``","coef_","``","from","given","``","regressor","``","as","optimal","weights",".","-","inverse-variance",":","use","the","inverse","variance","of","the","forecasting","error","(","based","on","the","internal","train-test-split",")","to","compute","optimal","weights",",","a","given","``","regressor","``","will","be","omitted",".","regressor",":","sklearn-like","regressor",",","optional",",","default=None",".","Used","to","infer","optimal","weights","from","coefficients","(","linear","models",")","or","from","feature","importance","scores","(","decision","tree-based","models",")",".","If","None",",","then","a","GradientBoostingRegressor","(","max_depth=5",")","is","used",".","The","regressor","can","also","be","a","sklearn.Pipeline","(",")",".","test_size",":","int","or","float",",","optional",",","default=None","Used","to","do","an","internal","temporal_train_test_split","(",")",".","The","test_size","data","will","be","the","endog","data","of","the","regressor","and","it","is","the","most","recent","data",".","The","exog","data","of","the","regressor","are","the","predictions","from","the","temporarily","trained","ensemble","models",".","If","None",",","it","will","be","set","to","0.25.","random_state",":","int",",","RandomState","instance","or","None",",","default=None","Used","to","set","random_state","of","the","default","regressor",".","n_jobs",":","int","or","None",",","optional",",","default=None","The","number","of","jobs","to","run","in","parallel","for","fit",".","None","means","1","unless","in","a","joblib.parallel_backend","context",".","-1","means","using","all","processors",".","Attributes","--","--","--","--","--","regressor_",":","sklearn-like","regressor","Fitted","regressor",".","weights_",":","np.array","The","weights","based","on","either","``","regressor.feature_importances_","``","or","``","regressor.coef_","``","values",".","See","Also","--","--","--","--","EnsembleForecaster","Examples","--","--","--","--",">",">",">","from","sktime.forecasting.compose","import","AutoEnsembleForecaster",">",">",">","from","sktime.forecasting.naive","import","NaiveForecaster",">",">",">","from","sktime.forecasting.trend","import","PolynomialTrendForecaster",">",">",">","from","sktime.datasets","import","load_airline",">",">",">","y","=","load_airline","(",")",">",">",">","forecasters","=","[","...","(","``","trend","''",",","PolynomialTrendForecaster","(",")",")",",","...","(","``","naive","''",",","NaiveForecaster","(",")",")",",","...","]",">",">",">","forecaster","=","AutoEnsembleForecaster","(","forecasters=forecasters",")",">",">",">","forecaster.fit","(","y=y",",","fh=","[","1,2,3","]",")","AutoEnsembleForecaster","(","...",")",">",">",">","y_pred","=","forecaster.predict","(",")"]
docstr: Return the predicted reduction.
  
  Parameters
  ----------
  fh : int, list or np.array, optional, default=None
  X : pd.DataFrame
  
  Returns
  -------
  y_pred : pd.Series
      Aggregated predictions.
docstr_tok: ["Return","the","predicted","reduction",".","Parameters","--","--","--","--","--","fh",":","int",",","list","or","np.array",",","optional",",","default=None","X",":","pd.DataFrame","Returns","--","--","--","-","y_pred",":","pd.Series","Aggregated","predictions","."]
code: def _predict(self, fh, X):
      """Return the predicted reduction.
  
      Parameters
      ----------
      fh : int, list or np.array, optional, default=None
      X : pd.DataFrame
  
      Returns
      -------
      y_pred : pd.Series
          Aggregated predictions.
      """
      y_pred_df = pd.concat(self._predict_forecasters(fh, X), axis=1)
      # apply weights
      y_pred = y_pred_df.apply(
          lambda x: np.average(x, weights=self.weights_), axis=1
      )
      y_pred.name = self._y.name
      return y_pred
  
imports: import numpy
  import pandas
  from scipy.stats import gmean
  from sklearn.pipeline import Pipeline
  from sktime.forecasting.base import ForecastingHorizon
  from sktime.forecasting.base._meta import _HeterogenousEnsembleForecaster
  from sktime.split import temporal_train_test_split
  from sktime.utils.stats import _weighted_geometric_mean, _weighted_max, _weighted_median, _weighted_min
  from sktime.utils.validation.forecasting import check_regressor
label_desc: Use image node_id 3 for calling the AutoEnsembleForecaster obj's underlying member method code with example usage: obj._predict(fh, X) and returns: y_pred