def test_classification_report_imbalanced_multiclass_with_unicode_label():
 (y_true, y_pred, _) = make_prediction(binary=False)
 labels = np.array([u'blue\xa2', u'green\xa2', u'red\xa2'])
 y_true = labels[y_true]
 y_pred = labels[y_pred]
 expected_report = u'pre rec spe f1 geo iba sup blue\xa2 0.83 0.79 0.92 0.81 0.86 0.74 24 green\xa2 0.33 0.10 0.86 0.15 0.44 0.19 31 red\xa2 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'
 if (np_version[:3] < (1, 7, 0)):
  expected_message = 'NumPy < 1.7.0 does not implement searchsorted on unicode data correctly.'
  assert_raise_message(RuntimeError, expected_message, classification_report_imbalanced, y_true, y_pred)
 else:
  report = classification_report_imbalanced(y_true, y_pred)
  assert_equal(_format_report(report), expected_report)

def test_classification_report_imbalanced_multiclass_with_unicode_label ( ) : ( y_true , y_pred , _ ) = make_prediction ( binary = False ) labels = np . array ( [ u'blue\xa2' , u'green\xa2' , u'red\xa2' ] ) y_true = labels [ y_true ] y_pred = labels [ y_pred ] expected_report = u'pre rec spe f1 geo iba sup blue\xa2 0.83 0.79 0.92 0.81 0.86 0.74 24 green\xa2 0.33 0.10 0.86 0.15 0.44 0.19 31 red\xa2 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' if ( np_version [ : 3 ] < ( 1 , 7 , 0 ) ) : expected_message = 'NumPy < 1.7.0 does not implement searchsorted on unicode data correctly.' assert_raise_message ( RuntimeError , expected_message , classification_report_imbalanced , y_true , y_pred ) else : report = classification_report_imbalanced ( y_true , y_pred ) assert_equal ( _format_report ( report ) , expected_report )
test classification report with unicode label .