skfolio/skfolio-base-hierarchical-check
| Rule | skfolio-base-hierarchical-check |
|---|---|
| Pack | skfolio |
| Severity | warning |
| Fix | unsafe, with xpd check --fix --unsafe-fixes |
| Library versions | skfolio 1.14.4 and later |
skfolio HRP, HERC and Schur no longer inherit from BaseHierarchicalOptimization.
isinstance(model, BaseHierarchicalOptimization)isinstance(model, (HierarchicalRiskParity, HierarchicalEqualRiskContribution, SchurComplementary))What the rule reports
Section titled “What the rule reports”Use BaseOptimization when the check should include all optimizers. When porting a custom subclass, implement any risk or bound calculations it inherited from the old base.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to replace BaseHierarchicalOptimization in a class base list with BaseOptimization when BaseOptimization is imported. Update isinstance and issubclass checks by hand.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
skfolio HRP, HERC and Schur all return False in checks against BaseHierarchicalOptimization. Use BaseOptimization for any optimizer or check specific classes.Browse the other rules of the skfolio pack.