predict_proba for a cross-validated model

This is now implemented as part of scikit-learn version 0.18. You can pass a ‘method’ string parameter to the cross_val_predict method. Documentation is here.

Example:

proba = cross_val_predict(logreg, X, y, cv=cv, method='predict_proba')

Also note that this is part of the new sklearn.model_selection package so you will need this import:

from sklearn.model_selection import cross_val_predict

Leave a Comment