标签:cti ref gen href class svm tps tle tab
sklearn.metrics.
make_scorer
(score_func, greater_is_better=True, needs_proba=False, needs_threshold=False, **kwargs)[source]?
>>> from sklearn.metrics import fbeta_score, make_scorer
>>> ftwo_scorer = make_scorer(fbeta_score, beta=2)
>>> ftwo_scorer
make_scorer(fbeta_score, beta=2)
>>> from sklearn.model_selection import GridSearchCV
>>> from sklearn.svm import LinearSVC
>>> grid = GridSearchCV(LinearSVC(), param_grid={‘C‘: [1, 10]},
... scoring=ftwo_scorer)
fbeta_score 可以自定义。
>>> from sklearn.metrics import fbeta_score
>>> y_true = [0, 1, 2, 0, 1, 2]
>>> y_pred = [0, 2, 1, 0, 0, 1]
>>> fbeta_score(y_true, y_pred, average=‘macro‘, beta=0.5)
标签:cti ref gen href class svm tps tle tab
原文地址:http://www.cnblogs.com/xinping-study/p/7472950.html