def fit(self, X):
        """ Fit the PCA model with 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
        -------
        self : object

        """
        self._check_arrays(X=X)
        if self.n_components is None or self.n_components > X.shape[1]:
            n_components = X.shape[1]
        else:
            n_components = self.n_components
        kernel_mat = self._kernel_matrix(X=X, gamma=self.gamma)
        self.e_vals_, self.e_vecs_ = self._eigendecom(kernel_mat)
        self.X_projected_ = self._projection_matrix(eig_vecs=self.e_vecs_,
                                                    n_components=n_components)
        if self.copy_X:
            self.X_ = X.copy()
        else:
            self.X_ = X
        return self
dataset/ETHPy150Open rasbt/mlxtend/mlxtend/feature_extraction/rbf_kernel_pca.py/RBFKernelPCA.fit/original