sklearn.naive_bayes.GaussianNB()
模块中的score()
方法和sklearn 中的
模块?两者似乎相同。对吗?accuracy_score
方法有什么区别。指标
最佳答案
一般来说,不同的模型有返回不同指标的评分方法。这是为了允许分类器指定他们认为最适合他们的评分指标(因此,例如,最小二乘回归分类器将有一个 score
方法返回类似于平方误差之和的东西).在 GaussianNB
的情况下,文档说它的评分方法:
Returns the mean accuracy on the given test data and labels.
accuracy_score
方法表示其返回值取决于normalize
参数的设置:
If False, return the number of correctly classified samples. Otherwise, return the fraction of correctly classified samples.
所以在我看来,如果您将 normalize
设置为 True
,您将获得与 GaussianNB.score
方法相同的值.
确认我的猜测的一个简单方法是构建一个分类器并调用 score
和 normalize = True
和 accuracy_score
并查看它们是否匹配。是吗?
关于python - sklearn 中 score 和 accuracy_score 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40726899/