class_docstr: A default model selection implementation.
  
  .. versionadded:: 1.1.0
docstr: Parameters
  ----------
  select_by : str or list of str
      Metric or list of metrics. Takes precedence over `self.default_select_by` if not None.
      In case a list is given, the model selection starts with the first metric and
      switches to the next one in case of a tie.
  
  Returns
  -------
  model_selection_result : ModelSelectionResult or None
      A model selection result object which contains the data of the selected model
      or None if no model could be selected.
docstr_tok: ["Parameters","--","--","--","--","--","select_by",":","str","or","list","of","str","Metric","or","list","of","metrics",".","Takes","precedence","over","`","self.default_select_by","`","if","not","None",".","In","case","a","list","is","given",",","the","model","selection","starts","with","the","first","metric","and","switches","to","the","next","one","in","case","of","a","tie",".","Returns","--","--","--","-","model_selection_result",":","ModelSelectionResult","or","None","A","model","selection","result","object","which","contains","the","data","of","the","selected","model","or","None","if","no","model","could","be","selected","."]
code: def select(self, select_by=None):
      """
      Parameters
      ----------
      select_by : str or list of str
          Metric or list of metrics. Takes precedence over `self.default_select_by` if not None.
          In case a list is given, the model selection starts with the first metric and
          switches to the next one in case of a tie.
  
      Returns
      -------
      model_selection_result : ModelSelectionResult or None
          A model selection result object which contains the data of the selected model
          or None if no model could be selected.
      """
      if select_by is not None:
          if isinstance(select_by, str):
              select_by = [select_by]
      else:
          select_by = self.default_select_by
  
      # valid rows are rows where no early stopping has been triggered
      valid_rows = np.not_equal(
          self.models[ModelSelection.FIELD_NAME_EARLY_STOPPING], True
      )
      if not np.any(valid_rows):  # checks if we have no valid rows
          return None
  
      rows = self.models[valid_rows]
  
      metrics_dict = {metric.name: metric for metric in self.metrics}
      tuples = tuple(
          rows[key] if metrics_dict[key].lower_is_better else -rows[key]
          for key in reversed(select_by)
      )
      indices = np.lexsort(tuples)
  
      model_id = rows["model_id"][indices[0]]
      model_path = rows["model_path"][indices[0]]
  
      measured_values = {
          metric.name: rows[metric.name][indices[0]]
          for metric in self.metrics
      }
      fields = {
          key: rows[key][indices[0]] for key in self._fields_config
      }
  
      return ModelSelectionResult(
          model_id, model_path, measured_values, fields=fields
      )
  
imports: import numpy
  from abc import ABC
  from small_text.training.metrics import Metric
label_desc: Use image node_id 5 for calling the ModelSelection obj's underlying member method code with example usage: obj.select(select_by) and returns: ModelSelectionResult, None