class_docstr: Kernel Principal component analysis (KPCA)
  
  Non-linear dimensionality reduction through the use of kernels (see
  :ref:`metrics`).
  
  Read more in the :ref:`User Guide <kernel_PCA>`.
  
  Parameters
  ----------
  n_components : int, default=None
      Number of components. If None, all non-zero components are kept.
  
  kernel : "linear" | "poly" | "rbf" | "sigmoid" | "cosine" | "precomputed"
      Kernel. Default="linear".
  
  degree : int, default=3
      Degree for poly kernels. Ignored by other kernels.
  
  gamma : float, default=1/n_features
      Kernel coefficient for rbf and poly kernels. Ignored by other
      kernels.
  
  coef0 : float, default=1
      Independent term in poly and sigmoid kernels.
      Ignored by other kernels.
  
  kernel_params : mapping of string to any, default=None
      Parameters (keyword arguments) and values for kernel passed as
      callable object. Ignored by other kernels.
  
  alpha : int, default=1.0
      Hyperparameter of the ridge regression that learns the
      inverse transform (when fit_inverse_transform=True).
  
  fit_inverse_transform : bool, default=False
      Learn the inverse transform for non-precomputed kernels.
      (i.e. learn to find the pre-image of a point)
  
  eigen_solver : string ['auto'|'dense'|'arpack'], default='auto'
      Select eigensolver to use. If n_components is much less than
      the number of training samples, arpack may be more efficient
      than the dense eigensolver.
  
  tol : float, default=0
      Convergence tolerance for arpack.
      If 0, optimal value will be chosen by arpack.
  
  max_iter : int, default=None
      Maximum number of iterations for arpack.
      If None, optimal value will be chosen by arpack.
  
  remove_zero_eig : boolean, default=False
      If True, then all components with zero eigenvalues are removed, so
      that the number of components in the output may be < n_components
      (and sometimes even zero due to numerical instability).
      When n_components is None, this parameter is ignored and components
      with zero eigenvalues are removed regardless.
  
  random_state : int seed, RandomState instance, or None, default=None
      A pseudo random number generator used for the initialization of the
      residuals when eigen_solver == 'arpack'.
  
      .. versionadded:: 0.18
  
  n_jobs : int, default=1
      The number of parallel jobs to run.
      If `-1`, then the number of jobs is set to the number of CPU cores.
  
      .. versionadded:: 0.18
  
  copy_X : boolean, default=True
      If True, input X is copied and stored by the model in the `X_fit_`
      attribute. If no further changes will be done to X, setting
      `copy_X=False` saves memory by storing a reference.
  
      .. versionadded:: 0.18
  
  Attributes
  ----------
  lambdas_ : array, (n_components,)
      Eigenvalues of the centered kernel matrix in decreasing order.
      If `n_components` and `remove_zero_eig` are not set,
      then all values are stored.
  
  alphas_ : array, (n_samples, n_components)
      Eigenvectors of the centered kernel matrix. If `n_components` and
      `remove_zero_eig` are not set, then all components are stored.
  
  dual_coef_ : array, (n_samples, n_features)
      Inverse transform matrix. Set if `fit_inverse_transform` is True.
  
  X_transformed_fit_ : array, (n_samples, n_components)
      Projection of the fitted data on the kernel principal components.
  
  X_fit_ : (n_samples, n_features)
      The data used to fit the model. If `copy_X=False`, then `X_fit_` is
      a reference. This attribute is used for the calls to transform.
  
  References
  ----------
  Kernel PCA was introduced in:
      Bernhard Schoelkopf, Alexander J. Smola,
      and Klaus-Robert Mueller. 1999. Kernel principal
      component analysis. In Advances in kernel methods,
      MIT Press, Cambridge, MA, USA 327-352.
class_docstr_tok: ["Kernel","Principal","component","analysis","(","KPCA",")","Non-linear","dimensionality","reduction","through","the","use","of","kernels","(","see",":","ref",":","`","metrics","`",")",".","Read","more","in","the",":","ref",":","`","User","Guide","<","kernel_PCA",">","`",".","Parameters","--","--","--","--","--","n_components",":","int",",","default=None","Number","of","components",".","If","None",",","all","non-zero","components","are","kept",".","kernel",":","``","linear","''","|","``","poly","''","|","``","rbf","''","|","``","sigmoid","''","|","``","cosine","''","|","``","precomputed","''","Kernel",".","Default=","''","linear","''",".","degree",":","int",",","default=3","Degree","for","poly","kernels",".","Ignored","by","other","kernels",".","gamma",":","float",",","default=1\/n_features","Kernel","coefficient","for","rbf","and","poly","kernels",".","Ignored","by","other","kernels",".","coef0",":","float",",","default=1","Independent","term","in","poly","and","sigmoid","kernels",".","Ignored","by","other","kernels",".","kernel_params",":","mapping","of","string","to","any",",","default=None","Parameters","(","keyword","arguments",")","and","values","for","kernel","passed","as","callable","object",".","Ignored","by","other","kernels",".","alpha",":","int",",","default=1.0","Hyperparameter","of","the","ridge","regression","that","learns","the","inverse","transform","(","when","fit_inverse_transform=True",")",".","fit_inverse_transform",":","bool",",","default=False","Learn","the","inverse","transform","for","non-precomputed","kernels",".","(","i.e",".","learn","to","find","the","pre-image","of","a","point",")","eigen_solver",":","string","[","'auto'|'dense'|'arpack","'","]",",","default='auto'","Select","eigensolver","to","use",".","If","n_components","is","much","less","than","the","number","of","training","samples",",","arpack","may","be","more","efficient","than","the","dense","eigensolver",".","tol",":","float",",","default=0","Convergence","tolerance","for","arpack",".","If","0",",","optimal","value","will","be","chosen","by","arpack",".","max_iter",":","int",",","default=None","Maximum","number","of","iterations","for","arpack",".","If","None",",","optimal","value","will","be","chosen","by","arpack",".","remove_zero_eig",":","boolean",",","default=False","If","True",",","then","all","components","with","zero","eigenvalues","are","removed",",","so","that","the","number","of","components","in","the","output","may","be","<","n_components","(","and","sometimes","even","zero","due","to","numerical","instability",")",".","When","n_components","is","None",",","this","parameter","is","ignored","and","components","with","zero","eigenvalues","are","removed","regardless",".","random_state",":","int","seed",",","RandomState","instance",",","or","None",",","default=None","A","pseudo","random","number","generator","used","for","the","initialization","of","the","residuals","when","eigen_solver","==","'arpack","'",".","..","versionadded",":",":","0.18","n_jobs",":","int",",","default=1","The","number","of","parallel","jobs","to","run",".","If","`","-1","`",",","then","the","number","of","jobs","is","set","to","the","number","of","CPU","cores",".","..","versionadded",":",":","0.18","copy_X",":","boolean",",","default=True","If","True",",","input","X","is","copied","and","stored","by","the","model","in","the","`","X_fit_","`","attribute",".","If","no","further","changes","will","be","done","to","X",",","setting","`","copy_X=False","`","saves","memory","by","storing","a","reference",".","..","versionadded",":",":","0.18","Attributes","--","--","--","--","--","lambdas_",":","array",",","(","n_components",",",")","Eigenvalues","of","the","centered","kernel","matrix","in","decreasing","order",".","If","`","n_components","`","and","`","remove_zero_eig","`","are","not","set",",","then","all","values","are","stored",".","alphas_",":","array",",","(","n_samples",",","n_components",")","Eigenvectors","of","the","centered","kernel","matrix",".","If","`","n_components","`","and","`","remove_zero_eig","`","are","not","set",",","then","all","components","are","stored",".","dual_coef_",":","array",",","(","n_samples",",","n_features",")","Inverse","transform","matrix",".","Set","if","`","fit_inverse_transform","`","is","True",".","X_transformed_fit_",":","array",",","(","n_samples",",","n_components",")","Projection","of","the","fitted","data","on","the","kernel","principal","components",".","X_fit_",":","(","n_samples",",","n_features",")","The","data","used","to","fit","the","model",".","If","`","copy_X=False","`",",","then","`","X_fit_","`","is","a","reference",".","This","attribute","is","used","for","the","calls","to","transform",".","References","--","--","--","--","--","Kernel","PCA","was","introduced","in",":","Bernhard","Schoelkopf",",","Alexander","J.","Smola",",","and","Klaus-Robert","Mueller",".","1999",".","Kernel","principal","component","analysis",".","In","Advances","in","kernel","methods",",","MIT","Press",",","Cambridge",",","MA",",","USA","327-352","."]
code: def _fit_inverse_transform(self, X_transformed, X):
      if hasattr(X, "tocsr"):
          raise NotImplementedError(
              "Inverse transform not implemented for "
              "sparse matrices!"
          )
  
      n_samples = X_transformed.shape[0]
      K = self._get_kernel(X_transformed)
      K.flat[:: n_samples + 1] += self.alpha
      self.dual_coef_ = linalg.solve(
          K, X, sym_pos=True, overwrite_a=True
      )
      self.X_transformed_fit_ = X_transformed
  
imports: import numpy
  from scipy import linalg
  from ..utils import check_random_state
  from ..utils.arpack import eigsh
  from ..utils.validation import check_is_fitted, check_array
  from ..exceptions import NotFittedError
  from ..base import BaseEstimator, TransformerMixin
  from ..preprocessing import KernelCenterer
  from ..metrics.pairwise import pairwise_kernels
label_desc: Use image node_id 5 for calling the KernelPCA obj's underlying member method code with example usage: obj._fit_inverse_transform(X_transformed, X) without return types