code: def weighted_mean(X, embedding, neighbors, distances):
      
      n_samples = X.shape[0]
      n_components = embedding.shape[1]
  
      partial_embedding = np.zeros((n_samples, n_components))
      for i in range(n_samples):
          partial_embedding[i] = np.average(
              embedding[neighbors[i]], axis=0, weights=distances[i],
          )
  
      return partial_embedding
docs: 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
  
      Returns
      -------
      np.ndarray