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.005)[source]

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

Parameters:
  • cloud (numpy.ndarray) – An N by 2 array of datapoints. You can think of each of the two columns as the time series of firing rates of one presynaptic neuron.
  • 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=2000, 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.plot_oja_trace(data_cloud, weights_course)[source]

Plots the datapoints and the time series of the weights :param data_cloud: n by 2 data :type data_cloud: numpy.ndarray :param weights_course: n by 2 weights :type weights_course: numpy.ndarray

Returns:

neurodynex.ojas_rule.oja.run_oja(n=2000, ratio=1.0, angle=0.0, learning_rate=0.01, 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