Python sklearn中模型得分函数的输出

Python sklearn中模型得分函数的输出,python,python-3.x,scikit-learn,Python,Python 3.x,Scikit Learn,我试图评估一个模型的性能,但我似乎无法掌握实际返回的分数。文件说: Returns the mean accuracy on the given test data and labels. In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly pred

我试图评估一个模型的性能,但我似乎无法掌握实际返回的分数。文件说:

Returns the mean accuracy on the given test data and labels.
In multi-label classification, this is the subset accuracy which is a harsh 
metric since you require for each sample that each label set be correctly predicted.
这不是直观的-这里的准确性是什么?我想看看均方误差的值来检查模型。那么,如果我的模型的MSE为30%,这是否意味着它的“分数”为70%?如果我运行一个模型,通过交叉验证选择参数,评分函数设置为
均方误差
,该“评分”会基于此进行计算吗

我似乎找不到关于这方面的任何文档,我真的非常感谢您的帮助

谢谢大家!

是正确分类的示例的百分比

>>> from sklearn.metrics import accuracy_score
>>> y_pred = [0, 2, 1, 3]
>>> y_true = [0, 1, 2, 3]
>>> accuracy_score(y_true, y_pred)
0.5
这里有4个正确分类的示例中的2个,因此精度为2/4=0.5

如果您使用的是,那么您的问题就是回归问题。在您的应用程序中使用此度量将发现最小的错误

诀窍是,在进行gridsearch交叉验证时,目标是最大化分数函数。但是最大化错误将是一个坏主意,因此为了与sklearnapi保持一致,他们将错误的反面作为分数。通过这样做,您可以通过最小化错误来最大化您的分数

因此,如果你想显示你的错误,请确保你取得了分数的绝对值

>>> abs(grid_search.best_score_)
3.2