#NEWLINE# def test_isotonic_regression( ) : #NEWLINE# #INDENT# y = np . array ( [ 3 , 7 , 5 , 9 , 8 , 7 , 10 ] ) #NEWLINE# y_ = np . array ( [ 3 , 6 , 6 , 8 , 8 , 8 , 10 ] ) #NEWLINE# assert_array_equal ( y_ , isotonic_regression ( y ) ) #NEWLINE# x = np . arange ( len ( y ) ) #NEWLINE# ir = IsotonicRegression ( y_min = 0.0 , y_max = 1.0 ) #NEWLINE# ir . fit ( x , y ) #NEWLINE# assert_array_equal ( ir . fit ( x , y ) . transform ( x ) , ir . fit_transform ( x , y ) ) #NEWLINE# assert_array_equal ( ir . transform ( x ) , ir . predict ( x ) ) #NEWLINE# perm = np . random . permutation ( len ( y ) ) #NEWLINE# ir = IsotonicRegression ( y_min = 0.0 , y_max = 1.0 ) #NEWLINE# assert_array_equal ( ir . fit_transform ( x [ perm ] , y [ perm ] ) , ir . fit_transform ( x , y ) [ perm ] ) #NEWLINE# assert_array_equal ( ir . transform ( x [ perm ] ) , ir . transform ( x ) [ perm ] ) #NEWLINE# ir = IsotonicRegression ( ) #NEWLINE# assert_array_equal ( ir . fit_transform ( np . ones ( len ( x ) ) , y ) , np . mean ( y ) )