Skip to content

skfolio/skfolio-fit-loop-vs-online

Rule skfolio-fit-loop-vs-online
Pack skfolio
Severity info
Fix none, edit by hand
Library versions skfolio 1.14.4 and later

Repeatedly calling fit resets a skfolio estimator's state. An online evaluator can reuse state through partial_fit on an expanding schedule.

for train, test in WalkForward(10, 30, expand_train=True).split(returns):
model.fit(returns.iloc[train])
result = online_predict(model, returns, warmup_size=30, test_size=10)

The rule covers direct expanding WalkForward loops. Check prior support and the rebalance schedule before migrating.

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

This skfolio optimizer supports partial_fit. Consider online_predict or online_score for expanding training windows when the prior supports incremental updates.

Browse the other rules of the skfolio pack.