def test_classification_report_imbalanced_multiclass():
 iris = datasets.load_iris()
 (y_true, y_pred, _) = make_prediction(dataset=iris, binary=False)
 expected_report = 'pre rec spe f1 geo iba sup setosa 0.83 0.79 0.92 0.81 0.86 0.74 24 versicolor 0.33 0.10 0.86 0.15 0.44 0.19 31 virginica 0.42 0.90 0.55 0.57 0.63 0.37 20 avg / total 0.51 0.53 0.80 0.47 0.62 0.41 75'
 report = classification_report_imbalanced(y_true, y_pred, labels=np.arange(len(iris.target_names)), target_names=iris.target_names)
 assert_equal(_format_report(report), expected_report)
 expected_report = 'pre rec spe f1 geo iba sup 0 0.83 0.79 0.92 0.81 0.86 0.74 24 1 0.33 0.10 0.86 0.15 0.44 0.19 31 2 0.42 0.90 0.55 0.57 0.63 0.37 20 avg / total 0.51 0.53 0.80 0.47 0.62 0.41 75'
 report = classification_report_imbalanced(y_true, y_pred)
 assert_equal(_format_report(report), expected_report)

def test_classification_report_imbalanced_multiclass ( ) : iris = datasets . load_iris ( ) ( y_true , y_pred , _ ) = make_prediction ( dataset = iris , binary = False ) expected_report = 'pre rec spe f1 geo iba sup setosa 0.83 0.79 0.92 0.81 0.86 0.74 24 versicolor 0.33 0.10 0.86 0.15 0.44 0.19 31 virginica 0.42 0.90 0.55 0.57 0.63 0.37 20 avg / total 0.51 0.53 0.80 0.47 0.62 0.41 75' report = classification_report_imbalanced ( y_true , y_pred , labels = np . arange ( len ( iris . target_names ) ) , target_names = iris . target_names ) assert_equal ( _format_report ( report ) , expected_report ) expected_report = 'pre rec spe f1 geo iba sup 0 0.83 0.79 0.92 0.81 0.86 0.74 24 1 0.33 0.10 0.86 0.15 0.44 0.19 31 2 0.42 0.90 0.55 0.57 0.63 0.37 20 avg / total 0.51 0.53 0.80 0.47 0.62 0.41 75' report = classification_report_imbalanced ( y_true , y_pred ) assert_equal ( _format_report ( report ) , expected_report )
test classification report for multiclass problem .