What is "check_scoring" in sklearn.metrics?

504 views Asked by At

What is check_scoring in sklearn.metrics, how does it work, and what is it its difference with make_scorer?

1

There are 1 answers

0
Alexander L. Hayes On BEST ANSWER

check_scoring is mainly used as an internal method to ensure score methods are valid.

It returns the same type of instance as a make_scorer, or a default score if None is provided:

>>> 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)

So: you'll probably use make_scorer more often.

See also: scoring in scikit-learn's glossary