Skip to content

skfolio/skfolio-panel-inactive-policy

Pack Severity Fix Versions
skfolio error unsafe, with xpd check --fix --unsafe-fixes skfolio 1.14.4+

skfolio AssetPanel distinguishes inactive pairs from missing values for active assets. Its field policy controls what values are valid outside active_mask.

FieldCategorical(values=codes, levels=labels, inactive_policy=InactivePolicy.ZERO)
FieldCategorical(values=codes, levels=labels, inactive_policy=InactivePolicy.MISSING)

Reserve -1 for missing categorical codes. For numeric fields, use NaN under MISSING, explicitly construct a field with ZERO when zero is meaningful, or use IGNORE when intentionally retaining inactive values. CharacteristicsFactorModel expects the panel as its characteristics input.

Use xpd check --fix --unsafe-fixes to switch InactivePolicy.ZERO on FieldCategorical to InactivePolicy.MISSING and to convert string inactive_policy values to InactivePolicy enum members.

skfolio FieldCategorical raises ValueError for InactivePolicy.ZERO because code 0 is a category. Use MISSING and encode inactive entries as -1.

See all rules in the skfolio pack.