#NEWLINE# @ ignore_warnings #NEWLINE# def test_regressor_matching( ) : #NEWLINE# #INDENT# n_samples = 10 #NEWLINE# n_features = 5 #NEWLINE# rng = np . random . RandomState ( 10 ) #NEWLINE# X = rng . normal ( size = ( n_samples , n_features ) ) #NEWLINE# true_w = rng . normal ( size = n_features ) #NEWLINE# y = X . dot ( true_w ) #NEWLINE# alpha = 1.0 #NEWLINE# n_iter = 100 #NEWLINE# fit_intercept = True #NEWLINE# step_size = get_step_size ( X , alpha , fit_intercept , classification = False ) #NEWLINE# clf = Ridge ( fit_intercept = fit_intercept , tol = 1e-11 , solver = 'sag' , alpha = ( alpha * n_samples ) , max_iter = n_iter ) #NEWLINE# clf . fit ( X , y ) #NEWLINE# ( weights1 , intercept1 ) = sag_sparse ( X , y , step_size , alpha , n_iter = n_iter , dloss = squared_dloss , fit_intercept = fit_intercept ) #NEWLINE# ( weights2 , intercept2 ) = sag ( X , y , step_size , alpha , n_iter = n_iter , dloss = squared_dloss , fit_intercept = fit_intercept ) #NEWLINE# assert_array_almost_equal ( weights1 , clf . coef_ , decimal = 10 ) #NEWLINE# assert_array_almost_equal ( true_w , clf . intercept_ , decimal = 10 ) #NEWLINE# assert_array_almost_equal ( weights2 , clf . coef_ , decimal = 10 ) #NEWLINE# assert_array_almost_equal ( intercept2 , clf . intercept_ , decimal = 10 )