class_docstr: A recommender uses a surrogate to recommend models and their configurations
  based on desired target metrics.
  
  This class implements the general interface.
docstr: This method takes a dataset and a set of constraints and outputs a set
  of recommendations. The recommendations provide both the configurations
  of the recommended model as well as the expected performance.
  
  Args:
      dataset: The configuration of the dataset for which to recommend a model.
      candidates: A list of model configurations that are allowed to be recommended. If
          `None`, any model configuration is permitted.
      max_count: The maximum number of models to recommend.
  
  Returns:
      The recommendations which (approximately) satisfy the provided constraints.
docstr_tok: ["This","method","takes","a","dataset","and","a","set","of","constraints","and","outputs","a","set","of","recommendations",".","The","recommendations","provide","both","the","configurations","of","the","recommended","model","as","well","as","the","expected","performance",".","Args",":","dataset",":","The","configuration","of","the","dataset","for","which","to","recommend","a","model",".","candidates",":","A","list","of","model","configurations","that","are","allowed","to","be","recommended",".","If","`","None","`",",","any","model","configuration","is","permitted",".","max_count",":","The","maximum","number","of","models","to","recommend",".","Returns",":","The","recommendations","which","(","approximately",")","satisfy","the","provided","constraints","."]
code: def recommend(
      self,
      dataset: DatasetConfig,
      candidates: Optional[List[T]] = None,
      max_count: int = 10,
  ) -> List[Recommendation[T]]:
      """
      This method takes a dataset and a set of constraints and outputs a set
      of recommendations. The recommendations provide both the configurations
      of the recommended model as well as the expected performance.
  
      Args:
          dataset: The configuration of the dataset for which to recommend a model.
          candidates: A list of model configurations that are allowed to be recommended. If
              `None`, any model configuration is permitted.
          max_count: The maximum number of models to recommend.
  
      Returns:
          The recommendations which (approximately) satisfy the provided constraints.
      """
      model_configs = self.generator.generate(candidates)
      configs = [Config(m, dataset) for m in model_configs]
      performances = self._get_performances(configs)
  
      # We construct a data frame, extracting the performance metrics to minimize.
      # Then, we invert the performance metrics for the metrics to maximize.
      df = Performance.to_dataframe(performances)[self.objectives]
  
      # Then, we perform a nondominated sort
      argsort = argsort_nondominated(
          df.to_numpy(),  # type: ignore
          dim=df.columns.tolist().index(self.focus)
          if self.focus is not None
          else None,
          max_items=max_count,
      )
  
      # And get the recommendations
      result = []
      for choice in cast(List[int], argsort):
          config = configs[choice]
          recommendation = Recommendation(
              config.model, performances[choice]
          )
          result.append(recommendation)
  
      return result
  
file_path: gluonts/src/gluonts/nursery/tsbench/src/tsbench/recommender/_base.py
imports: from abc import ABC
  from typing import cast, Generic, List, Optional, TypeVar
  from tsbench.config import Config, DatasetConfig, EnsembleConfig, ModelConfig
  from tsbench.evaluations.metrics import Performance
  from ._recommendation import Recommendation
  from .generator import CandidateGenerator, ReplayCandidateGenerator
  from .utils import argsort_nondominated
label_desc: Use image node_id 5 for calling the Recommender obj's underlying member method code with example usage: obj.recommend(dataset, candidates, max_count) and returns: result