quantlab.model.predefined.linear#

Qlib’s linear benchmark model.

LinearRegressor reproduces Qlib’s LinearModel (qlib/contrib/model/linear.py) with its Alpha158 benchmark settings (workflow_config_linear_Alpha158.yaml): ordinary least squares, without an intercept, on the features clipped and with missing values filled, against the label’s CSRankNorm. Ridge, lasso and non-negative least squares are the other estimators Qlib offers.

Every estimator is solved from the training rows’ Gram matrix X'X and X'y, accumulated a block of rows at a time, so millions of rows never need a float64 copy.

Classes

LinearRegressor

Qlib's linear model on the rows of the cross-sectional rank target.

Functions

gram

Return (X'X, X'y, sum(X), sum(y), n) in float64, accumulated by blocks of rows.

lasso_gram

scikit-learn's Lasso coefficients from the Gram matrix, by coordinate descent.