def transform(self, X):
        """ Apply the non-linear transformation on X.

        Parameters
        ----------
        X : {array-like, sparse matrix}, shape = [n_samples, n_features]
            Training vectors, where n_samples is the number of samples and
            n_features is the number of features.

        Returns
        -------
        X_projected : np.ndarray, shape = [n_samples, n_components]
            Projected training vectors.

        """
        if not hasattr(self, 'X_'):
            raise AttributeError('Object as not been fitted, yet.')
        self._check_arrays(X=X)
        # pair_dist = np.array([np.sum((X - row)**2) for row in self.X_])
        pair_dist = np.ones((self.X_.shape[0], X.shape[0]))
        for idx in range(X.shape[0]):
            pair_dist[:, idx] = ((self.X_ - X[idx])**2).sum(axis=1)

        K = np.exp((-1) * self.gamma * pair_dist)
        e_vecs = self._projection_matrix(eig_vecs=self.e_vecs_,
                                         n_components=self.n_components)
        return K.T.dot(e_vecs / self.e_vals_[:e_vecs.shape[1]])
dataset/ETHPy150Open rasbt/mlxtend/mlxtend/feature_extraction/rbf_kernel_pca.py/RBFKernelPCA.transform/original