code: def _knn_shapley_score(
      knn_graph: csr_matrix, labels: np.ndarray
  ) -> np.ndarray:
      """Compute the Shapley values of data points based on a knn graph."""
      N = labels.shape[0]
      scores = np.zeros((N, N))
      dist = knn_graph.indices.reshape(N, -1)
      k = dist.shape[1]
  
      for i, y in enumerate(labels):
          idx = dist[i][::-1]
          ans = labels[idx]
          scores[idx[k - 1]][i] = float(ans[k - 1] == y) / k
          cur = k - 2
          for j in range(k - 1):
              scores[idx[cur]][i] = scores[idx[cur + 1]][i] + float(
                  int(ans[cur] == y) - int(ans[cur + 1] == y)
              ) / k * (min(cur, k - 1) + 1) / (cur + 1)
              cur -= 1
      return 0.5 * (np.mean(scores, axis=1) + 1)
  
file_path: cleanlab/cleanlab/datalab/internal/issue_manager/data_valuation.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union
  import numpy
  import pandas
  from scipy.sparse import csr_matrix
  from cleanlab.datalab.internal.issue_manager import IssueManager
label_desc: Use image node_id 1 for calling a global function with example usage: _knn_shapley_score(knn_graph, labels) and returns: unknown