kinase

package
v2.0.0-dev0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2025 License: BSD-3-Clause Imports: 1 Imported by: 0

README

Kinase Learning Implementation

This implements central elements of the Kinase learning rule, including variables with associated time constants used for integrating calcium signals through the cascade of progressively longer time-integrals, from Ca -> CaM calmodulin (at MTau) -> CaMKII (CaP at PTau for LTP role) -> DAPK1 (CaD at DTau for LTD role).

See kinaseq example for an exploration of the implemented equations, and kinase repository for documentation and simulations about the biophysical basis of the equations.

Time constants and Variables

  • MTau (2 or 5) = calmodulin (CaM) time constant in cycles (msec) -- for synaptic-level integration this integrates on top of Ca signal from send->CaSyn * recv->CaSyn, each of which are typically integrated with a 30 msec Tau.

  • PTau (40) = LTP spike-driven Ca factor (CaP) time constant in cycles (msec), simulating CaMKII in the Kinase framework, with 40 on top of MTau roughly tracking the biophysical rise time. Computationally, CaP represents the plus phase learning signal that reflects the most recent past information.

  • DTau (40) = LTD spike-driven Ca factor (CaD) time constant in cycles (msec), simulating DAPK1 in Kinase framework. Computationally, CaD represents the minus phase learning signal that reflects the expectation representation prior to experiencing the outcome (in addition to the outcome).

TODO

  • remove NMDA and CaLrn from neuron if not used
  • use neuron-level recv, send final CaSpk* values as regressors! key!

Closed-form Expression for cascading integration (not faster)

Rishi Chaudhri suggested the following approach:

Wolfram Alpha Solution

But unfortunately all the FastExp calls end up being slower than directly computing the cascaded equations.

// Equations for below, courtesy of Rishi Chaudhri:
// 
// CaAtT computes the 3 Ca values at (currentTime + ti), assuming 0
// new Ca incoming (no spiking). It uses closed-form exponential functions.
func (kp *CaDtParams) CaAtT(ti int32, caM, caP, caD *float32) {
	t := float32(ti)
	mdt := kp.MDt
	pdt := kp.PDt
	ddt := kp.DDt
	if kp.ExpAdj.IsTrue() { // adjust for discrete
		mdt *= 1.11
		pdt *= 1.03
		ddt *= 1.03
	}
	mi := *caM
	pi := *caP
	di := *caD

	*caM = mi * math32.FastExp(-t*mdt)

	em := math32.FastExp(t * mdt)
	ep := math32.FastExp(t * pdt)

	*caP = pi*math32.FastExp(-t*pdt) - (pdt*mi*math32.FastExp(-t*(mdt+pdt))*(em-ep))/(pdt-mdt)

	epd := math32.FastExp(t * (pdt + ddt))
	emd := math32.FastExp(t * (mdt + ddt))
	emp := math32.FastExp(t * (mdt + pdt))

	*caD = pdt*ddt*mi*math32.FastExp(-t*(mdt+pdt+ddt))*(ddt*(emd-epd)+(pdt*(epd-emp))+mdt*(emp-emd))/((mdt-pdt)*(mdt-ddt)*(pdt-ddt)) - ddt*pi*math32.FastExp(-t*(pdt+ddt))*(ep-math32.FastExp(t*ddt))/(ddt-pdt) + di*math32.FastExp(-t*ddt)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaBinWts

func CaBinWts(nplus, binCycles int, cp, cd []float32)

CaBinWts generates the weighting factors for integrating [CaBins] neuron level spikes that have been multiplied send * recv to generate a synapse-level spike coincidence factor, used for the trace in the kinase learning rule. There are separate weights for two time scales of integration: CaP and CaD. nplus is the number of ca bins associated with the plus phase, which sets the natural timescale of the integration: total ca bins can be proportional to the plus phase (e.g., 4x for standard 200 / 50 total / plus), or longer if there is a longer minus phase window (which is downweighted).

Types

type CaDtParams

type CaDtParams struct {

	// CaM (calmodulin) time constant in cycles (msec),
	// which is the first level integration.
	// For CaLearn, 2 is best; for CaSpk, 5 is best.
	// For synaptic-level integration this integrates on top of Ca
	// signal from send->CaSyn * recv->CaSyn, each of which are
	// typically integrated with a 30 msec Tau.
	MTau float32 `default:"2,5" min:"1"`

	// LTP spike-driven potentiation Ca factor (CaP) time constant
	// in cycles (msec), simulating CaMKII in the Kinase framework,
	// cascading on top of MTau.
	// Computationally, CaP represents the plus phase learning signal that
	// reflects the most recent past information.
	// Value tracks linearly with number of cycles per learning trial:
	// 200 = 40, 300 = 60, 400 = 80
	PTau float32 `default:"40,60,80" min:"1"`

	// LTD spike-driven depression Ca factor (CaD) time constant
	// in cycles (msec), simulating DAPK1 in Kinase framework,
	// cascading on top of PTau.
	// Computationally, CaD represents the minus phase learning signal that
	// reflects the expectation representation prior to experiencing the
	// outcome (in addition to the outcome).
	// Value tracks linearly with number of cycles per learning trial:
	// 200 = 40, 300 = 60, 400 = 80
	DTau float32 `default:"40,60,80" min:"1"`

	// rate = 1 / tau
	MDt float32 `display:"-" json:"-" xml:"-" edit:"-"`

	// rate = 1 / tau
	PDt float32 `display:"-" json:"-" xml:"-" edit:"-"`

	// rate = 1 / tau
	DDt float32 `display:"-" json:"-" xml:"-" edit:"-"`
	// contains filtered or unexported fields
}

CaDtParams has rate constants for integrating Ca calcium at different time scales, including final CaP = CaMKII and CaD = DAPK1 timescales for LTP potentiation vs. LTD depression factors.

func (*CaDtParams) Defaults

func (kp *CaDtParams) Defaults()

func (*CaDtParams) FromCa

func (kp *CaDtParams) FromCa(ca float32, caM, caP, caD *float32)

FromCa updates CaM, CaP, CaD from given current calcium value, which is a faster time-integral of calcium typically.

func (*CaDtParams) PDTauForNCycles

func (kp *CaDtParams) PDTauForNCycles(ncycles int)

PDTauForNCycles sets the PTau and DTau parameters in proportion to the total number of cycles per theta learning trial, e.g., 200 = 40, 280 = 60

func (*CaDtParams) Update

func (kp *CaDtParams) Update()

type CaSpikeParams

type CaSpikeParams struct {

	// SpikeCaM is the drive factor for updating the neuron-level CaM (calmodulin)
	// based on a spike impulse, which is then cascaded into updating the
	// CaP and CaD values. These values are used for stats and RLRate computation,
	// but do not drive learning directly. Larger values (e.g., 12) may be useful
	// in some models.
	SpikeCaM float32 `default:"8,12"`

	// SpikeCaSyn is the drive factor for updating the neuron-level CaSyn
	// synaptic calcium trace value based on a spike impulse. CaSyn is integrated
	// into CaBins which are then used to compute synapse-level pre * post
	// Ca values over the theta cycle, which then drive the Tr credit assignment
	// trace factor for kinase error-driven cortical learning. Changes in this
	// value will affect the net learning rate.
	SpikeCaSyn float32 `default:"8"`

	// CaSynTau is the time constant for integrating the spike-driven calcium
	// trace CaSyn at sender and recv neurons. See SpikeCaSyn for more info.
	// If this param is changed, then there will be a change in effective
	// learning rate that can be compensated for by multiplying
	// CaScale by sqrt(30 / sqrt(SynTau)
	CaSynTau float32 `default:"30" min:"1"`

	// CaSynDt rate = 1 / tau
	CaSynDt float32 `display:"-" json:"-" xml:"-" edit:"-"`

	// Dt are time constants for integrating Spike-driven Ca across CaM, CaP and CaD
	// cascading levels. Typically the same as in LearnCa parameters.
	Dt CaDtParams `display:"inline"`
}

CaSpikeParams parameterizes the neuron-level spike-driven calcium signals, including CaM, CaP, CaD for basic activity stats and RLRate, and CaSyn which is integrated at the neuron level and drives synapse-level, pre * post Ca integration, providing the Tr credit assignment trace factor for kinase error-driven cortical learning.

func (*CaSpikeParams) CaMFromSpike

func (sp *CaSpikeParams) CaMFromSpike(spike float32, caM, caP, caD *float32)

CaMFromSpike updates CaM, CaP, CaD variables from spike input, which is either 0 or 1.

func (*CaSpikeParams) CaSynFromSpike

func (sp *CaSpikeParams) CaSynFromSpike(spike float32, caSyn float32) float32

CaSynFromSpike returns new CaSyn value based on spike input, which is either 0 or 1, and current CaSyn value.

func (*CaSpikeParams) Defaults

func (sp *CaSpikeParams) Defaults()

func (*CaSpikeParams) Update

func (sp *CaSpikeParams) Update()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL