skfolio/skfolio-estimator-on-optimizer
| Rule | skfolio-estimator-on-optimizer |
|---|---|
| Pack | skfolio |
| Severity | error |
| Fix | unsafe, with xpd check --fix --unsafe-fixes |
| Library versions | skfolio 1.14.4 and later |
skfolio MeanRisk and RiskBudgeting take a prior estimator that produces a joint estimate of returns and covariance.
MeanRisk(mu_estimator=EWMu())MeanRisk(prior_estimator=EmpiricalPrior(mu_estimator=EWMu()))What the rule reports
Section titled “What the rule reports”Put the moment estimators in EmpiricalPrior and give it to the optimizer. ConvexOptimization is an abstract base class.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to wrap a single mu_estimator or covariance_estimator keyword in prior_estimator=EmpiricalPrior(...) when EmpiricalPrior is imported.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
MeanRisk and RiskBudgeting raise TypeError for direct mu_estimator or covariance_estimator keywords. Configure these estimators in a skfolio EmpiricalPrior.Browse the other rules of the skfolio pack.