quantlab.factor.predefined.membership_mask#
Membership-masked factor: another factor kept only where its symbol is an index member at t.
A model built for an index reads a market-wide factor store on its roster
(RosterFactor), and a roster is every symbol ever a member. A
cross-sectional model takes every symbol with a finite feature at bar t as
context, so on the roster alone the cross-section at t holds symbols that
are not members at t, among them those that join the index later: a choice
made with future information. MembershipMaskedFactor wraps any factor
and sets a cell to NaN wherever the symbol is not a member on the bar’s own
date, the rule MembershipMaskedLabel and MembershipMaskedPredictor
apply to the label and the predictions. A non-member then has no finite
feature at t and is left out of the bar’s cross-section.
The mask goes on the computed factor, never on the prices: the wrapped
factor is computed on unmasked prices, so a symbol that joins at t has a
value at t from its full price history and enters the cross-section at t.
The wrapper is a factor view (quantlab.factor.view): it reads the
wrapped factor’s store, and only the factor owning every variable of that
store writes it (ADR 0029).
Classes
The outputs of |