quantlab.portfolio.config.TopkDropoutConfig#

class quantlab.portfolio.config.TopkDropoutConfig(direction, topk, n_drop, score_label=None)[source]#

Bases: FrozenConfig

Config of TopkDropoutConstructor: qlib’s TopkDropout.

Examples

>>> cfg = TopkDropoutConfig(direction="long_only", topk=50, n_drop=5)
>>> cfg.score_label is None
True
direction#

"long_only" holds topk names; "long_short" also holds topk shorts, the short side mirrored, the two books disjoint.

n_drop#

Most holdings replaced per book at a rebalance.

score_label = None#

The label whose prediction ranks the symbols. None selects the predictor’s first label.

topk#

Number of names held per book.