skfolio/skfolio-sklearn-cross-val-predict
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| skfolio | warning | unsafe, with xpd check --fix --unsafe-fixes |
skfolio 1.14.4+ |
scikit-learn's cross_val_predict can reject skfolio financial splitters or convert portfolio predictions to a NumPy array.
from sklearn.model_selection import cross_val_predictresult = cross_val_predict(model, returns, cv=walk)from skfolio.model_selection import cross_val_predictresult = cross_val_predict(model, returns, cv=walk)What the rule reports
Section titled “What the rule reports”skfolio returns a MultiPeriodPortfolio for WalkForward and a Population for combinatorial or randomized portfolio backtests. Check downstream code when changing the return type.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to call cross_val_predict from skfolio.model_selection when it is imported.
Diagnostic message
Section titled “Diagnostic message”scikit-learn cross_val_predict raises ValueError with WalkForward, CombinatorialPurgedCV and MultipleRandomizedCV in skfolio. Use skfolio.model_selection.cross_val_predict.See all rules in the skfolio pack.