neurodynex.ojas_rule package

Submodules

neurodynex.ojas_rule.oja module

This file implements Oja’s hebbian learning rule.

Relevant book chapters:
neurodynex.ojas_rule.oja.learn(cloud, initial_angle=None, eta=0.001)[source]

Run one batch of Oja’s learning over a cloud of datapoints

Parameters:
  • cloud (numpy.ndarray) – array of datapoints
  • initial_angle (float, optional) – angle of initial set of weights [deg]. If None, this is random.
  • eta (float, optional) – learning rate
Returns:

time course of the weight vector

Return type:

numpy.ndarray

neurodynex.ojas_rule.oja.make_cloud(n=10000, ratio=1, angle=0)[source]

Returns an oriented elliptic gaussian cloud of 2D points

Parameters:
  • n (int, optional) – number of points in the cloud
  • ratio (int, optional) – (std along the short axis) / (std along the long axis)
  • angle (int, optional) – rotation angle [deg]
Returns:

array of datapoints

Return type:

numpy.ndarray

neurodynex.ojas_rule.oja.run_oja(n=10000, ratio=1.0, angle=0.0, do_plot=True)[source]

Generates a point cloud and runs Oja’s learning rule once. Optionally plots the result.

Parameters:
  • n (int, optional) – number of points in the cloud
  • ratio (float, optional) – (std along the short axis) / (std along the long axis)
  • angle (float, optional) – rotation angle [deg]
  • do_plot (bool, optional) – plot the result

Module contents