3.7.3.2. renom.utility.evaluation.classification_report package

class ClassificationReport ( y_true , y_pred )

それぞれのクラスに対するprecision, recall, F1の値を表示する

パラメータ:
  • y_true ( array ) – 正しいクラス
  • y_pred ( array ) – 予測されたクラス
Example:
>>> from renom.utility.evaluation.classification_report.classification_report import ClassificationReport
>>> y_true = ['cat', 'dog', 'tiger', 'tiger', 'tiger']
>>> y_pred = ['cat', 'cat', 'tiger', 'tiger', 'dog']
>>> hoge = ClassificationReport(y_true = y_true, y_pred = y_pred)
>>> arr = hoge.evaluate()
|              precision    recall  f1-score   support
|
|         cat       0.50      1.00      0.67         1
|         dog       0.00      0.00      0.00         1
|       tiger       1.00      0.67      0.80         3
|
| avg / total       0.70      0.60      0.61         5
>>> arr
array([['', 'precision', 'recall', 'f1-score', 'support'],
       ['cat', '0.50', '1.00', '0.67', '1'],
       ['dog', '0.00', '0.00', '0.00', '1'],
       ['tiger', '1.00', '0.67', '0.80', '3'],
       ['avg / total', '0.70', '0.60', '0.61', '5']], 
       dtype='|S32')
evaluate ( )

それぞれのクラスに対するprecision, recall, F1の値を表示する

Return ndarray:

分類結果

Example:
>>> from renom.utility.evaluation.classification_report.classification_report import ClassificationReport
>>> y_true = ['cat', 'dog', 'tiger', 'tiger', 'tiger']
>>> y_pred = ['cat', 'cat', 'tiger', 'tiger', 'dog']
>>> hoge = ClassificationReport(y_true = y_true, y_pred = y_pred)
>>> arr = hoge.evaluate()
|              precision    recall  f1-score   support
|
|         cat       0.50      1.00      0.67         1
|         dog       0.00      0.00      0.00         1
|       tiger       1.00      0.67      0.80         3
|
| avg / total       0.70      0.60      0.61         5
>>> arr
array([['', 'precision', 'recall', 'f1-score', 'support'],
       ['cat', '0.50', '1.00', '0.67', '1'],
       ['dog', '0.00', '0.00', '0.00', '1'],
       ['tiger', '1.00', '0.67', '0.80', '3'],
       ['avg / total', '0.70', '0.60', '0.61', '5']], 
       dtype='|S32')
classification_report ( y_true , y_pred )

それぞれのクラスに対するprecision, recall, F1の値を表示する

パラメータ:
  • y_true ( array ) – 正しいクラス
  • y_pred ( array ) – 予測されたクラス
Return ndarray:

分類結果

Example:
>>> from renom.utility.evaluation.classification_report.classification_report import classification_report
>>> y_true = ['cat','dog','tiger','tiger','tiger']
>>> y_pred = ['cat','cat','tiger','tiger','dog']
>>> arr = classification_report(y_true = y_true, y_pred = y_pred)
|              precision    recall  f1-score   support
|
|         cat       0.50      1.00      0.67         1
|         dog       0.00      0.00      0.00         1
|       tiger       1.00      0.67      0.80         3
|
| avg / total       0.70      0.60      0.61         5
>>> arr
array([['', 'precision', 'recall', 'f1-score', 'support'],
       ['cat', '0.50', '1.00', '0.67', '1'],
       ['dog', '0.00', '0.00', '0.00', '1'],
       ['tiger', '1.00', '0.67', '0.80', '3'],
       ['avg / total', '0.70', '0.60', '0.61', '5']], 
       dtype='|S32')