docstr: Fit Ridge regression model
  
  Parameters
  ----------
  X : array-like, shape = [n_samples, n_features]
      Training data
  
  y : array-like, shape = [n_samples] or [n_samples, n_targets]
      Target values
  
  sample_weight : float or array-like of shape [n_samples]
      Sample weight
  
  Returns
  -------
  self : Returns self.
docstr_tok: ["Fit","Ridge","regression","model","Parameters","--","--","--","--","--","X",":","array-like",",","shape","=","[","n_samples",",","n_features","]","Training","data","y",":","array-like",",","shape","=","[","n_samples","]","or","[","n_samples",",","n_targets","]","Target","values","sample_weight",":","float","or","array-like","of","shape","[","n_samples","]","Sample","weight","Returns","--","--","--","-","self",":","Returns","self","."]
code: def fit(self, X, y, sample_weight=None):
      """Fit Ridge regression model
  
      Parameters
      ----------
      X : array-like, shape = [n_samples, n_features]
          Training data
  
      y : array-like, shape = [n_samples] or [n_samples, n_targets]
          Target values
  
      sample_weight : float or array-like of shape [n_samples]
          Sample weight
  
      Returns
      -------
      self : Returns self.
      """
      if self.cv is None:
          estimator = _RidgeGCV(
              self.alphas,
              fit_intercept=self.fit_intercept,
              normalize=self.normalize,
              scoring=self.scoring,
              gcv_mode=self.gcv_mode,
              store_cv_values=self.store_cv_values,
          )
          estimator.fit(X, y, sample_weight=sample_weight)
          self.alpha_ = estimator.alpha_
          if self.store_cv_values:
              self.cv_values_ = estimator.cv_values_
      else:
          if self.store_cv_values:
              raise ValueError(
                  "cv!=None and store_cv_values=True "
                  " are incompatible"
              )
          parameters = {"alpha": self.alphas}
          fit_params = {"sample_weight": sample_weight}
          gs = GridSearchCV(
              Ridge(fit_intercept=self.fit_intercept),
              parameters,
              fit_params=fit_params,
              cv=self.cv,
              scoring=self.scoring,
          )
          gs.fit(X, y)
          estimator = gs.best_estimator_
          self.alpha_ = gs.best_estimator_.alpha
  
      self.coef_ = estimator.coef_
      self.intercept_ = estimator.intercept_
  
      return self
  
imports: from abc import ABCMeta, abstractmethod
  import warnings
  import numpy
  from scipy import linalg
  from scipy import sparse
  from scipy.sparse import linalg
  from .base import LinearClassifierMixin, LinearModel, _rescale_data
  from .sag import sag_solver
  from ..base import RegressorMixin
  from ..utils.extmath import safe_sparse_dot
  from ..utils.extmath import row_norms
  from ..utils import check_X_y
  from ..utils import check_array
  from ..utils import check_consistent_length
  from ..utils import compute_sample_weight
  from ..utils import column_or_1d
  from ..preprocessing import LabelBinarizer
  from ..model_selection import GridSearchCV
  from ..externals import six
  from ..metrics.scorer import check_scoring
label_desc: Use image node_id 2 for calling the _BaseRidgeCV obj's underlying member method code with example usage: obj.fit(X, y, sample_weight) and returns: self