Skip to content

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()))

Put the moment estimators in EmpiricalPrior and give it to the optimizer. ConvexOptimization is an abstract base class.

Use xpd check --fix --unsafe-fixes to wrap a single mu_estimator or covariance_estimator keyword in prior_estimator=EmpiricalPrior(...) when EmpiricalPrior is imported.

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.