#NEWLINE# @ ignore_warnings #NEWLINE# def test_multilabel_representation_invariance( ) : #NEWLINE# #INDENT# n_classes = 4 #NEWLINE# n_samples = 50 #NEWLINE# ( _ , y1 ) = make_multilabel_classification ( n_features = 1 , n_classes = n_classes , random_state = 0 , n_samples = n_samples , allow_unlabeled = True ) #NEWLINE# ( _ , y2 ) = make_multilabel_classification ( n_features = 1 , n_classes = n_classes , random_state = 1 , n_samples = n_samples , allow_unlabeled = True ) #NEWLINE# y1 += ( [ 0 ] * n_classes ) #NEWLINE# y2 += ( [ 0 ] * n_classes ) #NEWLINE# y1_sparse_indicator = sp . coo_matrix ( y1 ) #NEWLINE# y2_sparse_indicator = sp . coo_matrix ( y2 ) #NEWLINE# for name in MULTILABELS_METRICS : #NEWLINE# #INDENT# metric = ALL_METRICS [ name ] #NEWLINE# if isinstance ( metric , partial ) : #NEWLINE# #INDENT# metric . __module__ = 'tmp' #NEWLINE# metric . __name__ = name #NEWLINE# #UNINDENT# measure = metric ( y2 , y2 ) #NEWLINE# assert_almost_equal ( metric ( y1_sparse_indicator , y2_sparse_indicator ) , measure , err_msg = ( '%s failed representation invariance  between dense and sparse indicator formats.' % name ) )