class_docstr: Summarize performance scores for multiple models on test datasets.
  
  Parameters
  ----------
  scorers: Union[Mapping[str, Union[str, Callable]], List[str]], default: None
      Scorers to override the default scorers, find more about the supported formats at
      https://docs.deepchecks.com/stable/user-guide/general/metrics_guide.html
  alternative_scorers : Dict[str, Callable] , default: None
      Deprecated, please use scorers instead.
  n_samples : int , default: 1_000_000
      number of samples to use for this check.
  random_state : int, default: 42
      random seed for all check internals.
class_docstr_tok: ["Summarize","performance","scores","for","multiple","models","on","test","datasets",".","Parameters","--","--","--","--","--","scorers",":","Union","[","Mapping","[","str",",","Union","[","str",",","Callable","]","]",",","List","[","str","]","]",",","default",":","None","Scorers","to","override","the","default","scorers",",","find","more","about","the","supported","formats","at","https",":","\/\/docs.deepchecks.com\/stable\/user-guide\/general\/metrics_guide.html","alternative_scorers",":","Dict","[","str",",","Callable","]",",","default",":","None","Deprecated",",","please","use","scorers","instead",".","n_samples",":","int",",","default",":","1_000_000","number","of","samples","to","use","for","this","check",".","random_state",":","int",",","default",":","42","random","seed","for","all","check","internals","."]
docstr: Run check logic.
docstr_tok: ["Run","check","logic","."]
code: def run_logic(self, multi_context: ModelComparisonContext):
      """Run check logic."""
      first_context = multi_context[0]
      scorers = first_context.get_scorers(
          self.alternative_scorers, use_avg_defaults=False
      )
  
      if multi_context.task_type in [
          TaskType.MULTICLASS,
          TaskType.BINARY,
      ]:
          plot_x_axis = ["Class", "Model"]
          results = []
  
          for context, model_name in zip(
              multi_context, multi_context.models.keys()
          ):
              test = context.test.sample(
                  self.n_samples, random_state=self.random_state
              )
              model = context.model
              label = cast(pd.Series, test.label_col)
              n_samples = label.groupby(label).count()
              results.extend(
                  [
                      model_name,
                      class_score,
                      scorer.name,
                      class_name,
                      n_samples[class_name],
                  ]
                  for scorer in scorers
                  # scorer returns numpy array of results with item per class
                  for class_score, class_name in zip(
                      scorer(model, test), context.model_classes
                  )
              )
  
          results_df = pd.DataFrame(
              results,
              columns=[
                  "Model",
                  "Value",
                  "Metric",
                  "Class",
                  "Number of samples",
              ],
          )
  
      else:
          plot_x_axis = "Model"
          results = [
              [
                  model_name,
                  scorer(context.model, context.test),
                  scorer.name,
                  cast(pd.Series, context.test.label_col).count(),
              ]
              for context, model_name in zip(
                  multi_context, multi_context.models.keys()
              )
              for scorer in scorers
          ]
          results_df = pd.DataFrame(
              results,
              columns=["Model", "Value", "Metric", "Number of samples"],
          )
  
      fig = px.histogram(
          results_df,
          x=plot_x_axis,
          y="Value",
          color="Model",
          barmode="group",
          facet_col="Metric",
          facet_col_spacing=0.05,
          hover_data=["Number of samples"],
      )
  
      if multi_context.task_type in [
          TaskType.MULTICLASS,
          TaskType.BINARY,
      ]:
          fig.update_xaxes(
              title=None, tickprefix="Class ", tickangle=60
          )
      else:
          fig.update_xaxes(title=None)
  
      fig = (
          fig.update_yaxes(title=None, matches=None)
          .for_each_annotation(
              lambda a: a.update(text=a.text.split("=")[-1])
          )
          .for_each_yaxis(
              lambda yaxis: yaxis.update(showticklabels=True)
          )
      )
  
      return CheckResult(results_df, display=[fig])
  
file_path: deepchecks/deepchecks/tabular/checks/model_evaluation/multi_model_performance_report.py
imports: import warnings
  from typing import TYPE_CHECKING, Callable, Dict, List, Mapping, Union, cast
  import pandas
  import plotly.express
  from deepchecks.core import CheckResult
  from deepchecks.tabular import ModelComparisonCheck, ModelComparisonContext
  from deepchecks.tabular.utils.task_type import TaskType
  from deepchecks.utils.docref import doclink
label_desc: Use image node_id 2 for calling the MultiModelPerformanceReport obj's underlying member method code with example usage: obj.run_logic(multi_context) and returns: CheckResult