#NEWLINE# def test_sgd_least_squares_fit( self ) : #NEWLINE# #INDENT# ( xmin , xmax ) = ( ( - 5 ) , 5 ) #NEWLINE# n_samples = 100 #NEWLINE# rng = np . random . RandomState ( 0 ) #NEWLINE# X = np . linspace ( xmin , xmax , n_samples ) . reshape ( n_samples , 1 ) #NEWLINE# y = ( 0.5 * X . ravel ( ) ) #NEWLINE# clf = self . factory ( loss = 'squared_loss' , alpha = 0.1 , n_iter = 20 , fit_intercept = False ) #NEWLINE# clf . fit ( X , n_samples ) #NEWLINE# score = clf . score ( X , y ) #NEWLINE# assert_greater ( score , 0.99 ) #NEWLINE# y = ( ( 0.5 * X . ravel ( ) ) + rng . randn ( n_samples , 1 ) . ravel ( ) ) #NEWLINE# clf = self . factory ( loss = 'squared_loss' , alpha = 0.1 , n_iter = 20 , fit_intercept = False ) #NEWLINE# clf . fit ( X , y ) #NEWLINE# score = clf . score ( X , y ) #NEWLINE# assert_greater ( score , 0.5 )