Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm running the following line of code:

validation_curve(PolynomialRegression(),X,y,
                 param_name='polynomialfeatures__degree',
                 param_range=degree,cv=7)

And, when I draw the validation_curve I get very negative scores for higher degrees. When I checked the documentation, it stated

scoring:str or callable, default=None A str (see model evaluation documentation) or a scorer callable object / function with signature scorer(estimator, X, y).

I'm just wondering what is the default score function in validation_curve in sklearn? If it's None, then how can they compute a score?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

It defaults to the score method of the estimator, which in turn is often either accuracy (classification) or R2 (regression).

In the source for validation_curve, it calls check_scorer, which in part contains:

    elif scoring is None:
        if hasattr(estimator, 'score'):
            return _passthrough_scorer

where _passthrough_scorer just wraps the estimator's score:

def _passthrough_scorer(estimator, *args, **kwargs):
    """Function that wraps estimator.score"""
    return estimator.score(*args, **kwargs)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...