#NEWLINE# @ ignore_warnings #NEWLINE# def test_sample_order_invariance_multilabel_and_multioutput( ) : #NEWLINE# #INDENT# random_state = check_random_state ( 0 ) #NEWLINE# y_true = random_state . randint ( 0 , 2 , size = ( 20 , 25 ) ) #NEWLINE# y_pred = random_state . randint ( 0 , 2 , size = ( 20 , 25 ) ) #NEWLINE# y_score = random_state . normal ( size = y_true . shape ) #NEWLINE# ( y_true_shuffle , y_pred_shuffle , y_score_shuffle ) = shuffle ( y_true , y_pred , y_score , random_state = 0 ) #NEWLINE# for name in MULTILABELS_METRICS : #NEWLINE# #INDENT# metric = ALL_METRICS [ name ] #NEWLINE# assert_almost_equal ( metric ( y_true , y_pred ) , metric ( y_true_shuffle , y_pred_shuffle ) , err_msg = ( '%s is not sample order invariant' % name ) ) #NEWLINE# #UNINDENT# for name in THRESHOLDED_MULTILABEL_METRICS : #NEWLINE# #INDENT# metric = ALL_METRICS [ name ] #NEWLINE# assert_almost_equal ( metric ( y_true , y_score ) , metric ( y_true_shuffle , y_score_shuffle ) , err_msg = ( '%s is not sample order invariant' % name ) ) #NEWLINE# #UNINDENT# for name in MULTIOUTPUT_METRICS : #NEWLINE# #INDENT# metric = ALL_METRICS [ name ] #NEWLINE# assert_almost_equal ( metric ( y_true , y_score ) , metric ( y_true_shuffle , y_score_shuffle ) , err_msg = ( '%s is not sample order invariant' % name ) ) #NEWLINE# assert_almost_equal ( metric ( y_true , y_pred ) , metric ( y_true_shuffle , y_pred_shuffle ) , err_msg = ( '%s is not sample order invariant' % name ) )