code: def quadratic_kappa(y_true, y_pred):
      """Calculate the cohen kappa score with quadratic weighting scheme.
  
      This is also known as "quadratic kappa" in the Kaggle competitions
      such as petfinder: https://www.kaggle.com/c/petfinder-adoption-prediction/overview/evaluation
  
      We will also support probabilistic input to ensure that the function knows
      the number of possible classes.
  
      Parameters
      ----------
      y_true
          Shape (#samples,)
      y_pred
          Shape (#samples, #class) or (#samples,)
  
      Returns
      -------
      score
          scalar score
      """
      labels = None
      if y_pred.ndim > 1:
          if labels is not None:
              assert len(labels) == y_pred.shape[1]
          else:
              labels = np.arange(y_pred.shape[1])
          y_pred = np.argmax(y_pred, axis=-1)
      return cohen_kappa_score(
          y_true, y_pred, labels=labels, weights="quadratic"
      )
  
file_path: autogluon/core/src/autogluon/core/metrics/classification_metrics.py
imports: import logging
  from typing import Union
  import numpy
  import pandas
  import sklearn
  from scipy.sparse import coo_matrix
  from sklearn.metrics import cohen_kappa_score
  from sklearn.utils import check_consistent_length
  from sklearn.utils.multiclass import unique_labels
label_desc: Use image node_id 4 for calling a global function with example usage: quadratic_kappa(y_true, y_pred) and returns: cohen_kappa_score