MLPPredictor#

class hybrid_aif.MLPPredictor[source]#

Bases: Module

MLP over concatenated parents → a raw output vector, with no density of its own.

The trunk the other classes here are built from; paired with a loss it is a head without a density family (PredictorHead). depth hidden layers of width units, each optionally layer-normed (eps 1e-3) then activated, and a final linear to out_dim.

layers: tuple[Linear, ...]#

The linear layers (the trainable leaves).

norms: tuple[LayerNorm, ...]#

One layer norm per activated layer, or () for none.

parent_dims: tuple[int, ...]#

The width of each parent vector, in parent order.

out_dim: int#

The width of the output vector.

activation: str = 'silu'#

The activation of the hidden layers.

out_activation: bool = False#

True norms and activates the final layer too, making the trunk an encoder.

frozen: bool = False#

The trainable marking: True keeps the weights fixed.

symlog_inputs: bool = False#

True applies symlog() to the concatenated parents before the first layer.

classmethod from_shapes(
parent_dims,
out_dim,
*,
key,
width,
depth=2,
activation='silu',
norm=True,
out_activation=False,
out_scale=1.0,
frozen=False,
symlog_inputs=False,
init='default',
)[source]#

A randomly-initialized trunk: depth hidden layers of width units.

width is required. norm=True puts a LayerNorm (eps 1e-3) before each activation. out_scale scales the final layer’s weights and zeroes its bias (0.0 starts at the constant zero prediction). init is as in _linear_stack().

property parent_dim: int#

Width of the concatenated parent vector.

property learnable: bool#

Capability: a non-frozen trunk’s weights are a trainable block.

init_opt_state()[source]#

Fresh optimizer state — one entry of a LearnState.

absorb(stats, opt_state, lr=1.0, decay=1.0)[source]#

One optax step from a gradient pytree: (trunk, opt_state).

__init__(
layers,
norms,
parent_dims,
out_dim,
activation='silu',
out_activation=False,
frozen=False,
symlog_inputs=False,
)#