rules/skfolio/skfolio-factor-model-class.md
The skfolio FactorModel dataclass holds fitted results. Fit a TimeSeriesFactorModel prior with the factor matrix in the keyword-only factors argument.
diff
| 1 | -MeanRisk(prior_estimator=FactorModel()) |
| 2 | -TimeSeriesFactorModel().fit(returns, factor_returns) |
| 3 | +MeanRisk(prior_estimator=TimeSeriesFactorModel()) |
| 4 | +TimeSeriesFactorModel().fit(returns, factors=factor_returns) |
What the rule reports
To pass factors through an optimizer, request factors on the prior and pass the matrix to the optimizer's fit.
How to fix it
Use xpd check --fix --unsafe-fixes to replace FactorModel() with TimeSeriesFactorModel() and to pass the positional factor matrix as factors=.