sklearn.model_selection.cross_val_predict(estimator, X, y=None, groups=None, cv=’warn’, n_jobs=None, verbose=0, fit_params=None, pre_dispatch=‘2*n_jobs’, method=’predict’)
[source]
Generate cross-validated estimates for each input data point
It is not appropriate to pass these predictions into an evaluation metric. Use cross_validate
to measure generalization error.
Read more in the User Guide.
Parameters: |
|
---|---|
Returns: |
|
See also
cross_val_score
cross_validate
In the case that one or more classes are absent in a training portion, a default score needs to be assigned to all instances for that class if method
produces columns per class, as in {‘decision_function’, ‘predict_proba’, ‘predict_log_proba’}. For predict_proba
this value is 0. In order to ensure finite output, we approximate negative infinity by the minimum finite float value for the dtype in other cases.
>>> from sklearn import datasets, linear_model >>> from sklearn.model_selection import cross_val_predict >>> diabetes = datasets.load_diabetes() >>> X = diabetes.data[:150] >>> y = diabetes.target[:150] >>> lasso = linear_model.Lasso() >>> y_pred = cross_val_predict(lasso, X, y, cv=3)
sklearn.model_selection.cross_val_predict
© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.cross_val_predict.html