class_docstr: Calculate the ROC curve for each class.
  
  For each class, plots the ROC curve for a one vs all classification of that class based on the model's
  predicted probabilities. In addition, for each class, it marks the optimal probability threshold cut-off point
  based on Youden's index defined as sensitivity + specificity - 1.
  See https://en.wikipedia.org/wiki/Youden%27s_J_statistic for additional details.
  
  Parameters
  ----------
  excluded_classes : List , default: None
      List of classes to exclude from the calculation. If None, calculate one vs all ROC curve for all classes for
      multiclass and only the positive class for binary classification. If an empty list was provided,
      calculate for all classes.
  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.
  
  References
  ----------
  Ewald, B. (2006). Post hoc choice of cut points introduced bias to diagnostic research.
  Journal of clinical epidemiology, 59(8), 798-801.
  
  Steyerberg, E.W., Van Calster, B., & Pencina, M.J. (2011). Performance measures for
  prediction models and markers: evaluation of predictions and classifications.
  Revista Espanola de Cardiologia (English Edition), 64(9), 788-794.
  
  Jiménez-Valverde, A., & Lobo, J.M. (2007). Threshold criteria for conversion of probability
  of species presence to either–or presence–absence. Acta oecologica, 31(3), 361-369.
class_docstr_tok: ["Calculate","the","ROC","curve","for","each","class",".","For","each","class",",","plots","the","ROC","curve","for","a","one","vs","all","classification","of","that","class","based","on","the","model's","predicted","probabilities",".","In","addition",",","for","each","class",",","it","marks","the","optimal","probability","threshold","cut-off","point","based","on","Youden","'s","index","defined","as","sensitivity","+","specificity","-","1",".","See","https",":","\/\/en.wikipedia.org\/wiki\/Youden","%","27s_J_statistic","for","additional","details",".","Parameters","--","--","--","--","--","excluded_classes",":","List",",","default",":","None","List","of","classes","to","exclude","from","the","calculation",".","If","None",",","calculate","one","vs","all","ROC","curve","for","all","classes","for","multiclass","and","only","the","positive","class","for","binary","classification",".","If","an","empty","list","was","provided",",","calculate","for","all","classes",".","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",".","References","--","--","--","--","--","Ewald",",","B",".","(","2006",")",".","Post","hoc","choice","of","cut","points","introduced","bias","to","diagnostic","research",".","Journal","of","clinical","epidemiology",",","59","(","8",")",",","798-801",".","Steyerberg",",","E.W.",",","Van","Calster",",","B.",",","&","Pencina",",","M.J.","(","2011",")",".","Performance","measures","for","prediction","models","and","markers",":","evaluation","of","predictions","and","classifications",".","Revista","Espanola","de","Cardiologia","(","English","Edition",")",",","64","(","9",")",",","788-794",".","Jim\u00e9nez-Valverde",",","A.",",","&","Lobo",",","J.M",".","(","2007",")",".","Threshold","criteria","for","conversion","of","probability","of","species","presence","to","either\u2013or","presence\u2013absence",".","Acta","oecologica",",","31","(","3",")",",","361-369","."]
docstr: Run check.
  
  Returns
  -------
  CheckResult
      value is dictionary of a class and its auc score, displays the roc graph with each class
  
  Raises
  ------
  DeepchecksValueError
      If the object is not a Dataset instance with a label
docstr_tok: ["Run","check",".","Returns","--","--","--","-","CheckResult","value","is","dictionary","of","a","class","and","its","auc","score",",","displays","the","roc","graph","with","each","class","Raises","--","--","--","DeepchecksValueError","If","the","object","is","not","a","Dataset","instance","with","a","label"]
code: def run_logic(self, context: Context, dataset_kind) -> CheckResult:
      """Run check.
  
      Returns
      -------
      CheckResult
          value is dictionary of a class and its auc score, displays the roc graph with each class
  
      Raises
      ------
      DeepchecksValueError
          If the object is not a Dataset instance with a label
      """
      dataset = context.get_data_by_kind(dataset_kind).sample(
          self.n_samples, random_state=self.random_state
      )
      context.assert_classification_task()
      if not hasattr(context.model, "predict_proba"):
          raise DeepchecksNotSupportedError(
              "Predicted probabilities not supplied. The roc report check "
              "needs the predicted probabilities to plot the ROC curve, instead"
              " of only predicted classes."
          )
  
      y_pred_prob = context.model.predict_proba(
          dataset.features_columns
      )
      dataset_classes = context.model_classes
  
      fpr = {}
      tpr = {}
      thresholds = {}
      roc_auc = {}
      for i, class_name in enumerate(dataset_classes):
          if (
              self.excluded_classes is not None
              and class_name in self.excluded_classes
          ):
              continue
          (
              fpr[class_name],
              tpr[class_name],
              thresholds[class_name],
          ) = sklearn.metrics.roc_curve(
              dataset.label_col == class_name, y_pred_prob[:, i]
          )
          roc_auc[class_name] = sklearn.metrics.auc(
              fpr[class_name], tpr[class_name]
          )
  
      if self.excluded_classes is not None:
          classes_for_display = [
              x
              for x in dataset_classes
              if x not in self.excluded_classes
          ]
      else:
          classes_for_display = (
              [dataset_classes[1]]
              if context.task_type == TaskType.BINARY
              else dataset_classes
          )
  
      if context.with_display:
          fig = go.Figure()
          for class_name in classes_for_display:
              fig.add_trace(
                  go.Scatter(
                      x=fpr[class_name],
                      y=tpr[class_name],
                      line_width=2,
                      name=f"Class {class_name} (auc = {roc_auc[class_name]:0.2f})",
                  )
              )
              fig.add_trace(
                  get_cutoff_figure(
                      tpr[class_name],
                      fpr[class_name],
                      thresholds[class_name],
                      class_name,
                  )
              )
          fig.add_trace(
              go.Scatter(
                  x=[0, 1],
                  y=[0, 1],
                  line=dict(color="#444"),
                  line_width=2,
                  line_dash="dash",
                  showlegend=False,
              )
          )
          fig.update_xaxes(title="False Positive Rate")
          fig.update_yaxes(title="True Positive Rate")
          fig.update_layout(
              title_text="Receiver Operating Characteristic Plot",
              height=500,
          )
          footnote = """The marked points are the optimal probability threshold cut-off points to predict said
              class. In plain terms, it is optimal to set the prediction rule such that if for some class the predicted
              probability is above the threshold of that class, then the prediction should be that class.
              They optimal thresholds are determined using Youden's index defined as sensitivity + specificity - 1."""
          display = [fig, footnote]
      else:
          display = None
  
      return CheckResult(
          {x: roc_auc[x] for x in classes_for_display},
          header="ROC Report",
          display=display,
      )
  
file_path: deepchecks/deepchecks/tabular/checks/model_evaluation/roc_report.py
imports: from typing import Dict, List
  import numpy
  import plotly.graph_objects
  import sklearn
  from deepchecks.core import CheckResult, ConditionResult
  from deepchecks.core.condition import ConditionCategory
  from deepchecks.core.errors import DeepchecksNotSupportedError
  from deepchecks.tabular import Context, SingleDatasetCheck
  from deepchecks.tabular.utils.task_type import TaskType
  from deepchecks.utils.dict_funcs import get_dict_entry_by_value
  from deepchecks.utils.strings import format_number
label_desc: Use image node_id 2 for calling the RocReport obj's underlying member method code with example usage: obj.run_logic(context, dataset_kind) and returns: CheckResult