PredictorHead#
- class hybrid_aif.PredictorHead[source]#
Bases:
ModuleAn
MLPPredictorplus the name of the loss that reads its output.What a
likelihoodslot holds for a head without a density family:symlog_msereconstructs a vector,symlog_discpredicts a scalar throughnum_binstwo-hot bins over[bin_low, bin_high]in symlog space,binarypredicts a Bernoulli from one logit.nll()is the training loss andpredict()the decoded prediction, in the value’s own units. Not a Distribution or aConditional, and role-free. The three loss names are a closed list; an unknown name raises.Design: docs/design/amortization-p0-addendum.md §2
- trunk: MLPPredictor#
The network whose output the loss reads.
- classmethod from_shapes(
- parent_dims,
- *,
- loss,
- key,
- out_dim=None,
- num_bins=255,
- bin_low=-20.0,
- bin_high=20.0,
- width,
- depth=2,
- activation='silu',
- norm=True,
- out_scale=1.0,
- frozen=False,
- symlog_inputs=False,
- init='default',
A randomly-initialized head.
out_dimis required forsymlog_mseand rejected by the other two losses, which fix the trunk’s width (one logit per bin; one logit).widthis required; the trunk arguments areMLPPredictor.from_shapes()’s.
- predict(parents)[source]#
The decoded prediction, in the predicted value’s own units.
symexpof a symlog_mse output, the expected bin of a symlog_disc head,σ(logit)for a binary head.
- __init__(trunk, loss, num_bins=255, bin_low=-20.0, bin_high=20.0)#