3.7.3.4. renom.utility.evaluation.confusion_matrix package

class ConfusionMatrix ( y_true , y_pred , label=None )

混合行列を表示し、中身を返す

パラメータ:
  • y_true ( array ) – 正解ラベル
  • y_pred ( array ) – 予測ラベル
  • label ( array ) – このラベルリストの順番に沿って混合行列が作成される
Example:
>>> from renom.utility.evaluation.confusion_matrix.confusion_matrix import ConfusionMatrix
>>> import numpy as np
>>> arr1=np.array(['cat','tiger','tiger','cat','dog','dog','dog','cat','tiger','dog','cat'])
>>> arr2=np.array(['cat','tiger','cat','cat','dog','tiger','dog','cat','tiger','cat','cat'])
>>> hoge = ConfusionMatrix(y_pred=arr2,y_true=arr1,label=['dog','cat','tiger'])
>>> conf_arr = hoge.evaluate()
| true\pred        dog       cat     tiger
|
|       dog          2         1         1
|       cat          0         4         0
|     tiger          0         1         2
>>> conf_arr
array([[2, 1, 1],
       [0, 4, 0],
       [0, 1, 2]])
evaluate ( )

混合行列を表示し、中身を返す

Return ndarray:

混合行列

Example:
>>> from renom.utility.evaluation.confusion_matrix.confusion_matrix import ConfusionMatrix
>>> import numpy as np
>>> arr1=np.array(['cat','tiger','tiger','cat','dog','dog','dog','cat','tiger','dog','cat'])
>>> arr2=np.array(['cat','tiger','cat','cat','dog','tiger','dog','cat','tiger','cat','cat'])
>>> hoge = ConfusionMatrix(y_pred=arr2,y_true=arr1,label=['dog','cat','tiger'])
>>> conf_arr = hoge.evaluate()
| true\pred        dog       cat     tiger
|
|       dog          2         1         1
|       cat          0         4         0
|     tiger          0         1         2
>>> conf_arr
array([[2, 1, 1],
       [0, 4, 0],
       [0, 1, 2]])
confusion_matrix ( y_true , y_pred , label=None )

混合行列を表示し、中身を返す

パラメータ:
  • y_true ( array ) – 正解ラベル
  • y_pred ( array ) – 予測ラベル
  • label ( array ) – このラベルリストの順番に沿って混合行列が作成される
Return ndarray:

混合行列

Example:
>>> from renom.utility.evaluation.confusion_matrix.confusion_matrix import confusion_matrix
>>> import numpy as np
>>> arr1=np.array(['cat','tiger','tiger','cat','dog','dog','dog','cat','tiger','dog','cat'])
>>> arr2=np.array(['cat','tiger','cat','cat','dog','tiger','dog','cat','tiger','cat','cat'])
>>> conf_arr = confusion_matrix(y_pred = arr2,y_true = arr1,label = ['dog','cat','tiger'])
| true\pred        dog       cat     tiger
|
|       dog          2         1         1
|       cat          0         4         0
|     tiger          0         1         2
>>> conf_arr
array([[2, 1, 1],
       [0, 4, 0],
       [0, 1, 2]])