#NEWLINE# @ ignore_warnings #NEWLINE# def test_classifier_results( ) : #NEWLINE# #INDENT# 'tests if classifier results match target' #NEWLINE# alpha = 0.1 #NEWLINE# n_features = 20 #NEWLINE# n_samples = 10 #NEWLINE# tol = 0.01 #NEWLINE# max_iter = 200 #NEWLINE# rng = np . random . RandomState ( 0 ) #NEWLINE# X = rng . normal ( size = ( n_samples , n_features ) ) #NEWLINE# w = rng . normal ( size = n_features ) #NEWLINE# y = np . dot ( X , w ) #NEWLINE# y = np . sign ( y ) #NEWLINE# clf1 = LogisticRegression ( solver = 'sag' , C = ( ( 1.0 / alpha ) / n_samples ) , max_iter = max_iter , tol = tol , random_state = 77 ) #NEWLINE# clf2 = clone ( clf1 ) #NEWLINE# clf1 . fit ( X , y ) #NEWLINE# clf2 . fit ( sp . csr_matrix ( X ) , y ) #NEWLINE# pred1 = clf1 . predict ( X ) #NEWLINE# pred2 = clf2 . predict ( X ) #NEWLINE# assert_almost_equal ( pred1 , y , decimal = 12 ) #NEWLINE# assert_almost_equal ( pred2 , y , decimal = 12 )