code: def consistency_score(X, y, n_neighbors=5):
      r"""Compute the consistency score.
  
      Individual fairness metric from [#zemel13]_ that measures how similar the
      labels are for similar instances.
  
      .. math::
          1 - \frac{1}{n}\sum_{i=1}^n |\hat{y}_i -
          \frac{1}{\text{n_neighbors}} \sum_{j\in\mathcal{N}_{\text{n_neighbors}}(x_i)} \hat{y}_j|
  
      Args:
          X (array-like): Sample features.
          y (array-like): Sample targets.
          n_neighbors (int, optional): Number of neighbors for the knn
              computation.
  
      References:
          .. [#zemel13] `R. Zemel, Y. Wu, K. Swersky, T. Pitassi, and C. Dwork,
             "Learning Fair Representations," International Conference on Machine
             Learning, 2013. <http://proceedings.mlr.press/v28/zemel13.html>`_
      """
      # cast as ndarrays
      X, y = check_X_y(X, y)
      # learn a KNN on the features
      nbrs = NearestNeighbors(
          n_neighbors=n_neighbors, algorithm="ball_tree"
      )
      nbrs.fit(X)
      indices = nbrs.kneighbors(X, return_distance=False)
  
      # compute consistency score
      return 1 - abs(y - y[indices].mean(axis=1)).mean()
  
imports: from itertools import permutations
  from typing import Union
  import warnings
  import numpy
  import pandas
  from scipy.special import rel_entr
  from sklearn.metrics import make_scorer, recall_score, precision_score
  from sklearn.metrics import multilabel_confusion_matrix
  from sklearn.metrics._classification import _prf_divide, _check_zero_division
  from sklearn.neighbors import NearestNeighbors
  from sklearn.utils import check_X_y
  from aif360.metrics import ot_metric
  from aif360.sklearn.utils import check_inputs, check_groups
  from aif360.detectors.mdss.ScoringFunctions import BerkJones, Bernoulli
  from aif360.detectors.mdss.MDSS import MDSS
label_desc: Use image node_id 34 for calling a global function with example usage: consistency_score(X, y, n_neighbors) and returns: unknown