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

在计算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’.

你可能感兴趣的:(python3)