相关疑难解决方法(0)

Balanced_accuracy 不是 scikit-learn 中的有效评分值

超级类似于这篇文章:ValueError: 'balanced_accuracy' is not a valid score value in scikit-learn

我在用:

scoring = ['precision_macro', 'recall_macro', 'balanced_accuracy_score']
clf = DecisionTreeClassifier(random_state=0)
scores = cross_validate(clf, X, y, scoring=scoring, cv=10, return_train_score=True)
Run Code Online (Sandbox Code Playgroud)

我收到错误:

ValueError: 'balanced_accuracy_score' 不是有效的评分值。使用 sorted(sklearn.metrics.SCORERS.keys()) 获取有效选项。

我做了推荐的解决方案并升级了scikit(在环境中): 在此处输入图片说明

当我检查可能的得分手时:

sklearn.metrics.SCORERS.keys()
dict_keys(['explained_variance', 'r2', 'max_error', 'neg_median_absolute_error', 'neg_mean_absolute_error', 'neg_mean_squared_error', 'neg_mean_squared_log_error', 'neg_root_mean_squared_error', 'neg_mean_poisson_deviance', 'neg_mean_gamma_deviance', 'accuracy', 'roc_auc', 'roc_auc_ovr', 'roc_auc_ovo', 'roc_auc_ovr_weighted', 'roc_auc_ovo_weighted', 'balanced_accuracy', 'average_precision', 'neg_log_loss', 'neg_brier_score', 'adjusted_rand_score', 'homogeneity_score', 'completeness_score', 'v_measure_score', 'mutual_info_score', 'adjusted_mutual_info_score', 'normalized_mutual_info_score', 'fowlkes_mallows_score', 'precision', 'precision_macro', 'precision_micro', 'precision_samples', 'precision_weighted', 'recall', 'recall_macro', 'recall_micro', 'recall_samples', 'recall_weighted', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', …
Run Code Online (Sandbox Code Playgroud)

python scikit-learn

5
推荐指数
1
解决办法
1602
查看次数

标签 统计

python ×1

scikit-learn ×1