ngclearn.components.neurons.graded package

Submodules

ngclearn.components.neurons.graded.gaussianErrorCell module

class ngclearn.components.neurons.graded.gaussianErrorCell.GaussianErrorCell(*args: Any, **kwargs: Any)[source]

Bases: Component

A simple (non-spiking) Gaussian error cell - this is a fixed-point solution of a mismatch signal.

Parameters:
  • name – the string name of this cell

  • n_units – number of cellular entities (neural population size)

  • tau_m – (Unused – currently cell is a fixed-point model)

  • leakRate – (Unused – currently cell is a fixed-point model)

  • key – PRNG Key to control determinism of any underlying synapses associated with this cell

  • useVerboseDict – triggers slower, verbose dictionary mode (Default: False)

advance_state(t, dt, **kwargs)[source]
property derivMean
classmethod derivMeanName()[source]
property derivTarget
classmethod derivTargetName()[source]
classmethod inputCompartmentName()[source]
property loss
classmethod lossName()[source]
property mean
classmethod meanName()[source]
property modulator
classmethod modulatorName()[source]
classmethod outputCompartmentName()[source]
reset(**kwargs)[source]
save(**kwargs)[source]
property target
classmethod targetName()[source]
verify_connections()[source]
ngclearn.components.neurons.graded.gaussianErrorCell.run_cell(dt, targ, mu, eType='gaussian')[source]

Moves cell dynamics one step forward.

Parameters:
  • dt – integration time constant

  • targ – target pattern value

  • mu – prediction value

Returns:

derivative w.r.t. mean “dmu”, derivative w.r.t. target dtarg, local loss

ngclearn.components.neurons.graded.gaussianErrorCell.run_gaussian_cell(dt, targ, mu)

Moves Gaussian cell dynamics one step forward. Specifically, this routine emulates the error unit behavior of the local cost functional:

L(targ, mu) = -(1/2) * ||targ - mu||^2_2
or log likelihood of the multivariate Gaussian with identity covariance
Parameters:
  • dt – integration time constant

  • targ – target pattern value

  • mu – prediction value

Returns:

derivative w.r.t. mean “dmu”, derivative w.r.t. target dtarg, loss

ngclearn.components.neurons.graded.laplacianErrorCell module

class ngclearn.components.neurons.graded.laplacianErrorCell.LaplacianErrorCell(*args: Any, **kwargs: Any)[source]

Bases: Component

A simple (non-spiking) Laplacian error cell - this is a fixed-point solution of a mismatch signal.

Parameters:
  • name – the string name of this cell

  • n_units – number of cellular entities (neural population size)

  • tau_m – (Unused – currently cell is a fixed-point model)

  • leakRate – (Unused – currently cell is a fixed-point model)

  • key – PRNG Key to control determinism of any underlying synapses associated with this cell

  • useVerboseDict – triggers slower, verbose dictionary mode (Default: False)

advance_state(t, dt, **kwargs)[source]
property derivMean
classmethod derivMeanName()[source]
property derivTarget
classmethod derivTargetName()[source]
classmethod inputCompartmentName()[source]
property loss
classmethod lossName()[source]
property mean
classmethod meanName()[source]
property modulator
classmethod modulatorName()[source]
classmethod outputCompartmentName()[source]
reset(**kwargs)[source]
save(**kwargs)[source]
property target
classmethod targetName()[source]
verify_connections()[source]
ngclearn.components.neurons.graded.laplacianErrorCell.run_cell(dt, targ, mu, eType='gaussian')[source]

Moves cell dynamics one step forward.

Parameters:
  • dt – integration time constant

  • targ – target pattern value

  • mu – prediction value

Returns:

derivative w.r.t. mean “dmu”, derivative w.r.t. target dtarg, local loss

ngclearn.components.neurons.graded.laplacianErrorCell.run_laplacian_cell(dt, targ, mu)

Moves Laplacian cell dynamics one step forward. Specifically, this routine emulates the error unit behavior of the local cost functional:

L(targ, mu) = -||targ - mu||_1
or log likelihood of the Laplace distribution with identity scale
Parameters:
  • dt – integration time constant

  • targ – target pattern value

  • mu – prediction value

Returns:

derivative w.r.t. mean “dmu”, derivative w.r.t. target dtarg, loss

ngclearn.components.neurons.graded.rateCell module

class ngclearn.components.neurons.graded.rateCell.RateCell(*args: Any, **kwargs: Any)[source]

Bases: Component

A non-spiking cell driven by the gradient dynamics of neural generative coding-driven predictive processing.

Parameters:
  • name – the string name of this cell

  • n_units – number of cellular entities (neural population size)

  • tau_m – membrane/state time constant (milliseconds)

  • prior

    a kernel for specifying the type of centered scale-shift distribution to impose over neuronal dynamics, applied to each neuron or dimension within this component (Default: (“gaussian”, 0)); this is a tuple with 1st element containing a string name of the distribution one wants to use while the second value is a leak rate scalar that controls the influence/weighting that this distribution has on the dynamics; for example, (“laplacian, 0.001”) means that a centered laplacian distribution scaled by 0.001 will be injected into this cell’s dynamics ODE each step of simulated time

    Note:

    supported scale-shift distributions include “laplacian”, “cauchy”, “exp”, and “gaussian”

  • act_fx – string name of activation function/nonlinearity to use

  • integration_type

    type of integration to use for this cell’s dynamics; current supported forms include “euler” (Euler/RK-1 integration) and “midpoint” or “rk2” (midpoint method/RK-2 integration) (Default: “euler”)

    Note:

    setting the integration type to the midpoint method will increase the accuray of the estimate of the cell’s evolution at an increase in computational cost (and simulation time)

  • key – PRNG Key to control determinism of any underlying random values associated with this cell

  • useVerboseDict – triggers slower, verbose dictionary mode (Default: False)

property activity
advance_state(t, dt, **kwargs)[source]
property current
property inputCompartment
classmethod inputCompartmentName()[source]
property outputCompartment
classmethod outputCompartmentName()[source]
property pressure
classmethod pressureName()[source]
property rateActivity
classmethod rateActivityName()[source]
reset(**kwargs)[source]
save(**kwargs)[source]
verify_connections()[source]
ngclearn.components.neurons.graded.rateCell.modulate(j, dfx_val)

Apply a signal modulator to j (typically of the form of a derivative/dampening function)

Parameters:
  • j – current/stimulus value to modulate

  • dfx_val – modulator signal

Returns:

modulated j value

ngclearn.components.neurons.graded.rateCell.run_cell(dt, j, j_td, z, tau_m, leak_gamma=0.0, beta=1.0, integType=0, priorType=None)[source]

Runs leaky rate-coded state dynamics one step in time.

Parameters:
  • dt – integration time constant

  • j – input (bottom-up) electrical/stimulus current

  • j_td – modulatory (top-down) electrical/stimulus pressure

  • z – current value of membrane/state

  • tau_m – membrane/state time constant

  • leak_gamma – strength of leak to apply to membrane/state

  • beta – dampening coefficient (Default: 1.)

  • integType – integration type to use (0 –> Euler/RK1, 1 –> Midpoint/RK2)

  • priorType – scale-shift prior distribution to impose over neural dynamics

Returns:

New value of membrane/state for next time step

ngclearn.components.neurons.graded.rateCell.run_cell_stateless(j)

A simplification of running a stateless set of dynamics over j (an identity functional form of dynamics).

Parameters:

j – stimulus to do nothing to

Returns:

the stimulus

Module contents