[scikit-learn] modifying CV score

Gael Varoquaux gael.varoquaux at normalesup.org
Wed Jan 4 07:50:42 EST 2017


> I've been trying to understand how to use sklearn for this as there is
> no need for me to rewrite the basic CV functions. I'd like to be able
> to use my own custom estimator (so I guess I just need a subclass of
> BaseEstimator with a `fit` method with (X,y) signature?), as well as my
> own modification of the score.

Be aware that scikit-learn assume a few things about estimators. One of
them being that the __init__ should not do anything else than store the
parameters that it is given. 

> I'd be happy to understand the code for an estimator whose fit returns
> `np.zeros(X.shape[1])`

Another assumption is that "fit" always returns self.

The API that defines a scikit-learn object is detailed here:
http://scikit-learn.org/stable/developers/contributing.html#apis-of-scikit-learn-objects


More information about the scikit-learn mailing list