pyhgf.utils.weight_initialisation.xavier_init#

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

Xavier / Glorot uniform initialisation.

Draws weights from \(\\mathcal{U}(-a, a)\) where \(a = \\sqrt{6 / (n_{\\text{parents}} + n_{\\text{children}})}\).

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

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

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

Returns:

Weight vector of length n_parents * n_children.

Return type:

numpy.ndarray