class_docstr: Bayesian ridge regression.
  
  Fit a Bayesian ridge model. See the Notes section for details on this
  implementation and the optimization of the regularization parameters
  lambda (precision of the weights) and alpha (precision of the noise).
  
  Read more in the :ref:`User Guide <bayesian_regression>`.
  
  Parameters
  ----------
  max_iter : int, default=None
      Maximum number of iterations over the complete dataset before
      stopping independently of any early stopping criterion. If `None`, it
      corresponds to `max_iter=300`.
  
      .. versionchanged:: 1.3
  
  tol : float, default=1e-3
      Stop the algorithm if w has converged.
  
  alpha_1 : float, default=1e-6
      Hyper-parameter : shape parameter for the Gamma distribution prior
      over the alpha parameter.
  
  alpha_2 : float, default=1e-6
      Hyper-parameter : inverse scale parameter (rate parameter) for the
      Gamma distribution prior over the alpha parameter.
  
  lambda_1 : float, default=1e-6
      Hyper-parameter : shape parameter for the Gamma distribution prior
      over the lambda parameter.
  
  lambda_2 : float, default=1e-6
      Hyper-parameter : inverse scale parameter (rate parameter) for the
      Gamma distribution prior over the lambda parameter.
  
  alpha_init : float, default=None
      Initial value for alpha (precision of the noise).
      If not set, alpha_init is 1/Var(y).
  
          .. versionadded:: 0.22
  
  lambda_init : float, default=None
      Initial value for lambda (precision of the weights).
      If not set, lambda_init is 1.
  
          .. versionadded:: 0.22
  
  compute_score : bool, default=False
      If True, compute the log marginal likelihood at each iteration of the
      optimization.
  
  fit_intercept : bool, default=True
      Whether to calculate the intercept for this model.
      The intercept is not treated as a probabilistic parameter
      and thus has no associated variance. If set
      to False, no intercept will be used in calculations
      (i.e. data is expected to be centered).
  
  copy_X : bool, default=True
      If True, X will be copied; else, it may be overwritten.
  
  verbose : bool, default=False
      Verbose mode when fitting the model.
  
  n_iter : int
      Maximum number of iterations. Should be greater than or equal to 1.
  
      .. deprecated:: 1.3
         `n_iter` is deprecated in 1.3 and will be removed in 1.5. Use
         `max_iter` instead.
  
  Attributes
  ----------
  coef_ : array-like of shape (n_features,)
      Coefficients of the regression model (mean of distribution)
  
  intercept_ : float
      Independent term in decision function. Set to 0.0 if
      `fit_intercept = False`.
  
  alpha_ : float
     Estimated precision of the noise.
  
  lambda_ : float
     Estimated precision of the weights.
  
  sigma_ : array-like of shape (n_features, n_features)
      Estimated variance-covariance matrix of the weights
  
  scores_ : array-like of shape (n_iter_+1,)
      If computed_score is True, value of the log marginal likelihood (to be
      maximized) at each iteration of the optimization. The array starts
      with the value of the log marginal likelihood obtained for the initial
      values of alpha and lambda and ends with the value obtained for the
      estimated alpha and lambda.
  
  n_iter_ : int
      The actual number of iterations to reach the stopping criterion.
  
  X_offset_ : ndarray of shape (n_features,)
      If `fit_intercept=True`, offset subtracted for centering data to a
      zero mean. Set to np.zeros(n_features) otherwise.
  
  X_scale_ : ndarray of shape (n_features,)
      Set to np.ones(n_features).
  
  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
  --------
  ARDRegression : Bayesian ARD regression.
  
  Notes
  -----
  There exist several strategies to perform Bayesian ridge regression. This
  implementation is based on the algorithm described in Appendix A of
  (Tipping, 2001) where updates of the regularization parameters are done as
  suggested in (MacKay, 1992). Note that according to A New
  View of Automatic Relevance Determination (Wipf and Nagarajan, 2008) these
  update rules do not guarantee that the marginal likelihood is increasing
  between two consecutive iterations of the optimization.
  
  References
  ----------
  D. J. C. MacKay, Bayesian Interpolation, Computation and Neural Systems,
  Vol. 4, No. 3, 1992.
  
  M. E. Tipping, Sparse Bayesian Learning and the Relevance Vector Machine,
  Journal of Machine Learning Research, Vol. 1, 2001.
  
  Examples
  --------
  >>> from sklearn import linear_model
  >>> clf = linear_model.BayesianRidge()
  >>> clf.fit([[0,0], [1, 1], [2, 2]], [0, 1, 2])
  BayesianRidge()
  >>> clf.predict([[1, 1]])
  array([1.])
class_docstr_tok: ["Bayesian","ridge","regression",".","Fit","a","Bayesian","ridge","model",".","See","the","Notes","section","for","details","on","this","implementation","and","the","optimization","of","the","regularization","parameters","lambda","(","precision","of","the","weights",")","and","alpha","(","precision","of","the","noise",")",".","Read","more","in","the",":","ref",":","`","User","Guide","<","bayesian_regression",">","`",".","Parameters","--","--","--","--","--","max_iter",":","int",",","default=None","Maximum","number","of","iterations","over","the","complete","dataset","before","stopping","independently","of","any","early","stopping","criterion",".","If","`","None","`",",","it","corresponds","to","`","max_iter=300","`",".","..","versionchanged",":",":","1.3","tol",":","float",",","default=1e-3","Stop","the","algorithm","if","w","has","converged",".","alpha_1",":","float",",","default=1e-6","Hyper-parameter",":","shape","parameter","for","the","Gamma","distribution","prior","over","the","alpha","parameter",".","alpha_2",":","float",",","default=1e-6","Hyper-parameter",":","inverse","scale","parameter","(","rate","parameter",")","for","the","Gamma","distribution","prior","over","the","alpha","parameter",".","lambda_1",":","float",",","default=1e-6","Hyper-parameter",":","shape","parameter","for","the","Gamma","distribution","prior","over","the","lambda","parameter",".","lambda_2",":","float",",","default=1e-6","Hyper-parameter",":","inverse","scale","parameter","(","rate","parameter",")","for","the","Gamma","distribution","prior","over","the","lambda","parameter",".","alpha_init",":","float",",","default=None","Initial","value","for","alpha","(","precision","of","the","noise",")",".","If","not","set",",","alpha_init","is","1\/Var","(","y",")",".","..","versionadded",":",":","0.22","lambda_init",":","float",",","default=None","Initial","value","for","lambda","(","precision","of","the","weights",")",".","If","not","set",",","lambda_init","is","1",".","..","versionadded",":",":","0.22","compute_score",":","bool",",","default=False","If","True",",","compute","the","log","marginal","likelihood","at","each","iteration","of","the","optimization",".","fit_intercept",":","bool",",","default=True","Whether","to","calculate","the","intercept","for","this","model",".","The","intercept","is","not","treated","as","a","probabilistic","parameter","and","thus","has","no","associated","variance",".","If","set","to","False",",","no","intercept","will","be","used","in","calculations","(","i.e",".","data","is","expected","to","be","centered",")",".","copy_X",":","bool",",","default=True","If","True",",","X","will","be","copied",";","else",",","it","may","be","overwritten",".","verbose",":","bool",",","default=False","Verbose","mode","when","fitting","the","model",".","n_iter",":","int","Maximum","number","of","iterations",".","Should","be","greater","than","or","equal","to","1",".","..","deprecated",":",":","1.3","`","n_iter","`","is","deprecated","in","1.3","and","will","be","removed","in","1.5",".","Use","`","max_iter","`","instead",".","Attributes","--","--","--","--","--","coef_",":","array-like","of","shape","(","n_features",",",")","Coefficients","of","the","regression","model","(","mean","of","distribution",")","intercept_",":","float","Independent","term","in","decision","function",".","Set","to","0.0","if","`","fit_intercept","=","False","`",".","alpha_",":","float","Estimated","precision","of","the","noise",".","lambda_",":","float","Estimated","precision","of","the","weights",".","sigma_",":","array-like","of","shape","(","n_features",",","n_features",")","Estimated","variance-covariance","matrix","of","the","weights","scores_",":","array-like","of","shape","(","n_iter_+1",",",")","If","computed_score","is","True",",","value","of","the","log","marginal","likelihood","(","to","be","maximized",")","at","each","iteration","of","the","optimization",".","The","array","starts","with","the","value","of","the","log","marginal","likelihood","obtained","for","the","initial","values","of","alpha","and","lambda","and","ends","with","the","value","obtained","for","the","estimated","alpha","and","lambda",".","n_iter_",":","int","The","actual","number","of","iterations","to","reach","the","stopping","criterion",".","X_offset_",":","ndarray","of","shape","(","n_features",",",")","If","`","fit_intercept=True","`",",","offset","subtracted","for","centering","data","to","a","zero","mean",".","Set","to","np.zeros","(","n_features",")","otherwise",".","X_scale_",":","ndarray","of","shape","(","n_features",",",")","Set","to","np.ones","(","n_features",")",".","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","--","--","--","--","ARDRegression",":","Bayesian","ARD","regression",".","Notes","--","--","-","There","exist","several","strategies","to","perform","Bayesian","ridge","regression",".","This","implementation","is","based","on","the","algorithm","described","in","Appendix","A","of","(","Tipping",",","2001",")","where","updates","of","the","regularization","parameters","are","done","as","suggested","in","(","MacKay",",","1992",")",".","Note","that","according","to","A","New","View","of","Automatic","Relevance","Determination","(","Wipf","and","Nagarajan",",","2008",")","these","update","rules","do","not","guarantee","that","the","marginal","likelihood","is","increasing","between","two","consecutive","iterations","of","the","optimization",".","References","--","--","--","--","--","D.","J.","C.","MacKay",",","Bayesian","Interpolation",",","Computation","and","Neural","Systems",",","Vol",".","4",",","No",".","3",",","1992",".","M.","E.","Tipping",",","Sparse","Bayesian","Learning","and","the","Relevance","Vector","Machine",",","Journal","of","Machine","Learning","Research",",","Vol",".","1",",","2001",".","Examples","--","--","--","--",">",">",">","from","sklearn","import","linear_model",">",">",">","clf","=","linear_model.BayesianRidge","(",")",">",">",">","clf.fit","(","[","[","0,0","]",",","[","1",",","1","]",",","[","2",",","2","]","]",",","[","0",",","1",",","2","]",")","BayesianRidge","(",")",">",">",">","clf.predict","(","[","[","1",",","1","]","]",")","array","(","[","1",".","]",")"]
docstr: Update posterior mean and compute corresponding rmse.
  
  Posterior mean is given by coef_ = scaled_sigma_ * X.T * y where
  scaled_sigma_ = (lambda_/alpha_ * np.eye(n_features)
                   + np.dot(X.T, X))^-1
docstr_tok: ["Update","posterior","mean","and","compute","corresponding","rmse",".","Posterior","mean","is","given","by","coef_","=","scaled_sigma_","*","X.T","*","y","where","scaled_sigma_","=","(","lambda_\/alpha_","*","np.eye","(","n_features",")","+","np.dot","(","X.T",",","X",")",")","^-1"]
code: def _update_coef_(
      self,
      X,
      y,
      n_samples,
      n_features,
      XT_y,
      U,
      Vh,
      eigen_vals_,
      alpha_,
      lambda_,
  ):
      """Update posterior mean and compute corresponding rmse.
  
      Posterior mean is given by coef_ = scaled_sigma_ * X.T * y where
      scaled_sigma_ = (lambda_/alpha_ * np.eye(n_features)
                       + np.dot(X.T, X))^-1
      """
  
      if n_samples > n_features:
          coef_ = np.linalg.multi_dot(
              [
                  Vh.T,
                  Vh / (eigen_vals_ + lambda_ / alpha_)[:, np.newaxis],
                  XT_y,
              ]
          )
      else:
          coef_ = np.linalg.multi_dot(
              [
                  X.T,
                  U / (eigen_vals_ + lambda_ / alpha_)[None, :],
                  U.T,
                  y,
              ]
          )
  
      rmse_ = np.sum((y - np.dot(X, coef_)) ** 2)
  
      return coef_, rmse_
  
imports: import warnings
  from math import log
  from numbers import Integral, Real
  import numpy
  from scipy import linalg
  from scipy.linalg import pinvh
  from ..base import RegressorMixin, _fit_context
  from ..utils._param_validation import Hidden, Interval, StrOptions
  from ..utils.extmath import fast_logdet
  from ..utils.validation import _check_sample_weight
  from ._base import LinearModel, _preprocess_data, _rescale_data
label_desc: Use image node_id 4 for calling the BayesianRidge obj's underlying member method code with example usage: obj._update_coef_(X, y, n_samples, n_features, XT_y, U, Vh, eigen_vals_, alpha_, lambda_) and returns: coef_,  rmse_