Skip to content

skfolio/skfolio-metadata-routing-setup

Rule skfolio-metadata-routing-setup
Pack skfolio
Severity info
Fix none, edit by hand
Library versions skfolio 1.14.4 and later

When a parent passes metadata to a skfolio estimator, the consuming estimator may need an explicit request and the scikit-learn configuration must allow routing.

prior = EmpiricalPrior(covariance_estimator=ImpliedCovariance())
model = MeanRisk(prior_estimator=prior)
model.fit(returns, implied_vol=volatility)
set_config(enable_metadata_routing=True)
covariance = ImpliedCovariance().set_fit_request(implied_vol=True)
prior = EmpiricalPrior(covariance_estimator=covariance)
model = MeanRisk(prior_estimator=prior)
model.fit(returns, implied_vol=volatility)

Use the request for the metadata key and method that consume it. Direct ImpliedCovariance.fit accepts implied_vol as an argument. A file with no local routing setup may still receive configuration from its caller.

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

Check skfolio metadata routing for this parent fit. Enable routing when required by your scikit-learn configuration and request the key on the consuming estimator.

Browse the other rules of the skfolio pack.