class_docstr: Summarize given metrics on a dataset and model.
  
  Parameters
  ----------
  scorers: Union[Dict[str, Union[Callable, str]], List[Any]] , default: None
      Scorers to override the default scorers (metrics), find more about the supported formats at
      https://docs.deepchecks.com/stable/user-guide/general/metrics_guide.html
  n_to_show : int, default: 20
      Number of classes to show in the report. If None, show all classes.
  show_only : str, default: 'largest'
      Specify which classes to show in the report. Can be one of the following:
      - 'largest': Show the largest classes.
      - 'smallest': Show the smallest classes.
      - 'random': Show random classes.
      - 'best': Show the classes with the highest score.
      - 'worst': Show the classes with the lowest score.
  metric_to_show_by : str, default: None
      Specify the metric to sort the results by. Relevant only when show_only is 'best' or 'worst'.
      If None, sorting by the first metric in the default metrics list.
  class_list_to_show: List[int], default: None
      Specify the list of classes to show in the report. If specified, n_to_show, show_only and metric_to_show_by
      are ignored.
  {additional_check_init_params:2*indent}
class_docstr_tok: ["Summarize","given","metrics","on","a","dataset","and","model",".","Parameters","--","--","--","--","--","scorers",":","Union","[","Dict","[","str",",","Union","[","Callable",",","str","]","]",",","List","[","Any","]","]",",","default",":","None","Scorers","to","override","the","default","scorers","(","metrics",")",",","find","more","about","the","supported","formats","at","https",":","\/\/docs.deepchecks.com\/stable\/user-guide\/general\/metrics_guide.html","n_to_show",":","int",",","default",":","20","Number","of","classes","to","show","in","the","report",".","If","None",",","show","all","classes",".","show_only",":","str",",","default",":","'largest'","Specify","which","classes","to","show","in","the","report",".","Can","be","one","of","the","following",":","-","'largest","'",":","Show","the","largest","classes",".","-","'smallest","'",":","Show","the","smallest","classes",".","-","'random","'",":","Show","random","classes",".","-","'best","'",":","Show","the","classes","with","the","highest","score",".","-","'worst","'",":","Show","the","classes","with","the","lowest","score",".","metric_to_show_by",":","str",",","default",":","None","Specify","the","metric","to","sort","the","results","by",".","Relevant","only","when","show_only","is","'best","'","or","'worst","'",".","If","None",",","sorting","by","the","first","metric","in","the","default","metrics","list",".","class_list_to_show",":","List","[","int","]",",","default",":","None","Specify","the","list","of","classes","to","show","in","the","report",".","If","specified",",","n_to_show",",","show_only","and","metric_to_show_by","are","ignored",".","{","additional_check_init_params:2","*","indent","}"]
code: def __init__(
      self,
      scorers: Union[Dict[str, Union[Callable, str]], List[Any]] = None,
      n_to_show: int = 20,
      show_only: str = "largest",
      metric_to_show_by: str = None,
      class_list_to_show: List[int] = None,
      n_samples: Optional[int] = 10000,
      **kwargs,
  ):
      super().__init__(**kwargs)
      self.n_samples = n_samples
      self.scorers = scorers
      self.n_to_show = n_to_show
      self.class_list_to_show = class_list_to_show  # TODO: change to also effect the result not just display
  
      if self.class_list_to_show is None:
          if show_only not in [
              "largest",
              "smallest",
              "random",
              "best",
              "worst",
          ]:
              raise DeepchecksValueError(
                  f"Invalid value for show_only: {show_only}. Should be one of: "
                  f'["largest", "smallest", "random", "best", "worst"]'
              )
  
          self.show_only = show_only
          if (
              self.scorers is not None
              and show_only in ["best", "worst"]
              and metric_to_show_by is None
          ):
              raise DeepchecksValueError(
                  "When scorers are provided and show_only is one of: "
                  '["best", "worst"], metric_to_show_by must be specified.'
              )
  
      self.metric_to_show_by = metric_to_show_by
      self._data_metrics = {}
  
imports: from typing import Any, Callable, Dict, List, Optional, TypeVar, Union
  import pandas
  import plotly.express
  from deepchecks.core import CheckResult, DatasetKind
  from deepchecks.core.check_utils.class_performance_utils import get_condition_class_performance_imbalance_ratio_less_than, get_condition_test_performance_greater_than, get_condition_train_test_relative_degradation_less_than
  from deepchecks.core.errors import DeepchecksValueError
  from deepchecks.utils import plot
  from deepchecks.utils.strings import format_percent
  from deepchecks.vision._shared_docs import docstrings
  from deepchecks.vision.base_checks import TrainTestCheck
  from deepchecks.vision.context import Context
  from deepchecks.vision.metrics_utils.scorers import filter_classes_for_display, get_scorers_dict, metric_results_to_df
  from deepchecks.vision.vision_data.batch_wrapper import BatchWrapper
label_desc: Use image node_id 1 to create a new ClassPerformance object from inherited base classes: TrainTestCheck with example: obj = ClassPerformance(scorers, n_to_show, show_only, metric_to_show_by, class_list_to_show, n_samples)