pyhgf.model.builder.LayerConfig#

class pyhgf.model.builder.LayerConfig(size, kind='volatile', add_constant_input=True, fully_connected=True, coupling_fn=None, volatility_parent=True, tonic_volatility=None, tonic_volatility_vol=None)[source]#

Configuration for one layer in a DeepNetwork.

Encapsulates all per-layer settings so they can be serialised to/from JSON, YAML, or other formats. Each field corresponds to a parameter of DeepNetwork.add_layer().

Parameters:
  • size (int)

  • kind (str)

  • add_constant_input (bool)

  • fully_connected (bool)

  • coupling_fn (str | None)

  • volatility_parent (bool)

  • tonic_volatility (float | None)

  • tonic_volatility_vol (float | None)

size#

Number of nodes in the layer.

Type:

int

kind#

Type of nodes: “volatile”, “binary”, or “categorical”.

Type:

str, default “volatile”

add_constant_input#

Whether to add a bias term to the layer’s predictions.

Type:

bool, default True

fully_connected#

Whether the layer is fully connected (dense) or one-to-one.

Type:

bool, default True

coupling_fn#

Name of coupling function (“identity”, “gelu”, “relu”, etc.) or None to use the network-level default. Must be a name that can be resolved via resolve_coupling_fn().

Type:

Optional[str], default None

volatility_parent#

Whether the layer has an internal volatility parent.

Type:

bool, default True

tonic_volatility#

Per-layer override for the value level’s tonic volatility. Only valid when the network is built with tonic_volatility=True, which is what allocates the parameter.

Type:

Optional[float], default None

tonic_volatility_vol#

Per-layer override for tonic_volatility_vol parameter.

Type:

Optional[float], default None

Notes

String coupling function names (e.g., “gelu”, “relu”) are resolved at network build time. Use None to inherit the network-level coupling function.

__init__(size, kind='volatile', add_constant_input=True, fully_connected=True, coupling_fn=None, volatility_parent=True, tonic_volatility=None, tonic_volatility_vol=None)#
Parameters:
  • size (int)

  • kind (str)

  • add_constant_input (bool)

  • fully_connected (bool)

  • coupling_fn (str | None)

  • volatility_parent (bool)

  • tonic_volatility (float | None)

  • tonic_volatility_vol (float | None)

Return type:

None

Methods

__init__(size[, kind, add_constant_input, ...])

from_dict(data)

Construct from a dictionary.

to_dict()

Convert to a JSON-serialisable dictionary.

Attributes