hamming_loss cross_val_score 不支持?

hamming_loss not support in cross_val_score?

我正在使用 sklearn 和 skmultilearn 做一些关于多标签的研究。

我只是想知道为什么hamming_loss不能在cross_val_score中使用,因为它真的可以单独使用。

documentation of cross_val_score中指定:

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

这里可以使用的字符串是specified in section 3.3.1.1 here. These strings showed here are internally converted to scoring function objects using the make_scorer

hamming_loss 不在那些字符串中,但是我们可以在它上面使用 make_scorer 来定义我们的评分函数对象,然后可以在 cross_val_score()

这样使用:

from sklearn.metrics import make_scorer
output_scores = cross_val_score(lasso, X, y, scoring = make_scorer(hamming_loss,greater_is_better=False))