kinase

package
v2.0.0-dev0.2.13 Latest Latest
Warning

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

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

README

Linear approximation to synaptic calcium

This package computes a GLM linear regression against the CaBin time bins of CaSyn values to efficiently compute CaP and CaD at the synaptic level.

It is based on sims/kinasesim code, but is more focused on the specific task of computing the regression, sampling sender and receiver firing rates across minus and plus phases in a fully crossed manner.

To run, just do go test.

Edit the linear_test.go file to set different parameters.

Here are the current outputs for 200 cycles, Bins = 25, Plus = 50:

...
30 0.007846212365101512
CaP	R^2: 0.991438	R:  0.99571	Var Err: 0.004658	 Obs:    0.544
CaD	R^2: 0.996128	R: 0.998062	Var Err: 0.002602	 Obs:    0.672

CaP = 	0.0985391 * IV_0 + 	0.393702 * IV_1 + 	0.491684 * IV_2 + 	 0.59146 * IV_3 + 	0.692398 * IV_4 + 	0.792826 * IV_5 + 	 1.90145 * IV_6 + 	 3.00666 * IV_7 + 	       0
CaD = 	    0.35 * IV_0 + 	 0.65702 * IV_1 + 	0.956254 * IV_2 + 	 1.25657 * IV_3 + 	 1.25812 * IV_4 + 	 1.25885 * IV_5 + 	 1.13701 * IV_6 + 	 1.01161 * IV_7 + 	       0

linear.go has the initial coefficients, which are implemented in the kinase.CaBinWts function, set to:

	// NBins = 8, 200+50 cycles for CaSyn
	r.Coeff.Values = []float64{
		0.1, 0.4, 0.5, 0.6, 0.7, 0.8, 1.9, 3.0, 0, // big at the end; insensitive to start
		0.35, 0.65, 0.95, 1.25, 1.25, 1.25, 1.125, 1.0, .0} // up and down

(note that the final 0 is the constant offset)

and for 300 cycles:

	// NBins = 12, 300+50 cycles for CaSyn
	// r.Coeff.Values = []float64{
	// 	0, 0, 0, 0, 0.1, 0.4, 0.5, 0.6, 0.7, 0.8, 1.9, 3.0, 0, // big at the end; insensitive to start
	// 	0, 0, 0, 0, 0.35, 0.65, 0.95, 1.25, 1.25, 1.25, 1.125, 1.0, .0} // up and down

So 300 cycles just appends zeros to the start, and provides a very good fit.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Linear

type Linear struct {
	// Kinase CaSpike params
	CaSpike kinase.CaSpikeParams `display:"no-inline" new-window:"+"`

	// SynCaBin sets the SynCa integration parameters.
	SynCaBin kinase.SynCaBin

	// total number of cycles (1 MSec) to run per learning trial
	Cycles int `min:"10" default:"200"`

	// number of plus cycles
	PlusCycles int `default:"50"`

	// NumBins is the number of bins to accumulate spikes over Cycles
	NumBins int `default:"8"`

	// CyclesPerBin = Cycles / NumBins
	CyclesPerBin int `edit:"-"`

	// MaxHz is the maximum firing rate to sample in minus, plus phases
	MaxHz int `default:"120"`

	// StepHz is the step size for sampling Hz
	StepHz int `default:"10"`

	// NTrials is number of trials per Hz case
	NTrials int `default:"100"`

	// Total Trials is number of trials for all data
	TotalTrials int `edit:"-"`

	// Sending neuron
	Send Neuron

	// Receiving neuron
	Recv Neuron

	// Standard synapse values
	StdSyn Synapse

	// Linear synapse values
	LinearSyn Synapse

	// ErrDWt is the target error dwt: PlusHz - MinusHz
	ErrDWt float32

	// binned integration of send, recv spikes
	CaBins []float32

	// Data to fit the regression
	Data table.Table
}

Linear performs a linear regression to approximate the synaptic Ca integration between send and recv neurons.

func (*Linear) Cycle

func (ls *Linear) Cycle(nr *Neuron, expInt float32, cyc int)

Cycle does one cycle of neuron updating, with given exponential spike interval based on target spiking firing rate.

func (*Linear) Defaults

func (ls *Linear) Defaults()

func (*Linear) Init

func (ls *Linear) Init()

func (*Linear) InitTable

func (ls *Linear) InitTable()

func (*Linear) Regress

func (ls *Linear) Regress()

Regress runs the linear regression on the data

func (*Linear) Run

func (ls *Linear) Run()

Run generates data

func (*Linear) SetBins

func (ls *Linear) SetBins(sn, rn *Neuron, off, row int)

func (*Linear) SetSynState

func (ls *Linear) SetSynState(sy *Synapse, row int)

func (*Linear) StartTrial

func (ls *Linear) StartTrial()

func (*Linear) Trial

func (ls *Linear) Trial(sendMinusHz, sendPlusHz, recvMinusHz, recvPlusHz float32, ti, row int)

Trial runs one trial

func (*Linear) Update

func (ls *Linear) Update()

type Neuron

type Neuron struct {
	// Neuron spiking (0,1)
	Spike float32

	// Neuron probability of spiking
	SpikeP float32

	// CaSyn is spike-driven calcium trace for synapse-level Ca-driven learning:
	// exponential integration of SpikeG * Spike at SynTau time constant (typically 30).
	// Synapses integrate send.CaSyn * recv.CaSyn across M, P, D time integrals for
	// the synaptic trace driving credit assignment in learning.
	// Time constant reflects binding time of Glu to NMDA and Ca buffering postsynaptically,
	// and determines time window where pre * post spiking must overlap to drive learning.
	CaSyn float32

	// neuron-level spike-driven Ca integration
	CaM, CaP, CaD float32

	TotalSpikes float32

	// binned count of spikes, for regression learning
	CaBins []float32
}

Neuron has Neuron state

func (*Neuron) Init

func (kn *Neuron) Init()

func (*Neuron) StartTrial

func (kn *Neuron) StartTrial()

type Synapse

type Synapse struct {
	CaSyn float32

	// CaM is first stage running average (mean) Ca calcium level (like CaM = calmodulin), feeds into CaP
	CaM float32

	// CaP is shorter timescale integrated CaM value, representing the plus, LTP direction of weight change and capturing the function of CaMKII in the Kinase learning rule
	CaP float32

	// CaD is longer timescale integrated CaP value, representing the minus, LTD direction of weight change and capturing the function of DAPK1 in the Kinase learning rule
	CaD float32

	// DWt is the CaP - CaD
	DWt float32
}

Synapse has Synapse state

func (*Synapse) Init

func (ks *Synapse) Init()

Jump to

Keyboard shortcuts

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