class_docstr: Compare given model score to simple model score (according to given model type).
  
  For classification models, the simple model is a dummy classifier the selects the predictions based on a strategy.
  
  
  Parameters
  ----------
  strategy : str, default='prior'
      Strategy to use to generate the predictions of the simple model.
  
      * 'most_frequent' : The most frequent label in the training set is predicted.
        The probability vector is 1 for the most frequent label and 0 for the other predictions.
      * 'prior' : The probability vector always contains the empirical class prior distribution (i.e. the class
        distribution observed in the training set).
      * 'stratified' : The predictions are generated by sampling one-hot vectors from a multinomial distribution
        parametrized by the empirical class prior probabilities.
      * 'uniform' : Generates predictions uniformly at random from the list of unique classes observed in y,
        i.e. each class has equal probability. The predicted class is chosen randomly.
  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: ["Compare","given","model","score","to","simple","model","score","(","according","to","given","model","type",")",".","For","classification","models",",","the","simple","model","is","a","dummy","classifier","the","selects","the","predictions","based","on","a","strategy",".","Parameters","--","--","--","--","--","strategy",":","str",",","default='prior'","Strategy","to","use","to","generate","the","predictions","of","the","simple","model",".","*","'most_frequent","'",":","The","most","frequent","label","in","the","training","set","is","predicted",".","The","probability","vector","is","1","for","the","most","frequent","label","and","0","for","the","other","predictions",".","*","'prior","'",":","The","probability","vector","always","contains","the","empirical","class","prior","distribution","(","i.e",".","the","class","distribution","observed","in","the","training","set",")",".","*","'stratified","'",":","The","predictions","are","generated","by","sampling","one-hot","vectors","from","a","multinomial","distribution","parametrized","by","the","empirical","class","prior","probabilities",".","*","'uniform","'",":","Generates","predictions","uniformly","at","random","from","the","list","of","unique","classes","observed","in","y",",","i.e",".","each","class","has","equal","probability",".","The","predicted","class","is","chosen","randomly",".","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","}"]
docstr: Update the metrics for the check.
docstr_tok: ["Update","the","metrics","for","the","check","."]
code: def update(
      self,
      context: Context,
      batch: BatchWrapper,
      dataset_kind: DatasetKind,
  ):
      """Update the metrics for the check."""
      if (
          dataset_kind == DatasetKind.TEST
          and context.train.task_type == TaskType.CLASSIFICATION
      ):
          label = batch.numpy_labels
          prediction = batch.numpy_predictions
          for _, metric in self._test_scorers.items():
              metric.update((prediction, label))
  
          # calculating perfect scores
          perfect_predictions = np.zeros(
              (len(label), len(prediction[0]))
          )
          perfect_predictions[np.arange(len(label)), label] = 1
          perfect_predictions = list(perfect_predictions)
          for _, metric in self._perfect_scorers.items():
              metric.update((perfect_predictions, label))
  
imports: from typing import Any, Callable, Dict, Hashable, List, Optional, Union
  import numpy
  import pandas
  import plotly.express
  from deepchecks.core import CheckResult, ConditionCategory, ConditionResult, DatasetKind
  from deepchecks.core.errors import DeepchecksValueError
  from deepchecks.utils import plot
  from deepchecks.utils.metrics import get_gain
  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 import CustomClassificationScorer, get_scorers_dict, metric_results_to_df
  from deepchecks.vision.metrics_utils.scorers import filter_classes_for_display
  from deepchecks.vision.vision_data import TaskType, VisionData
  from deepchecks.vision.vision_data.batch_wrapper import BatchWrapper
label_desc: Use image node_id 3 for calling the SimpleModelComparison obj's underlying member method code with example usage: obj.update(context, batch, dataset_kind) without return types