pyhgf.utils.weight_initialisation.orthogonal_init#

pyhgf.utils.weight_initialisation.orthogonal_init(n_parents, n_children, gain=1.0, seed=None)[source]#

Orthogonal initialisation.

Generates a random matrix, computes its SVD, and returns the (semi-)orthogonal factor scaled by gain. This preserves gradient norms during backpropagation.

Parameters:
  • n_parents (int) – Number of parent (input) nodes — fan-in.

  • n_children (int) – Number of child (output) nodes — fan-out.

  • gain (float) – Multiplicative scaling factor (default 1.0).

  • seed (int | None) – Optional random seed for reproducibility.

Returns:

Weight vector of length n_parents * n_children.

Return type:

numpy.ndarray