code: def trustworthiness(X, X_embedded, n_neighbors=5, precomputed=False):
      """Expresses to what extent the local structure is retained.
  
      The trustworthiness is within [0, 1]. It is defined as
  
      .. math::
  
          T(k) = 1 - \frac{2}{nk (2n - 3k - 1)} \sum^n_{i=1}
              \sum_{j \in U^{(k)}_i (r(i, j) - k)}
  
      where :math:`r(i, j)` is the rank of the embedded datapoint j
      according to the pairwise distances between the embedded datapoints,
      :math:`U^{(k)}_i` is the set of points that are in the k nearest
      neighbors in the embedded space but not in the original space.
  
      * "Neighborhood Preservation in Nonlinear Projection Methods: An
        Experimental Study"
        J. Venna, S. Kaski
      * "Learning a Parametric Embedding by Preserving Local Structure"
        L.J.P. van der Maaten
  
      Parameters
      ----------
      X : array, shape (n_samples, n_features) or (n_samples, n_samples)
          If the metric is 'precomputed' X must be a square distance
          matrix. Otherwise it contains a sample per row.
  
      X_embedded : array, shape (n_samples, n_components)
          Embedding of the training data in low-dimensional space.
  
      n_neighbors : int, optional (default: 5)
          Number of neighbors k that will be considered.
  
      precomputed : bool, optional (default: False)
          Set this flag if X is a precomputed square distance matrix.
  
      Returns
      -------
      trustworthiness : float
          Trustworthiness of the low-dimensional embedding.
      """
      if precomputed:
          dist_X = X
      else:
          dist_X = pairwise_distances(X, squared=True)
      dist_X_embedded = pairwise_distances(X_embedded, squared=True)
      ind_X = np.argsort(dist_X, axis=1)
      ind_X_embedded = np.argsort(dist_X_embedded, axis=1)[
          :, 1 : n_neighbors + 1
      ]
  
      n_samples = X.shape[0]
      t = 0.0
      ranks = np.zeros(n_neighbors)
      for i in range(n_samples):
          for j in range(n_neighbors):
              ranks[j] = np.where(ind_X[i] == ind_X_embedded[i, j])[0][
                  0
              ]
          ranks -= n_neighbors
          t += np.sum(ranks[ranks > 0])
      t = 1.0 - t * (
          2.0
          / (
              n_samples
              * n_neighbors
              * (2.0 * n_samples - 3.0 * n_neighbors - 1.0)
          )
      )
      return t
  
imports: import numpy
  from scipy import linalg
  import scipy.sparse
  from scipy.spatial.distance import pdist
  from scipy.spatial.distance import squareform
  from ..neighbors import BallTree
  from ..base import BaseEstimator
  from ..utils import check_array
  from ..utils import check_random_state
  from ..utils.extmath import _ravel
  from ..decomposition import PCA
  from ..metrics.pairwise import pairwise_distances
  from .None import _utils
  from .None import _barnes_hut_tsne
  from ..utils.fixes import astype
  from ..externals.six import string_types
label_desc: Use image node_id 7 for calling a global function with example usage: trustworthiness(X, X_embedded, n_neighbors, precomputed) and returns: t