Anticipator — module#
Contrafactual Anticipators#
Wrappers that synthesize structured counterfactual futures on top of a base projector and optional perturbations.
- class qmlhc.predictors.anticipator.AnticipatorConfig(branches=3, symmetric=True)[source]#
Bases:
objectStatic configuration controlling counterfactual generation semantics.
- Parameters:
- class qmlhc.predictors.anticipator.ContrafactualAnticipator(projector, perturbations=None, config=None)[source]#
Bases:
objectGenerate structured counterfactual futures on top of a base projector.
Given a current state
s_t, first obtains a base set of futures fromProjector.project. Then, for each user-provided perturbation, it adds a single variant (and optionally its symmetric mirror) around the base center.Notes
The final future set is the concatenation of: - the projector’s base set
(K, D), - one row per perturbation, - (optionally) one mirrored row per perturbation.- generate(s_t)[source]#
Produce a combined future set
(K', D)from base projection and variants.Steps#
Call the base projector to obtain
base_setwith shape(K, D).If perturbations are provided, compute the center as
mean(base_set, axis=0).For each perturbation
p, appendp(center)as a new row.If
symmetricis enabled, also append the mirrored row2 * center - p(center).