code: def _embedding_kernel_pca(matrix, dimensions=3, affinity_matrix=None,
                            sigma=1):
      
      if affinity_matrix is None:
          aff = rbf(matrix, sigma)
      else:
          aff = affinity_matrix
      kpca = sklearn.decomposition.KernelPCA(kernel='precomputed',
                                             n_components=dimensions)
      return kpca.fit_transform(aff)
docs: Private method to calculate KPCA embedding
      :param dimensions: (int)
      :return: coordinate matrix (np.array)