sklearn validation_curve 中的默认评分函数是什么?
What's the default score function in validation_curve in sklearn?
我是运行下面这行代码:
validation_curve(PolynomialRegression(),X,y,
param_name='polynomialfeatures__degree',
param_range=degree,cv=7)
而且,当我画 validation_curve 时,我得到的更高学位的分数非常低。当我检查 documentation 时,它显示
scoring:str or callable, default=None A str (see model evaluation
documentation) or a scorer callable object / function with signature
scorer(estimator, X, y).
我只是想知道 sklearn validation_curve 中的默认评分函数是什么?如果是 None,那么他们如何计算分数?
它默认为估计器的 score
方法,而后者通常是准确性(分类)或 R2(回归)。
在source for validation_curve
, it calls check_scorer
, which in part contains中:
elif scoring is None:
if hasattr(estimator, 'score'):
return _passthrough_scorer
其中 _passthrough_scorer
just wraps 估算器的 score
:
def _passthrough_scorer(estimator, *args, **kwargs):
"""Function that wraps estimator.score"""
return estimator.score(*args, **kwargs)
我是运行下面这行代码:
validation_curve(PolynomialRegression(),X,y,
param_name='polynomialfeatures__degree',
param_range=degree,cv=7)
而且,当我画 validation_curve 时,我得到的更高学位的分数非常低。当我检查 documentation 时,它显示
scoring:str or callable, default=None A str (see model evaluation documentation) or a scorer callable object / function with signature scorer(estimator, X, y).
我只是想知道 sklearn validation_curve 中的默认评分函数是什么?如果是 None,那么他们如何计算分数?
它默认为估计器的 score
方法,而后者通常是准确性(分类)或 R2(回归)。
在source for validation_curve
, it calls check_scorer
, which in part contains中:
elif scoring is None:
if hasattr(estimator, 'score'):
return _passthrough_scorer
其中 _passthrough_scorer
just wraps 估算器的 score
:
def _passthrough_scorer(estimator, *args, **kwargs):
"""Function that wraps estimator.score"""
return estimator.score(*args, **kwargs)