我是机器学习的新手,正在对我的模型使用 k 折交叉验证。我正在使用 cross_val_score .
文档指出 cross_val_score
返回一个“分数”数组。分数和准确率一样吗?我真的无法在网上找到这个问题的答案。
最佳答案
cross_val_score
中使用的“分数”可以通过函数的 scoring
参数指定。来自docs (与问题中的链接相同):
scoring : string, callable or None, optional, default: None A string (see model evaluation documentation) or a scorer callable object / function with signature scorer(estimator, X, y) which should return only a single value.
Similar to cross_validate but only a single metric is permitted.
If None, the estimator’s default scorer (if available) is used.
因此,您可以将准确性作为分数传递,但如果您未指定任何具体分数,则将使用估算器的默认值。如果我没记错的话,估计器的默认值通常只是它的损失函数。由于您在讨论准确性,我假设您正在处理分类问题,其中损失是交叉熵……所以,这就是您可能看到的。
您可以通过计算损失并与您的分数进行比较来验证这一点。
关于scikit-learn - scikit-learn 的 cross_val_score 中的 'score' 是什么意思?是否意味着准确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57839773/