class_docstr: Cross-validated Orthogonal Matching Pursuit model (OMP).
  
  See glossary entry for :term:`cross-validation estimator`.
  
  Read more in the :ref:`User Guide <omp>`.
  
  Parameters
  ----------
  copy : bool, default=True
      Whether the design matrix X must be copied by the algorithm. A false
      value is only helpful if X is already Fortran-ordered, otherwise a
      copy is made anyway.
  
  fit_intercept : bool, default=True
      Whether to calculate the intercept for this model. If set
      to false, no intercept will be used in calculations
      (i.e. data is expected to be centered).
  
  max_iter : int, default=None
      Maximum numbers of iterations to perform, therefore maximum features
      to include. 10% of ``n_features`` but at least 5 if available.
  
  cv : int, cross-validation generator or iterable, default=None
      Determines the cross-validation splitting strategy.
      Possible inputs for cv are:
  
      - None, to use the default 5-fold cross-validation,
      - integer, to specify the number of folds.
      - :term:`CV splitter`,
      - An iterable yielding (train, test) splits as arrays of indices.
  
      For integer/None inputs, :class:`~sklearn.model_selection.KFold` is used.
  
      Refer :ref:`User Guide <cross_validation>` for the various
      cross-validation strategies that can be used here.
  
      .. versionchanged:: 0.22
          ``cv`` default value if None changed from 3-fold to 5-fold.
  
  n_jobs : int, default=None
      Number of CPUs to use during the cross validation.
      ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
      ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
      for more details.
  
  verbose : bool or int, default=False
      Sets the verbosity amount.
  
  Attributes
  ----------
  intercept_ : float or ndarray of shape (n_targets,)
      Independent term in decision function.
  
  coef_ : ndarray of shape (n_features,) or (n_targets, n_features)
      Parameter vector (w in the problem formulation).
  
  n_nonzero_coefs_ : int
      Estimated number of non-zero coefficients giving the best mean squared
      error over the cross-validation folds.
  
  n_iter_ : int or array-like
      Number of active features across every target for the model refit with
      the best hyperparameters got by cross-validating across all folds.
  
  n_features_in_ : int
      Number of features seen during :term:`fit`.
  
      .. versionadded:: 0.24
  
  feature_names_in_ : ndarray of shape (`n_features_in_`,)
      Names of features seen during :term:`fit`. Defined only when `X`
      has feature names that are all strings.
  
      .. versionadded:: 1.0
  
  See Also
  --------
  orthogonal_mp : Solves n_targets Orthogonal Matching Pursuit problems.
  orthogonal_mp_gram : Solves n_targets Orthogonal Matching Pursuit
      problems using only the Gram matrix X.T * X and the product X.T * y.
  lars_path : Compute Least Angle Regression or Lasso path using LARS algorithm.
  Lars : Least Angle Regression model a.k.a. LAR.
  LassoLars : Lasso model fit with Least Angle Regression a.k.a. Lars.
  OrthogonalMatchingPursuit : Orthogonal Matching Pursuit model (OMP).
  LarsCV : Cross-validated Least Angle Regression model.
  LassoLarsCV : Cross-validated Lasso model fit with Least Angle Regression.
  sklearn.decomposition.sparse_encode : Generic sparse coding.
      Each column of the result is the solution to a Lasso problem.
  
  Notes
  -----
  In `fit`, once the optimal number of non-zero coefficients is found through
  cross-validation, the model is fit again using the entire training set.
  
  Examples
  --------
  >>> from sklearn.linear_model import OrthogonalMatchingPursuitCV
  >>> from sklearn.datasets import make_regression
  >>> X, y = make_regression(n_features=100, n_informative=10,
  ...                        noise=4, random_state=0)
  >>> reg = OrthogonalMatchingPursuitCV(cv=5).fit(X, y)
  >>> reg.score(X, y)
  0.9991...
  >>> reg.n_nonzero_coefs_
  10
  >>> reg.predict(X[:1,])
  array([-78.3854...])
class_docstr_tok: ["Cross-validated","Orthogonal","Matching","Pursuit","model","(","OMP",")",".","See","glossary","entry","for",":","term",":","`","cross-validation","estimator","`",".","Read","more","in","the",":","ref",":","`","User","Guide","<","omp",">","`",".","Parameters","--","--","--","--","--","copy",":","bool",",","default=True","Whether","the","design","matrix","X","must","be","copied","by","the","algorithm",".","A","false","value","is","only","helpful","if","X","is","already","Fortran-ordered",",","otherwise","a","copy","is","made","anyway",".","fit_intercept",":","bool",",","default=True","Whether","to","calculate","the","intercept","for","this","model",".","If","set","to","false",",","no","intercept","will","be","used","in","calculations","(","i.e",".","data","is","expected","to","be","centered",")",".","max_iter",":","int",",","default=None","Maximum","numbers","of","iterations","to","perform",",","therefore","maximum","features","to","include",".","10","%","of","``","n_features","``","but","at","least","5","if","available",".","cv",":","int",",","cross-validation","generator","or","iterable",",","default=None","Determines","the","cross-validation","splitting","strategy",".","Possible","inputs","for","cv","are",":","-","None",",","to","use","the","default","5-fold","cross-validation",",","-","integer",",","to","specify","the","number","of","folds",".","-",":","term",":","`","CV","splitter","`",",","-","An","iterable","yielding","(","train",",","test",")","splits","as","arrays","of","indices",".","For","integer\/None","inputs",",",":","class",":","`","~sklearn.model_selection.KFold","`","is","used",".","Refer",":","ref",":","`","User","Guide","<","cross_validation",">","`","for","the","various","cross-validation","strategies","that","can","be","used","here",".","..","versionchanged",":",":","0.22","``","cv","``","default","value","if","None","changed","from","3-fold","to","5-fold",".","n_jobs",":","int",",","default=None","Number","of","CPUs","to","use","during","the","cross","validation",".","``","None","``","means","1","unless","in","a",":","obj",":","`","joblib.parallel_backend","`","context",".","``","-1","``","means","using","all","processors",".","See",":","term",":","`","Glossary","<","n_jobs",">","`","for","more","details",".","verbose",":","bool","or","int",",","default=False","Sets","the","verbosity","amount",".","Attributes","--","--","--","--","--","intercept_",":","float","or","ndarray","of","shape","(","n_targets",",",")","Independent","term","in","decision","function",".","coef_",":","ndarray","of","shape","(","n_features",",",")","or","(","n_targets",",","n_features",")","Parameter","vector","(","w","in","the","problem","formulation",")",".","n_nonzero_coefs_",":","int","Estimated","number","of","non-zero","coefficients","giving","the","best","mean","squared","error","over","the","cross-validation","folds",".","n_iter_",":","int","or","array-like","Number","of","active","features","across","every","target","for","the","model","refit","with","the","best","hyperparameters","got","by","cross-validating","across","all","folds",".","n_features_in_",":","int","Number","of","features","seen","during",":","term",":","`","fit","`",".","..","versionadded",":",":","0.24","feature_names_in_",":","ndarray","of","shape","(","`","n_features_in_","`",",",")","Names","of","features","seen","during",":","term",":","`","fit","`",".","Defined","only","when","`","X","`","has","feature","names","that","are","all","strings",".","..","versionadded",":",":","1.0","See","Also","--","--","--","--","orthogonal_mp",":","Solves","n_targets","Orthogonal","Matching","Pursuit","problems",".","orthogonal_mp_gram",":","Solves","n_targets","Orthogonal","Matching","Pursuit","problems","using","only","the","Gram","matrix","X.T","*","X","and","the","product","X.T","*","y.","lars_path",":","Compute","Least","Angle","Regression","or","Lasso","path","using","LARS","algorithm",".","Lars",":","Least","Angle","Regression","model","a.k.a",".","LAR",".","LassoLars",":","Lasso","model","fit","with","Least","Angle","Regression","a.k.a",".","Lars",".","OrthogonalMatchingPursuit",":","Orthogonal","Matching","Pursuit","model","(","OMP",")",".","LarsCV",":","Cross-validated","Least","Angle","Regression","model",".","LassoLarsCV",":","Cross-validated","Lasso","model","fit","with","Least","Angle","Regression",".","sklearn.decomposition.sparse_encode",":","Generic","sparse","coding",".","Each","column","of","the","result","is","the","solution","to","a","Lasso","problem",".","Notes","--","--","-","In","`","fit","`",",","once","the","optimal","number","of","non-zero","coefficients","is","found","through","cross-validation",",","the","model","is","fit","again","using","the","entire","training","set",".","Examples","--","--","--","--",">",">",">","from","sklearn.linear_model","import","OrthogonalMatchingPursuitCV",">",">",">","from","sklearn.datasets","import","make_regression",">",">",">","X",",","y","=","make_regression","(","n_features=100",",","n_informative=10",",","...","noise=4",",","random_state=0",")",">",">",">","reg","=","OrthogonalMatchingPursuitCV","(","cv=5",")",".fit","(","X",",","y",")",">",">",">","reg.score","(","X",",","y",")","0.9991","...",">",">",">","reg.n_nonzero_coefs_","10",">",">",">","reg.predict","(","X","[",":1",",","]",")","array","(","[","-78.3854","...","]",")"]
docstr: Fit the model using X, y as training data.
  
  Parameters
  ----------
  X : array-like of shape (n_samples, n_features)
      Training data.
  
  y : array-like of shape (n_samples,)
      Target values. Will be cast to X's dtype if necessary.
  
  **fit_params : dict
      Parameters to pass to the underlying splitter.
  
      .. versionadded:: 1.4
          Only available if `enable_metadata_routing=True`,
          which can be set by using
          ``sklearn.set_config(enable_metadata_routing=True)``.
          See :ref:`Metadata Routing User Guide <metadata_routing>` for
          more details.
  
  Returns
  -------
  self : object
      Returns an instance of self.
docstr_tok: ["Fit","the","model","using","X",",","y","as","training","data",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape","(","n_samples",",","n_features",")","Training","data",".","y",":","array-like","of","shape","(","n_samples",",",")","Target","values",".","Will","be","cast","to","X","'s","dtype","if","necessary",".","*","*","fit_params",":","dict","Parameters","to","pass","to","the","underlying","splitter",".","..","versionadded",":",":","1.4","Only","available","if","`","enable_metadata_routing=True","`",",","which","can","be","set","by","using","``","sklearn.set_config","(","enable_metadata_routing=True",")","``",".","See",":","ref",":","`","Metadata","Routing","User","Guide","<","metadata_routing",">","`","for","more","details",".","Returns","--","--","--","-","self",":","object","Returns","an","instance","of","self","."]
code: def fit(self, X, y, **fit_params):
      """Fit the model using X, y as training data.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          Training data.
  
      y : array-like of shape (n_samples,)
          Target values. Will be cast to X's dtype if necessary.
  
      **fit_params : dict
          Parameters to pass to the underlying splitter.
  
          .. versionadded:: 1.4
              Only available if `enable_metadata_routing=True`,
              which can be set by using
              ``sklearn.set_config(enable_metadata_routing=True)``.
              See :ref:`Metadata Routing User Guide <metadata_routing>` for
              more details.
  
      Returns
      -------
      self : object
          Returns an instance of self.
      """
      _raise_for_params(fit_params, self, "fit")
  
      X, y = self._validate_data(
          X, y, y_numeric=True, ensure_min_features=2
      )
      X = as_float_array(X, copy=False, force_all_finite=False)
      cv = check_cv(self.cv, classifier=False)
      if _routing_enabled():
          routed_params = process_routing(self, "fit", **fit_params)
      else:
          # TODO(SLEP6): remove when metadata routing cannot be disabled.
          routed_params = Bunch()
          routed_params.splitter = Bunch(split={})
      max_iter = (
          min(max(int(0.1 * X.shape[1]), 5), X.shape[1])
          if not self.max_iter
          else self.max_iter
      )
      cv_paths = Parallel(n_jobs=self.n_jobs, verbose=self.verbose)(
          delayed(_omp_path_residues)(
              X[train],
              y[train],
              X[test],
              y[test],
              self.copy,
              self.fit_intercept,
              max_iter,
          )
          for train, test in cv.split(X, **routed_params.splitter.split)
      )
  
      min_early_stop = min(fold.shape[0] for fold in cv_paths)
      mse_folds = np.array(
          [
              (fold[:min_early_stop] ** 2).mean(axis=1)
              for fold in cv_paths
          ]
      )
      best_n_nonzero_coefs = np.argmin(mse_folds.mean(axis=0)) + 1
      self.n_nonzero_coefs_ = best_n_nonzero_coefs
      omp = OrthogonalMatchingPursuit(
          n_nonzero_coefs=best_n_nonzero_coefs,
          fit_intercept=self.fit_intercept,
      ).fit(X, y)
  
      self.coef_ = omp.coef_
      self.intercept_ = omp.intercept_
      self.n_iter_ = omp.n_iter_
      return self
  
imports: import warnings
  from math import sqrt
  from numbers import Integral, Real
  import numpy
  from scipy import linalg
  from scipy.linalg.lapack import get_lapack_funcs
  from ..base import MultiOutputMixin, RegressorMixin, _fit_context
  from ..model_selection import check_cv
  from ..utils import Bunch, as_float_array, check_array
  from ..utils._param_validation import Interval, StrOptions, validate_params
  from ..utils.metadata_routing import MetadataRouter, MethodMapping, _raise_for_params, _routing_enabled, process_routing
  from ..utils.parallel import Parallel, delayed
  from ._base import LinearModel, _pre_fit
label_desc: Use image node_id 2 for calling the OrthogonalMatchingPursuitCV obj's underlying member method code with example usage: obj.fit(X, y) and returns: self