sklearn.metrics中的"check_scoring"是什么?

What is "check_scoring" in sklearn.metrics?

sklearn.metrics中的check_scoring是什么,它是如何工作的,它与make_scorer有什么区别?

check_scoring主要作为内部方法使用,保证评分方法有效

它 returns 与 make_scorer 相同类型的实例,或者如果提供 None 则为默认分数:

>>> from sklearn.tree import DecisionTreeClassifier
>>> from sklearn.tree import DecisionTreeRegressor
>>> clf = DecisionTreeClassifier()
>>> regr = DecisionTreeRegressor()

>>> from sklearn.metrics import check_scoring

>>> check_scoring(clf, scoring="recall")
make_scorer(recall_score, average=binary)

>>> check_scoring(regr, scoring="r2")
make_scorer(r2_score)

因此:您可能会更频繁地使用 make_scorer

另见scoring in scikit-learn's glossary