2
confusion_table = table(actuals, predicted_values)
print(confusion_table)

       predicted_values
actuals   0   1
      0 102 110
      1  48 440

混同行列の順序を反転させたい.ie行と列の1,0

                            predicted
expected output actuals     1  0
                      1
                      0

これを変更するにはどうすればよいですか?

4

2 に答える 2

1

もう 1 つのオプションは、元の列/ベクトルを に変換しfactor、その順序でレベルを指定してから、table.

table(factor(0:1, levels=1:0), factor(0:1, levels=1:0))

#   1 0
# 1 1 0
# 0 0 1
于 2015-10-04T05:35:03.387 に答える