解决:ValueError: multi_class must be in (‘ovo‘, ‘ovr‘)

  • Post author:
  • Post category:其他


在计算ROC的时候添加参数roc_auc_score(all_labels, all_prob,

multi_class=‘ovo’

)

官方参数解释:

multi_class{‘raise’, ‘ovr’, ‘ovo’}, default=’raise’

Only used for multiclass targets. Determines the type of configuration to use. The default value raises an error, so either ‘ovr’ or ‘ovo’ must be passed explicitly.

‘ovr’:

Stands for One-vs-rest. Computes the AUC of each class against the rest [3] [4]. This treats the multiclass case in the same way as the multilabel case. Sensitive to class imbalance even when average == ‘macro’, because class imbalance affects the composition of each of the ‘rest’ groupings.

‘ovo’:

Stands for One-vs-one. Computes the average AUC of all possible pairwise combinations of classes [5]. Insensitive to class imbalance when average == ‘macro’.



版权声明:本文为lei_qi原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。