pyhgf.utils.learning#

pyhgf.utils.learning(attributes, inputs, inputs_x_idxs, inputs_y_idxs, learning_sequence, edges)[source]#

Update the networks coupling parameters using prospective configuration.

This algorithm implements a learning step, using a predictive coding scheme, inspired by the prospective configuration scheme proposed in [1].

Parameters:
  • attributes (dict[int | str, dict]) – The dictionaries of nodes’ parameters. This variable is updated and returned after the beliefs propagation step.

  • inputs (tuple[Array | ndarray | bool | number | bool | int | float | complex, ...]) – A tuple of n arrays containing the new predictors (x) and the expected predictions (y). Predictors values are set to the obervation nodes defined by inputs_x_idxs before the prediction steps. Predictions are observed in the observation steps in the nodes defined by inputs_y_idxs.

  • inputs_x_idxs (tuple[int]) – The indexes of the nodes receiving the predictors (x).

  • inputs_y_idxs (tuple[int]) – The indexes of the nodes receiving the predictions (y).

  • learning_sequence (LearningSequence) – The sequence that will be applied to the node structure. It is expected that the sequence contains a prediction, an update and a learning set of updates.

  • edges (tuple[AdjacencyLists, ...]) – Information on the network’s edges.

Returns:

A tuple of parameters structure (carryover and accumulated).

Return type:

attributes, attributes

References

[1]

Song, Y., Millidge, B., Salvatori, T., Lukasiewicz, T., Xu, Z., & Bogacz, R. (2024). Inferring neural activity before plasticity as a foundation for learning beyond backpropagation. Nature Neuroscience, 27(2), 348–358. doi:10.1038/s41593-023-01514-1