'Fit\'s using kernel K'

def _fit_transform(self, K):

    K = self._centerer.fit_transform(K)
    if (self.n_components is None):
        n_components = K.shape[0]
    else:
        n_components = min(K.shape[0], self.n_components)
    if (self.eigen_solver == 'auto'):
        if ((K.shape[0] > 200) and (n_components < 10)):
            eigen_solver = 'arpack'
        else:
            eigen_solver = 'dense'
    else:
        eigen_solver = self.eigen_solver
    if (eigen_solver == 'dense'):
        (self.lambdas_, self.alphas_) = linalg.eigh(K, eigvals=((K.shape[0] - n_components), (K.shape[0] - 1)))
    elif (eigen_solver == 'arpack'):
        random_state = check_random_state(self.random_state)
        v0 = random_state.uniform((-1), 1, K.shape[0])
        (self.lambdas_, self.alphas_) = eigsh(K, n_components, which='LA', tol=self.tol, maxiter=self.max_iter, v0=v0)
    indices = self.lambdas_.argsort()[::(-1)]
    self.lambdas_ = self.lambdas_[indices]
    self.alphas_ = self.alphas_[:, indices]
    if (self.remove_zero_eig or (self.n_components is None)):
        self.alphas_ = self.alphas_[:, (self.lambdas_ > 0)]
        self.lambdas_ = self.lambdas_[(self.lambdas_ > 0)]
    return K
