Documentation ¶
Overview ¶
Package `popcode` provides population code encoding and decoding support functionality, in 1D and 2D.
`popcode.OneD` `Encode` method turns a single scalar value into a 1D population code according to a set of parameters about the nature of the population code, range of values to encode, etc.
`Decode` takes a distributed pattern of activity and decodes a scalar value from it, using activation-weighted average based on tuning value of individual units.
`popcode.TwoD` likewise has `Encode` and `Decode` methods for 2D gaussian-bumps that simultaneously encode a 2D value such as a 2D position.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OneD ¶
type OneD struct { Code PopCodes `desc:"how to encode the value"` Min float32 `` /* 168-byte string literal not displayed */ Max float32 `` /* 168-byte string literal not displayed */ Sigma float32 `` /* 149-byte string literal not displayed */ Clip bool `desc:"ensure that encoded and decoded value remains within specified range"` Thr float32 `` /* 201-byte string literal not displayed */ MinSum float32 `` /* 174-byte string literal not displayed */ }
popcode.OneD provides encoding and decoding of population codes, used to represent a single continuous (scalar) value across a population of units / neurons (1 dimensional)
func (*OneD) Decode ¶
Decode decodes value from a pattern of activation as the activation-weighted-average of the unit's preferred tuning values. must have 2 or more values in pattern pat.
func (*OneD) Encode ¶
Encode generates a pattern of activation of given size to encode given value. n must be 2 or more. pat slice will be constructed if len != n
type Ring ¶ added in v1.1.1
type Ring struct { OneD LowVec []float32 `view:"-" desc:"low-end encoding vector"` HighVec []float32 `view:"-" desc:"high-end encoding vector"` }
Ring is a OneD popcode that encodes a circular value such as an angle that wraps around at the ends. It uses two internal vectors to render the wrapped-around values into, and then adds them into the final result. Unlike regular PopCodes, the Min and Max should represent the exact range of the value (e.g., 0 to 360 for angle) with no extra on the ends, as that extra will wrap around to the other side in this case.
func (*Ring) AllocVecs ¶ added in v1.1.1
AllocVecs allocates internal LowVec, HighVec storage, allowing for variable lengths to be encoded using same object, growing capacity to max, but using exact amount each time
func (*Ring) Decode ¶ added in v1.1.1
Decode decodes value from a pattern of activation as the activation-weighted-average of the unit's preferred tuning values. must have 2 or more values in pattern pat.
func (*Ring) Encode ¶ added in v1.1.1
Encode generates a pattern of activation of given size to encode given value. n must be 2 or more. pat slice will be constructed if len != n
func (*Ring) EncodeImpl ¶ added in v1.1.1
EncodeImpl generates a pattern of activation of given size to encode given value. n must be 2 or more. pat slice will be constructed if len != n
type TwoD ¶ added in v1.0.0
type TwoD struct { Code PopCodes `desc:"how to encode the value"` Min mat32.Vec2 `` /* 180-byte string literal not displayed */ Max mat32.Vec2 `` /* 180-byte string literal not displayed */ Sigma mat32.Vec2 `` /* 150-byte string literal not displayed */ Clip bool `desc:"ensure that encoded and decoded value remains within specified range"` Thr float32 `` /* 201-byte string literal not displayed */ MinSum float32 `` /* 174-byte string literal not displayed */ }
popcode.TwoD provides encoding and decoding of population codes, used to represent two continuous (scalar) values across a 2D population of units / neurons (2 dimensional)
func (*TwoD) Decode ¶ added in v1.0.0
Decode decodes value from a pattern of activation as the activation-weighted-average of the unit's preferred tuning values. must have 2 or more values in pattern pat. TODO: TBD
func (*TwoD) Encode ¶ added in v1.0.0
Encode generates a pattern of activation on given tensor, which must already have appropriate 2D shape which is used for encoding sizes (error if not).
func (*TwoD) SetRange ¶ added in v1.0.0
SetRange sets the min, max and sigma values to the same scalar values