'Fit estimator to data.
Samples a subset of training points, computes kernel
on these and computes normalization matrix.
Parameters
X : array-like, shape=(n_samples, n_feature)
Training data.'

def fit(self, X, y=None):

    X = check_array(X, accept_sparse='csr')
    rnd = check_random_state(self.random_state)
    n_samples = X.shape[0]
    if (self.n_components > n_samples):
        n_components = n_samples
        warnings.warn('n_components    >    n_samples.    This    is    not    possible.\nn_components    was    set    to    n_samples,    which    results    in    inefficient    evaluation    of    the    full    kernel.')
    else:
        n_components = self.n_components
    n_components = min(n_samples, n_components)
    inds = rnd.permutation(n_samples)
    basis_inds = inds[:n_components]
    basis = X[basis_inds]
    basis_kernel = pairwise_kernels(basis, metric=self.kernel, filter_params=True, **self._get_kernel_params())
    (U, S, V) = svd(basis_kernel)
    S = np.maximum(S, 1e-12)
    self.normalization_ = np.dot((U / np.sqrt(S)), V)
    self.components_ = basis
    self.component_indices_ = inds
    return self
