#NEWLINE# def test_multi_output_classification( ) : #NEWLINE# #INDENT# forest = RandomForestClassifier ( n_estimators = 10 , random_state = 1 ) #NEWLINE# multi_target_forest = MultiOutputClassifier ( forest ) #NEWLINE# multi_target_forest . fit ( X , y ) #NEWLINE# predictions = multi_target_forest . predict ( X ) #NEWLINE# assert_equal ( ( n_samples , n_outputs ) , predictions . shape ) #NEWLINE# predict_proba = multi_target_forest . predict_proba ( X ) #NEWLINE# assert_equal ( ( n_samples , n_classes , n_outputs ) , predict_proba . shape ) #NEWLINE# assert_array_equal ( np . argmax ( predict_proba , axis = 1 ) , predictions ) #NEWLINE# for i in range ( 3 ) : #NEWLINE# #INDENT# forest_ = clone ( forest ) #NEWLINE# forest_ . fit ( X , y [ : , i ] ) #NEWLINE# assert_equal ( list ( forest_ . predict ( X ) ) , list ( predictions [ : , i ] ) ) #NEWLINE# assert_array_equal ( list ( forest_ . predict_proba ( X ) ) , list ( predict_proba [ : , : , i ] ) )