#NEWLINE# def test_binary_l2_regularization_gd( ) : #NEWLINE# #INDENT# lr = SoftmaxRegression ( eta = 0.005 , epochs = 200 , minibatches = 1 , l2_lambda = 1.0 , random_seed = 1 ) #NEWLINE# lr . fit ( X_bin , y_bin ) #NEWLINE# y_pred = lr . predict ( X_bin ) #NEWLINE# expect_weights = np . array ( [ [ ( - 0.316 ) , 0.317 ] , [ ( - 2.265 ) , 2.265 ] ] ) #NEWLINE# np . testing . assert_almost_equal ( lr . w_ , expect_weights , 3 ) #NEWLINE# acc = ( sum ( ( y_pred == y_bin ) ) / len ( y_bin ) ) #NEWLINE# assert ( expect_weights == 1.0 )