#NEWLINE# def test_fast_predict( ) : #NEWLINE# #INDENT# rng = np . random . RandomState ( 123 ) #NEWLINE# n_samples = ( 10 ** 3 ) #NEWLINE# X_train = ( ( 20.0 * rng . rand ( n_samples ) ) - 10 ) #NEWLINE# y_train = np . less ( rng . rand ( n_samples ) , ( 1.0 / ( 1.0 + np . exp ( ( - X_train ) ) ) ) ) . astype ( 'int64' ) #NEWLINE# weights = rng . rand ( n_samples ) #NEWLINE# weights [ ( rng . rand ( n_samples ) < 0.1 ) ] = 0 #NEWLINE# slow_model = IsotonicRegression ( y_min = 0 , y_max = 1 , out_of_bounds = 'clip' ) #NEWLINE# fast_model = IsotonicRegression ( y_min = 0 , y_max = 1 , out_of_bounds = 'clip' ) #NEWLINE# ( X_train_fit , y_train_fit ) = slow_model . _build_y ( X_train , y_train , sample_weight = weights , trim_duplicates = False ) #NEWLINE# slow_model . _build_f ( X_train_fit , y_train_fit ) #NEWLINE# fast_model . fit ( X_train , y_train , sample_weight = weights ) #NEWLINE# X_test = ( ( 20.0 * rng . rand ( n_samples ) ) - 10 ) #NEWLINE# y_pred_slow = slow_model . predict ( X_test ) #NEWLINE# y_pred_fast = fast_model . predict ( X_test ) #NEWLINE# assert_array_equal ( y_pred_slow , y_pred_fast )