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_mean holds the incoming weights: the matrix connecting the layer below (child) into this layer (parent). The bottom layer (index 0) has weights_mean=None because no layer sits below it. Shape: (n_child, n_self[+1]); the optional +1 column carries the bias when add_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_mean is 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, or None. weights_mean then 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_mean always connects the layer directly below) is a special case with value_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_weights connects that child.

  • volatility_weights (jax.Array | None) – Volatility-coupling matrix \(\kappa\), shape (n_child, n_self), connecting the volatility child named by volatility_child_idx into this layer. Fixed at construction — never part of the learned weights (excluded from VectorisedNetwork.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:
Return type:

None

Methods

__init__(state, params, weights_mean, ...[, ...])

Attributes

value_child_idx

volatility_child_idx

volatility_weights

weights_precision_delta

state

params

weights_mean

coupling_fn

add_constant_input

has_volatility_parent

is_input_layer

fully_connected

kind