class_docstr: The nonparametric surrogate predicts a model's performance on a new dataset
  as the average performance across all known datasets.
  
  Performances are either predicted as ranks or actual values.
class_docstr_tok: ["The","nonparametric","surrogate","predicts","a","model","'s","performance","on","a","new","dataset","as","the","average","performance","across","all","known","datasets",".","Performances","are","either","predicted","as","ranks","or","actual","values","."]
code: def _fit(
      self, X: List[Config[ModelConfig]], y: npt.NDArray[np.float32]
  ) -> None:
      # For each model configuration, we store all performances, sorted by dataset
      performances = defaultdict(list)
      datasets = set()
      for xx, yy in zip(X, y):
          datasets.add(xx.dataset)
          performances[xx.model].append(
              {"performance": yy, "dataset": xx.dataset}
          )
  
      # Then, we assign the model performances and dataset features
      self.model_performances_ = {
          model: np.stack(
              [
                  p["performance"]
                  for p in sorted(
                      data,
                      key=lambda x: x["dataset"].name(),  # type: ignore
                  )
              ]
          )
          for model, data in performances.items()
      }
  
      # We use the seasonal naive model config here since it is ignored anyway
      if self.use_dataset_features:
          self.dataset_features_ = self.config_transformer.fit_transform(
              [
                  Config(SeasonalNaiveModelConfig(), d)
                  for d in sorted(datasets, key=lambda x: x.name())  # type: ignore
              ]
          )
  
file_path: gluonts/src/gluonts/nursery/tsbench/src/tsbench/surrogate/nonparametric.py
imports: from collections import defaultdict
  from typing import Dict, List, Optional
  import numpy
  import numpy.typing
  from sklearn.metrics.pairwise import euclidean_distances
  from tsbench.config import Config, ModelConfig
  from tsbench.config.model.models import SeasonalNaiveModelConfig
  from tsbench.evaluations.tracking import ModelTracker
  from ._base import DatasetFeaturesMixin, OutputNormalization, Surrogate
  from ._factory import register_surrogate
  from .transformers import ConfigTransformer
label_desc: Use image node_id 2 for calling the NonparametricSurrogate obj's underlying member method code with example usage: obj._fit(X, y) without return types