Documentation
¶
Overview ¶
package kwta provides the Leabra k-Winners-Take-All inhibition function in a form that can be applied to an tensor of float32 values as computed by visual (or other modality) filtering routines.
The inhibition is computed using the FFFB feedforward-feedback function along with standard noisy-X-over-X+1 (NXX1) function that computes a resulting activation based on the inhibition.
Index ¶
- Variables
- type Chans
- type KWTA
- func (kwta *KWTA) ActFromG(geThr, ge, act float32) (nwAct, delAct float32)
- func (kwta *KWTA) Defaults()
- func (kwta *KWTA) GeThrFromG(gi float32) float32
- func (kwta *KWTA) KWTALayer(raw, act, extGi *tensor.Float32)
- func (kwta *KWTA) KWTAPool(raw, act *tensor.Float32, inhib *fffb.Inhibs, extGi *tensor.Float32)
- func (kwta *KWTA) Update()
- type NeighInhib
Constants ¶
This section is empty.
Variables ¶
var ( // ortho neighbor coordinates for 4 angles, also uses negated version // . // --- = (0,1) (X,Y) // . / // / = (-1,1) // | . = (1,0) // \ // . \ = (-1,-1) Neigh4X = []int{0, -1, 1, -1} Neigh4Y = []int{1, 1, 0, -1} )
Functions ¶
This section is empty.
Types ¶
type Chans ¶
type Chans struct { // excitatory sodium (Na) AMPA channels activated by synaptic glutamate E float32 // constant leak (potassium, K+) channels -- determines resting potential (typically higher than resting potential of K) L float32 // inhibitory chloride (Cl-) channels activated by synaptic GABA I float32 // gated / active potassium channels -- typically hyperpolarizing relative to leak / rest K float32 }
Chans are ion channels used in computing point-neuron activation function
func (*Chans) SetFromMinusOther ¶
SetFromMinusOther sets all the values from given value minus other Chans
func (*Chans) SetFromOtherMinus ¶
SetFromOtherMinus sets all the values from other Chans minus given value
type KWTA ¶
type KWTA struct { // whether to run kWTA or not On bool // maximum number of iterations to perform Iters int // threshold on delta-activation (change in activation) for stopping updating of activations DelActThr float32 `default:"0.005"` // layer-level feedforward & feedback inhibition -- applied over entire set of values LayFFFB fffb.Params `display:"inline"` // pool-level (feature groups) feedforward and feedback inhibition -- applied within inner-most dimensions inside outer 2 dimensions (if Pool method is called) PoolFFFB fffb.Params `display:"inline"` // Noisy X/X+1 rate code activation function parameters XX1 nxx1.Params `display:"inline"` // time constant for integrating activation ActTau float32 `default:"3"` // maximal conductances levels for channels Gbar Chans `display:"inline"` // reversal potentials for each channel Erev Chans `display:"inline"` // Erev - Act.Thr for each channel -- used in computing GeThrFromG among others ErevSubThr Chans `edit:"-" display:"-"` // Act.Thr - Erev for each channel -- used in computing GeThrFromG among others ThrSubErev Chans `edit:"-" display:"-" json:"-" xml:"-"` // ActDt float32 `display:"-"; json"-" xml"-" desc:"integration rate = 1/ tau"` }
KWTA contains all the parameters needed for computing FFFB (feedforward & feedback) inhibition that results in roughly k-Winner-Take-All behavior.
func (*KWTA) GeThrFromG ¶
GeThrFromG computes the threshold for Ge based on other conductances
func (*KWTA) KWTALayer ¶
KWTALayer computes k-Winner-Take-All activation values from raw inputs. act output tensor is set to same shape as raw inputs if not already. This version just computes a "layer" level of inhibition across the entire set of tensor values. extGi is extra / external Gi inhibition per unit -- e.g. from neighbor inhib -- must be size of raw, act.
func (*KWTA) KWTAPool ¶
KWTAPool computes k-Winner-Take-All activation values from raw inputs act output tensor is set to same shape as raw inputs if not already. This version computes both Layer and Pool (feature-group) level inibition -- tensors must be 4 dimensional -- outer 2D is Y, X Layer and inner 2D are features (pools) per location. The inhib slice is required for pool-level inhibition and will be automatically sized to outer X,Y dims if not big enough. For best performance store this and reuse to avoid memory allocations. extGi is extra / external Gi inhibition per unit -- e.g. from neighbor inhib -- must be size of raw, act.
type NeighInhib ¶
type NeighInhib struct { // use neighborhood inhibition On bool // overall value of the inhibition -- this is what is added into the unit Gi inhibition level Gi float32 `default:"0.6"` }
NeighInhib adds an additional inhibition factor based on the same feature along an orthogonal angle -- assumes inner-most X axis represents angle of gabor or related feature. This helps reduce redundancy of feature code.
func (*NeighInhib) Defaults ¶
func (ni *NeighInhib) Defaults()
func (*NeighInhib) Inhib4 ¶
func (ni *NeighInhib) Inhib4(act, extGi *tensor.Float32)
Inhib4 computes the neighbor inhibition on activations into extGi. If extGi is not same shape as act, it will be made so (most efficient to re-use same structure). Act must be a 4D tensor with features as inner 2D. 4 version ONLY works with 4 angles (inner-most feature dimension)