code: def weighted_mean(X, embedding, neighbors, distances, verbose=False):
      """Initialize points onto an existing embedding by placing them in the
      weighted mean position of their nearest neighbors on the reference embedding.
  
      Parameters
      ----------
      X: np.ndarray
      embedding: TSNEEmbedding
      neighbors: np.ndarray
      distances: np.ndarray
      verbose: bool
  
      Returns
      -------
      np.ndarray
  
      """
      n_samples = X.shape[0]
      n_components = embedding.shape[1]
  
      with utils.Timer(
          "Calculating weighted-mean initialization...", verbose
      ):
          partial_embedding = np.zeros(
              (n_samples, n_components), order="C"
          )
          for i in range(n_samples):
              partial_embedding[i] = np.average(
                  embedding[neighbors[i]], axis=0, weights=distances[i]
              )
  
      return partial_embedding
  
file_path: openTSNE/openTSNE/initialization.py
imports: import numpy
  import scipy.sparse
  from sklearn.decomposition import PCA
  from sklearn.utils import check_random_state
  from openTSNE import utils
label_desc: Use image node_id 6 for calling a global function with example usage: weighted_mean(X, embedding, neighbors, distances, verbose) and returns: partial_embedding