code: def cohen_kappa_score(
      y1, y2, *, labels=None, weights=None, sample_weight=None
  ):
      r"""Compute Cohen's kappa: a statistic that measures inter-annotator agreement.
  
      This function computes Cohen's kappa [1]_, a score that expresses the level
      of agreement between two annotators on a classification problem. It is
      defined as
  
      .. math::
          \kappa = (p_o - p_e) / (1 - p_e)
  
      where :math:`p_o` is the empirical probability of agreement on the label
      assigned to any sample (the observed agreement ratio), and :math:`p_e` is
      the expected agreement when both annotators assign labels randomly.
      :math:`p_e` is estimated using a per-annotator empirical prior over the
      class labels [2]_.
  
      Read more in the :ref:`User Guide <cohen_kappa>`.
  
      Parameters
      ----------
      y1 : array-like of shape (n_samples,)
          Labels assigned by the first annotator.
  
      y2 : array-like of shape (n_samples,)
          Labels assigned by the second annotator. The kappa statistic is
          symmetric, so swapping ``y1`` and ``y2`` doesn't change the value.
  
      labels : array-like of shape (n_classes,), default=None
          List of labels to index the matrix. This may be used to select a
          subset of labels. If `None`, all labels that appear at least once in
          ``y1`` or ``y2`` are used.
  
      weights : {'linear', 'quadratic'}, default=None
          Weighting type to calculate the score. `None` means no weighted;
          "linear" means linear weighted; "quadratic" means quadratic weighted.
  
      sample_weight : array-like of shape (n_samples,), default=None
          Sample weights.
  
      Returns
      -------
      kappa : float
          The kappa statistic, which is a number between -1 and 1. The maximum
          value means complete agreement; zero or lower means chance agreement.
  
      References
      ----------
      .. [1] :doi:`J. Cohen (1960). "A coefficient of agreement for nominal scales".
             Educational and Psychological Measurement 20(1):37-46.
             <10.1177/001316446002000104>`
      .. [2] `R. Artstein and M. Poesio (2008). "Inter-coder agreement for
             computational linguistics". Computational Linguistics 34(4):555-596
             <https://www.mitpressjournals.org/doi/pdf/10.1162/coli.07-034-R2>`_.
      .. [3] `Wikipedia entry for the Cohen's kappa
              <https://en.wikipedia.org/wiki/Cohen%27s_kappa>`_.
  
      Examples
      --------
      >>> from sklearn.metrics import cohen_kappa_score
      >>> y1 = ["negative", "positive", "negative", "neutral", "positive"]
      >>> y2 = ["negative", "positive", "negative", "neutral", "negative"]
      >>> cohen_kappa_score(y1, y2)
      0.6875
      """
      confusion = confusion_matrix(
          y1, y2, labels=labels, sample_weight=sample_weight
      )
      n_classes = confusion.shape[0]
      sum0 = np.sum(confusion, axis=0)
      sum1 = np.sum(confusion, axis=1)
      expected = np.outer(sum0, sum1) / np.sum(sum0)
  
      if weights is None:
          w_mat = np.ones([n_classes, n_classes], dtype=int)
          w_mat.flat[:: n_classes + 1] = 0
      else:  # "linear" or "quadratic"
          w_mat = np.zeros([n_classes, n_classes], dtype=int)
          w_mat += np.arange(n_classes)
          if weights == "linear":
              w_mat = np.abs(w_mat - w_mat.T)
          else:
              w_mat = (w_mat - w_mat.T) ** 2
  
      k = np.sum(w_mat * confusion) / np.sum(w_mat * expected)
      return 1 - k
  
imports: import warnings
  from numbers import Integral, Real
  import numpy
  from scipy.sparse import coo_matrix, csr_matrix
  from scipy.special import xlogy
  from ..exceptions import UndefinedMetricWarning
  from ..preprocessing import LabelBinarizer, LabelEncoder
  from ..utils import assert_all_finite, check_array, check_consistent_length, column_or_1d
  from ..utils._array_api import _union1d, _weighted_sum, get_namespace
  from ..utils._param_validation import Interval, Options, StrOptions, validate_params
  from ..utils.extmath import _nanaverage
  from ..utils.multiclass import type_of_target, unique_labels
  from ..utils.sparsefuncs import count_nonzero
  from ..utils.validation import _check_pos_label_consistency, _num_samples
label_desc: Use image node_id 6 for calling a global function with example usage: cohen_kappa_score(y1, y2) and returns: unknown