[scikit-learn] modifying CV score

Olivier Grisel olivier.grisel at ensta.org
Wed Jan 4 07:44:22 EST 2017


You can indeed derive from BaseEstimator and implement fit, predict
and optionally score.

Here is the documentation for the expected estimator API:

http://scikit-learn.org/stable/developers/contributing.html#apis-of-scikit-learn-objects

As this is a linear regression model, you can also want to have a look
at the LinearModel and RegressionMixin base classes for inspiration:

https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/linear_model/base.py#L401

Note that the score function should always be "higher is better". The
explained variance ratio and negative mean squared error are valid
scoring functions for model selection in scikit-learn while raw MSE is
not not.

-- 
Olivier


More information about the scikit-learn mailing list