#NEWLINE# def fit( self , X , y , sample_weight = None ) : #NEWLINE# #INDENT# 'Fit Ridge regression model\n\n        Parameters\n        ----------\n        X : array-like, shape = [n_samples, n_features]\n            Training data\n\n        y : array-like, shape = [n_samples] or [n_samples, n_targets]\n            Target values\n\n        sample_weight : float or array-like of shape [n_samples]\n            Sample weight\n\n        Returns\n        -------\n        self : Returns self.\n        ' #NEWLINE# if ( self . cv is None ) : #NEWLINE# #INDENT# 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 ) #NEWLINE# estimator . fit ( X , y , sample_weight = sample_weight ) #NEWLINE# self . alpha_ = estimator . alpha_ #NEWLINE# if self . store_cv_values : #NEWLINE# #INDENT# self . cv_values_ = estimator . cv_values_ #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if self . store_cv_values : #NEWLINE# #INDENT# raise ValueError ( 'cv!=None and store_cv_values=True  are incompatible' ) #NEWLINE# #UNINDENT# parameters = { #NEWLINE# #INDENT# 'alpha' : self . alphas , #NEWLINE# #UNINDENT# } #NEWLINE# fit_params = { #NEWLINE# #INDENT# 'sample_weight' : self , #NEWLINE# #UNINDENT# } #NEWLINE# gs = GridSearchCV ( Ridge ( fit_intercept = self . fit_intercept ) , parameters , fit_params = fit_params , cv = self . cv ) #NEWLINE# gs . fit ( X , y ) #NEWLINE# estimator = gs . best_estimator_ #NEWLINE# self . alpha_ = gs . best_estimator_ . alpha #NEWLINE# #UNINDENT# self . coef_ = estimator . coef_ #NEWLINE# self . intercept_ = estimator . intercept_ #NEWLINE# return self