pyhgf.typing.vectorised.Layer#
- class pyhgf.typing.vectorised.Layer(state, params, weights_mean, coupling_fn, add_constant_input, has_volatility_parent, is_input_layer, fully_connected, kind, weights_precision_delta=None, value_child_idx=None, volatility_child_idx=None, volatility_weights=None)[source]#
One layer of the vectorised deep network.
weights_meanholds the incoming weights: the matrix connecting the layer below (child) into this layer (parent). The bottom layer (index 0) hasweights_mean=Nonebecause no layer sits below it. Shape:(n_child, n_self[+1]); the optional+1column carries the bias whenadd_constant_input=True.- Parameters:
state (pyhgf.typing.vectorised.LayerState) – The per-layer state (see
LayerState).params (pyhgf.typing.vectorised.LayerParams) – The per-layer static parameters (see
LayerParams).weights_mean (jax.Array | None) – The incoming weights, i.e. the matrix connecting the layer below (child) into this layer, or None for the bottom layer. Also the mean of each weight’s belief where one is installed.
coupling_fn (Callable) – The coupling function applied to the incoming weights.
add_constant_input (bool) – Whether a constant (bias) input column is appended to the weights.
has_volatility_parent (bool) – Whether the layer has a volatility parent.
is_input_layer (bool) – Whether the layer is the input (bottom) layer of the network.
fully_connected (bool) – Whether the incoming weights are fully connected.
kind (str) – The kind of layer, one of
"volatile","binary","categorical", or"continuous".weights_precision_delta (jax.Array | None) – Weight-belief precision, the second parameter of the belief each weight carries:
weights_meanis the belief’s mean and this its accumulated precision above the prior, same shape. The delta over the prior is stored rather than the precision itself because it starts at zero, so a per-step increment far below the prior precision accumulates exactly.value_child_idx (int | None) – Continuous layers only — index (into
VectorisedNetwork.layers) of the layer this layer is the value parent of, orNone.weights_meanthen connects that child into this layer, shape(n_child, n_self), and enters the drift of the child’s predicted mean. The chain convention of volatile networks (weights_meanalways connects the layer directly below) is a special case withvalue_child_idx = self_index - 1.volatility_child_idx (int | None) – Continuous layers only — index of the layer this layer is the volatility parent of, or
None.volatility_weightsconnects that child.volatility_weights (jax.Array | None) – Volatility-coupling matrix \(\kappa\), shape
(n_child, n_self), connecting the volatility child named byvolatility_child_idxinto this layer. Fixed at construction — never part of the learned weights (excluded fromVectorisedNetwork.weights_tuple()).
- __init__(state, params, weights_mean, coupling_fn, add_constant_input, has_volatility_parent, is_input_layer, fully_connected, kind, weights_precision_delta=None, value_child_idx=None, volatility_child_idx=None, volatility_weights=None)#
- Parameters:
state (LayerState)
params (LayerParams)
weights_mean (Array | None)
coupling_fn (Callable)
add_constant_input (bool)
has_volatility_parent (bool)
is_input_layer (bool)
fully_connected (bool)
kind (str)
weights_precision_delta (Array | None)
value_child_idx (int | None)
volatility_child_idx (int | None)
volatility_weights (Array | None)
- Return type:
None
Methods
__init__(state, params, weights_mean, ...[, ...])Attributes
value_child_idxvolatility_child_idxvolatility_weightsweights_precision_deltastateparamsweights_meancoupling_fnadd_constant_inputhas_volatility_parentis_input_layerfully_connectedkind