cell

package
v0.0.0-...-073bf36 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitialPreT = 0.0 //-10000000000.0
)

This synapse is for prototyping only.

View Source
const (
	RefractoryEpsilon = 0.1
)

Variables

This section is empty.

Functions

func GetNextId

func GetNextId() int

Types

type Data

type Data struct {
	// The time mark at which the data began flowing.
	Time float64

	// Value can be 1 or 0
	Value byte

	// Source indicates where the spike came from.
	Source SourceType
}

Data represents information flowing through the network.

func NewData

func NewData() *Data

type DataPool

type DataPool struct {
	// contains filtered or unexported fields
}
var PoolData *DataPool = NewDataPool()

func NewDataPool

func NewDataPool() *DataPool

func (*DataPool) Drop

func (dp *DataPool) Drop()

func (*DataPool) Get

func (dp *DataPool) Get() *Data

func (*DataPool) Put

func (dp *DataPool) Put(d *Data)

type ICell

type ICell interface {
	ID() int
	SetID(int)

	SetThreshold(float64)

	// Output is either a 1 or 0
	Output() float64

	// Input comes from a IConnection
	AddInConnection(IConnection)

	AddOutConnection(IConnection)

	AttachDendrite(IDendrite)

	Integrate(dt float64) float64

	Process()

	Reset()

	SetField(field string, value string)

	// Called at the end of a simulation run (not a pass)
	PostProcess()

	Diagnostics(string)

	Load(json interface{})
	Store(file string)

	// Properties
	APFast() float64
	APSlow() float64
	APSlowPrior() float64
	Efficacy() float64
	ToJSON() interface{}
}

ICell represents a network wide cell of which there can be many implementations. Cells make connections with other cells via [IConnection]s

func NewProtoNeuron

func NewProtoNeuron() ICell

type ICompartment

type ICompartment interface {
	// Compartment properties
	AddSynapse(ISynapse)

	// Evaluates the total effective weight for the compartment.
	Integrate(t float64, cell ICell) float64

	Process()

	PostProcess()

	Dendrite() IDendrite

	Reset()

	Load(json interface{})

	ToJSON() interface{}
}

ICompartment collects synapses. It represents the functionality of a group of synapses located along the Dendrite. Compartments are either close to or farther away from the neuron's soma: Proximal, Apical, Distal. TODO compartments can overlap causing effects to diffuse into neighboring compartments, for example, Ca++ dynamics (CaDP).

func NewProtoCompartment

func NewProtoCompartment(den IDendrite) ICompartment

type IConnection

type IConnection interface {
	// If a connection has a delay then this will
	// step the delay
	Update()

	// Inject a Data (aka spike) into the connection.
	Input(int)

	// Get connection's output
	Output() int

	// Post pass after Process and Integrate
	Post()
}

IConnection represents a connection between inputs and/or cells. Connections transport Data objects.

A connection has a collection of inputs streams and output targets. A connection merges streams that target multiple cells.

Multiple cells can connect their output to the connection's input and the connection's ouput can feed into multiple cell inputs.

Some connections can delay their output behind their input. Some connections and have no delay (aka strait).

func NewStraightConnection

func NewStraightConnection() IConnection

type IDendrite

type IDendrite interface {
	AddCompartment(ICompartment)

	Integrate(t float64, cell ICell) float64

	Process()

	PostProcess()

	APEfficacy(distance float64) float64

	SetField(field string, value string)

	Reset()

	Load(json interface{})

	ToJSON() interface{}
}

IDendrite collects and manages ICompartments.

func NewProtoDendrite

func NewProtoDendrite(cell ICell) IDendrite

type ISynapse

type ISynapse interface {
	Id() int

	Connect(IConnection)
	GetConnection() IConnection

	// Evaluates the total effective weight for the synapse.
	Integrate(t float64, cell ICell) float64

	// Called before Integrate()
	Process()

	// Called at the end of a simulation run (not a pass)
	PostProcess()

	Reset()

	// The current input on the synapse. The input is feed from an IConnection's
	// output.
	Input() int

	IsExcititory() bool

	Load(json interface{})
	ToJSON() interface{}

	SetWeight(float64)
	SetWMax(float64)
	SetWMin(float64)

	SetField(field string, value string)
	SetTaoP(float64)
	SetTaoN(float64)
	SetAma(float64)
	SetAmb(float64)
	SetTsw(float64)
}

ISynapse is a common interface. A synapse is associated with a connection and one or more behaviors. One such behavior is STDP for evaluating the Long-term effect. Each synapse is part of a group called a Compartment.

func NewProtoSynapse

func NewProtoSynapse(comp ICompartment, synType SynapseType, id int, weightSeed int64) ISynapse

type ProtoCompartment

type ProtoCompartment struct {
	// contains filtered or unexported fields
}

func (*ProtoCompartment) AddSynapse

func (bc *ProtoCompartment) AddSynapse(syn ISynapse)

func (*ProtoCompartment) Dendrite

func (c *ProtoCompartment) Dendrite() IDendrite

func (*ProtoCompartment) Integrate

func (c *ProtoCompartment) Integrate(t float64, cell ICell) float64

func (*ProtoCompartment) Load

func (c *ProtoCompartment) Load(json interface{})

func (*ProtoCompartment) PostProcess

func (c *ProtoCompartment) PostProcess()

func (*ProtoCompartment) Process

func (c *ProtoCompartment) Process()

func (*ProtoCompartment) Reset

func (bc *ProtoCompartment) Reset()

func (*ProtoCompartment) ToJSON

func (c *ProtoCompartment) ToJSON() interface{}

type ProtoDendrite

type ProtoDendrite struct {
	// contains filtered or unexported fields
}

func (*ProtoDendrite) APEfficacy

func (d *ProtoDendrite) APEfficacy(distance float64) float64

func (*ProtoDendrite) AddCompartment

func (bc *ProtoDendrite) AddCompartment(comp ICompartment)

func (*ProtoDendrite) Integrate

func (d *ProtoDendrite) Integrate(t float64, cell ICell) float64

2nd pass Integrate is the 2nd pass performing integration.

func (*ProtoDendrite) Load

func (d *ProtoDendrite) Load(json interface{})

func (*ProtoDendrite) PostProcess

func (d *ProtoDendrite) PostProcess()

func (*ProtoDendrite) Process

func (d *ProtoDendrite) Process()

Process handles post processing before Integration is performed.

func (*ProtoDendrite) Reset

func (bc *ProtoDendrite) Reset()

func (*ProtoDendrite) SetField

func (d *ProtoDendrite) SetField(field, value string)

func (*ProtoDendrite) ToJSON

func (d *ProtoDendrite) ToJSON() interface{}

type ProtoNeuron

type ProtoNeuron struct {

	// The time-mark of the current AP.
	APt float64

	APMax float64
	// contains filtered or unexported fields
}

func (*ProtoNeuron) APFast

func (n *ProtoNeuron) APFast() float64

func (*ProtoNeuron) APSlow

func (n *ProtoNeuron) APSlow() float64

func (*ProtoNeuron) APSlowPrior

func (n *ProtoNeuron) APSlowPrior() float64

func (*ProtoNeuron) AddInConnection

func (n *ProtoNeuron) AddInConnection(con IConnection)

func (*ProtoNeuron) AddOutConnection

func (n *ProtoNeuron) AddOutConnection(con IConnection)

func (*ProtoNeuron) AttachDendrite

func (bc *ProtoNeuron) AttachDendrite(den IDendrite)

func (*ProtoNeuron) Diagnostics

func (bc *ProtoNeuron) Diagnostics(msg string)

func (*ProtoNeuron) Efficacy

func (n *ProtoNeuron) Efficacy() float64

func (*ProtoNeuron) ID

func (bc *ProtoNeuron) ID() int

func (*ProtoNeuron) Integrate

func (n *ProtoNeuron) Integrate(t float64) float64

func (*ProtoNeuron) Load

func (n *ProtoNeuron) Load(json interface{})

func (*ProtoNeuron) Output

func (n *ProtoNeuron) Output() float64

func (*ProtoNeuron) PostProcess

func (n *ProtoNeuron) PostProcess()

func (*ProtoNeuron) Process

func (n *ProtoNeuron) Process()

func (*ProtoNeuron) Reset

func (n *ProtoNeuron) Reset()

func (*ProtoNeuron) SetField

func (n *ProtoNeuron) SetField(field, value string)

func (*ProtoNeuron) SetID

func (bc *ProtoNeuron) SetID(id int)

func (*ProtoNeuron) SetThreshold

func (n *ProtoNeuron) SetThreshold(theta float64)

func (*ProtoNeuron) Store

func (bc *ProtoNeuron) Store(file string)

func (*ProtoNeuron) ToJSON

func (n *ProtoNeuron) ToJSON() interface{}

type ProtoSynapse

type ProtoSynapse struct {
	// contains filtered or unexported fields
}

func (*ProtoSynapse) Connect

func (bs *ProtoSynapse) Connect(con IConnection)

func (*ProtoSynapse) GetConnection

func (bs *ProtoSynapse) GetConnection() IConnection

func (*ProtoSynapse) Id

func (bs *ProtoSynapse) Id() int

func (*ProtoSynapse) Input

func (bs *ProtoSynapse) Input() int

Input returns the input feeding into this synapse. The synapse has an IConnection for input. This method returns that connection's output. i.e. the data entering the synapse from the connection.

func (*ProtoSynapse) Integrate

func (n *ProtoSynapse) Integrate(t float64, cell ICell) float64

Integrate is the 2nd pass and handles integration. The effects pre/post synaptic spikes are felt here.

func (*ProtoSynapse) IsExcititory

func (bs *ProtoSynapse) IsExcititory() bool

func (*ProtoSynapse) Load

func (n *ProtoSynapse) Load(json interface{})

func (*ProtoSynapse) PostProcess

func (n *ProtoSynapse) PostProcess()

Called at the end of a simulation run (not a pass)

func (*ProtoSynapse) Process

func (n *ProtoSynapse) Process()

It is considered the 1st pass of the simulation per time step. 1) Internal values are 'moved' to the outputs. 2) Learning rules are applied.

func (*ProtoSynapse) Reset

func (n *ProtoSynapse) Reset()

func (*ProtoSynapse) SetAma

func (n *ProtoSynapse) SetAma(v float64)

func (*ProtoSynapse) SetAmb

func (n *ProtoSynapse) SetAmb(v float64)

func (*ProtoSynapse) SetField

func (n *ProtoSynapse) SetField(field, value string)

func (*ProtoSynapse) SetId

func (bs *ProtoSynapse) SetId(id int)

func (*ProtoSynapse) SetTaoN

func (n *ProtoSynapse) SetTaoN(v float64)

func (*ProtoSynapse) SetTaoP

func (n *ProtoSynapse) SetTaoP(v float64)

func (*ProtoSynapse) SetTsw

func (n *ProtoSynapse) SetTsw(v float64)

func (*ProtoSynapse) SetWMax

func (bs *ProtoSynapse) SetWMax(v float64)

func (*ProtoSynapse) SetWMin

func (bs *ProtoSynapse) SetWMin(v float64)

func (*ProtoSynapse) SetWeight

func (bs *ProtoSynapse) SetWeight(weight float64)

func (*ProtoSynapse) ToJSON

func (n *ProtoSynapse) ToJSON() interface{}

type ProximalSynapse

type ProximalSynapse struct {
	// contains filtered or unexported fields
}

func (*ProximalSynapse) Connect

func (bs *ProximalSynapse) Connect(con IConnection)

func (*ProximalSynapse) GetConnection

func (bs *ProximalSynapse) GetConnection() IConnection

func (*ProximalSynapse) Id

func (bs *ProximalSynapse) Id() int

func (*ProximalSynapse) Input

func (bs *ProximalSynapse) Input() int

Input returns the input feeding into this synapse. The synapse has an IConnection for input. This method returns that connection's output. i.e. the data entering the synapse from the connection.

func (*ProximalSynapse) Integrate

func (n *ProximalSynapse) Integrate(dt float64) float64

func (*ProximalSynapse) IsExcititory

func (bs *ProximalSynapse) IsExcititory() bool

func (*ProximalSynapse) Process

func (n *ProximalSynapse) Process()

func (*ProximalSynapse) SetId

func (bs *ProximalSynapse) SetId(id int)

func (*ProximalSynapse) SetWMax

func (bs *ProximalSynapse) SetWMax(v float64)

func (*ProximalSynapse) SetWMin

func (bs *ProximalSynapse) SetWMin(v float64)

func (*ProximalSynapse) SetWeight

func (bs *ProximalSynapse) SetWeight(weight float64)

type SourceType

type SourceType int
const (
	StimulusSource SourceType = iota
	PoissonSource
	NeuronSource
	// Typically indicates multiple sources spiked at the same time.
	MultiSource
)

type StimulusNeuron

type StimulusNeuron struct {
	// contains filtered or unexported fields
}

This type of neuron handles stimulus type inputs, however, it can also handle interior/hidden type neurons.

func (*StimulusNeuron) AttachDendrite

func (bc *StimulusNeuron) AttachDendrite(den IDendrite)

func (*StimulusNeuron) Diagnostics

func (bc *StimulusNeuron) Diagnostics(msg string)

func (*StimulusNeuron) ID

func (bc *StimulusNeuron) ID() int

func (*StimulusNeuron) Load

func (bc *StimulusNeuron) Load(file string)

func (*StimulusNeuron) SetID

func (bc *StimulusNeuron) SetID(id int)

func (*StimulusNeuron) Store

func (bc *StimulusNeuron) Store(file string)

type StraightConnection

type StraightConnection struct {
	// contains filtered or unexported fields
}

StraightConnection has no delay. On each time mark data immediately appears on the output.

func (*StraightConnection) Input

func (sc *StraightConnection) Input(b int)

Input ORs the data value to the connection

func (*StraightConnection) Output

func (sc *StraightConnection) Output() int

func (*StraightConnection) Post

func (sc *StraightConnection) Post()

func (*StraightConnection) Update

func (bc *StraightConnection) Update()

type SynapseType

type SynapseType bool
const (
	Excititory SynapseType = true
	Inhibitory             = false
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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