code: def partition_tree(X, metric="correlation"):
      X_full_rank = X + np.random.randn(*X.shape) * 1e-8
      D = scipy.spatial.distance.pdist(
          X_full_rank.fillna(X_full_rank.mean()).T, metric=metric
      )
      return scipy.cluster.hierarchy.complete(D)
  
file_path: shap/shap/utils/_clustering.py
imports: import warnings
  import numpy
  import pandas
  import scipy.cluster
  import scipy.spatial
  import sklearn
  from numba import njit
  from ._show_progress import show_progress
label_desc: Use image node_id 1 for calling a global function with example usage: partition_tree(X, metric) and returns: scipy