|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.nengo.model.impl.AbstractEnsemble
ca.nengo.model.impl.EnsembleImpl
ca.nengo.model.impl.PlasticEnsembleImpl
ca.nengo.model.nef.impl.DecodableEnsembleImpl
ca.nengo.model.nef.impl.NEFEnsembleImpl
public class NEFEnsembleImpl
Default implementation of NEFEnsemble. TODO: links to NEF documentation TODO: test
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface ca.nengo.util.VisiblyMutable |
---|
VisiblyMutable.Event, VisiblyMutable.Listener, VisiblyMutable.NameChangeEvent, VisiblyMutable.NodeRemovedEvent |
Field Summary | |
---|---|
static java.lang.String |
BIAS_SUFFIX
|
static java.lang.String |
INTERNEURON_SUFFIX
|
Fields inherited from class ca.nengo.model.nef.impl.DecodableEnsembleImpl |
---|
myDecodedOrigins, OrderedOrigins |
Fields inherited from class ca.nengo.model.impl.EnsembleImpl |
---|
myExpandableNodes, myExpandedTerminations |
Fields inherited from class ca.nengo.model.impl.AbstractEnsemble |
---|
myNodes, myTerminations |
Fields inherited from interface ca.nengo.model.nef.NEFEnsemble |
---|
X |
Constructor Summary | |
---|---|
NEFEnsembleImpl(java.lang.String name,
NEFNode[] nodes,
float[][] encoders,
ApproximatorFactory factory,
float[][] evalPoints,
float[] radii)
|
Method Summary | |
---|---|
BiasOrigin |
addBiasOrigin(Origin existing,
int numInterneurons,
java.lang.String name,
boolean excitatory)
Adds a BiasOrigin, which operates in parallel with an existing Origin, such that the effective weights of the two origins together are all of the same sign (as is normally the case with synaptic weights in the brain). |
BiasTermination[] |
addBiasTerminations(DecodedTermination baseTermination,
float interneuronTauPSC,
float[][] biasDecoders,
float[][] functionDecoders)
Adds BiasTerminations, which are meant to receive projections from BiasOrigins. |
Origin |
addDecodedOrigin(java.lang.String name,
Function[] functions,
java.lang.String nodeOrigin)
Adds an Origin that corresponds to a decoding of the activities of Nodes in this Ensemble. |
Termination |
addDecodedTermination(java.lang.String name,
float[][] matrix,
float[] tfNumerator,
float[] tfDenominator,
float passthrough,
boolean isModulatory)
As above but with arbitrary single-input-single-output PSC dynamics. |
Termination |
addDecodedTermination(java.lang.String name,
float[][] matrix,
float tauPSC,
boolean isModulatory)
Adds a new Termination into this Ensemble, at which information is to be received in the form of decoded state variables rather than spikes, etc. |
NEFEnsemble |
clone()
|
void |
fixMode()
When this method is called, the mode of this node is fixed and cannot be changed by subsequent setMode(...) calls. |
protected float[] |
getConstantOutput(int nodeIndex,
float[][] evalPoints,
java.lang.String origin)
|
protected float[][] |
getConstantOutputs(float[][] evalPoints,
java.lang.String origin)
|
DecodedOrigin[] |
getDecodedOrigins()
Used to get decoded origins to give to GPU. |
DecodedTermination[] |
getDecodedTerminations()
Used to get decoded terminations to give to GPU. |
int |
getDimension()
|
DynamicalSystem |
getDirectModeDynamics()
|
Integrator |
getDirectModeIntegrator()
|
float[][] |
getEncoders()
|
NEFEnsembleFactory |
getEnsembleFactory()
|
float[][] |
getEvalPoints()
|
TimeSeries |
getHistory(java.lang.String stateName)
Note that the units of TimeSeries' for a given state do not change over time (ie at different time steps). |
boolean |
getModeFixed()
|
int |
getNeurons()
|
int |
getNodeCount()
For changing the number of neurons in the ensemble |
float |
getRadialInput(float[] state,
int node)
|
float[] |
getRadii()
|
boolean |
getReuseApproximators()
|
float[] |
getStaticNeuronData()
Used to get static neuron data (data that doesn't change each step) and give it to the GPU. |
Termination |
getTermination(java.lang.String name)
|
Termination[] |
getTerminations()
|
boolean |
isGPUNode()
|
void |
killNeurons(float killrate,
boolean saveRelays)
Stops a given percentage of neurons in this population from firing. |
java.util.Properties |
listStates()
|
void |
releaseMemory()
Releases any memory that can be freed. |
void |
removeDecodedTermination(java.lang.String name)
|
void |
reset(boolean randomize)
Resets each Node in this Ensemble. |
void |
run(float startTime,
float endTime)
Runs each neuron in the Ensemble. |
void |
setDirectModeDynamics(DynamicalSystem dynamics)
|
void |
setDirectModeIntegrator(Integrator integrator)
|
void |
setEncoders(float[][] encoders)
|
void |
setEnsembleFactory(NEFEnsembleFactory factory)
Gives the ensemble a reference to the factory used to created it (useful for adding more neurons later) |
void |
setEvalPoints(float[][] evalPoints)
Note: by-products of decoding are sometimes cached, so if these are changed it may be necessary to call setReuseApproximators(false) for the change to take effect. |
void |
setGPU(boolean useGPU)
|
void |
setMode(SimulationMode mode)
This Ensemble does not support SimulationMode.DIRECT. |
void |
setNeurons(int count)
TODO: figure out why I have to add these so that it will show up in the Configure menu (nodeCount doens't appear for some reason) |
void |
setNodeCount(int n)
|
void |
setRadii(float[] radii)
|
void |
setReuseApproximators(boolean reuse)
|
Methods inherited from class ca.nengo.model.nef.impl.DecodableEnsembleImpl |
---|
addDecodedOrigin, addDecodedOrigin, addDecodedOrigin, addDecodedOrigin, doneOrigins, getApproximatorFactory, getOrigin, getOrigins, removeDecodedOrigin, setTime |
Methods inherited from class ca.nengo.model.impl.PlasticEnsembleImpl |
---|
addTermination, getPlasticityInterval, getPlasticityRule, setLearning, setPlasticityInterval, setPlasticityRule |
Methods inherited from class ca.nengo.model.impl.EnsembleImpl |
---|
removeTermination |
Methods inherited from class ca.nengo.model.impl.AbstractEnsemble |
---|
addChangeListener, collectSpikes, findCommon1DOrigins, fireVisibleChangeEvent, getCollectSpikesRatio, getDocumentation, getMode, getName, getNodes, getSpikePattern, isCollectingSpikes, redefineNodes, removeChangeListener, setCollectSpikesRatio, setDocumentation, setName, setSpikePattern |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ca.nengo.model.nef.DecodableEnsemble |
---|
addDecodedOrigin, addDecodedOrigin, doneOrigins, removeDecodedOrigin |
Methods inherited from interface ca.nengo.model.PlasticEnsemble |
---|
getPlasticityInterval, getPlasticityRule, setPlasticityInterval, setPlasticityRule |
Methods inherited from interface ca.nengo.model.Ensemble |
---|
collectSpikes, getNodes, getSpikePattern, isCollectingSpikes, redefineNodes |
Methods inherited from interface ca.nengo.model.Node |
---|
getDocumentation, getName, getOrigin, getOrigins, setDocumentation, setName |
Methods inherited from interface ca.nengo.model.SimulationMode.ModeConfigurable |
---|
getMode |
Methods inherited from interface ca.nengo.util.VisiblyMutable |
---|
addChangeListener, removeChangeListener |
Field Detail |
---|
public static java.lang.String BIAS_SUFFIX
public static java.lang.String INTERNEURON_SUFFIX
Constructor Detail |
---|
public NEFEnsembleImpl(java.lang.String name, NEFNode[] nodes, float[][] encoders, ApproximatorFactory factory, float[][] evalPoints, float[] radii) throws StructuralException
name
- Unique name of Ensemblenodes
- Nodes that make up the Ensembleencoders
- List of encoding vectors (one for each node). All must have same lengthfactory
- Source of LinearApproximators to use in decoding outputevalPoints
- Vector inputs at which output is found to produce DecodedOrigins
StructuralException
- if there are a different number of Nodes than encoding vectors or if not
all encoders have the same lengthMethod Detail |
---|
public float[] getRadii()
getRadii
in interface NEFEnsemble
NEFEnsemble.getRadii()
public void setRadii(float[] radii) throws StructuralException
radii
- A list of radii of encoded area along each dimension; uniform
radius along each dimension can be specified with a list of length 1
StructuralException
public void setEvalPoints(float[][] evalPoints)
evalPoints
- Points in the encoded space at which node outputs are evaluated for
establishing new DecodedOrigins.public float[][] getEvalPoints()
public void setDirectModeDynamics(DynamicalSystem dynamics)
dynamics
- DynamicalSystem that models internal neuron dynamics at the ensemble level, when
the ensemble runs in direct mode. The input and output dimensions must equal the dimension of the
ensemble.public DynamicalSystem getDirectModeDynamics()
public Integrator getDirectModeIntegrator()
public void setDirectModeIntegrator(Integrator integrator)
protected float[][] getConstantOutputs(float[][] evalPoints, java.lang.String origin) throws StructuralException
evalPoints
- Vector points at which to find output (each one must have same dimension as
encoder)origin
- Name of Origin from which to collect output for each Node
StructuralException
- If CONSTANT_RATE is not supported by any Nodeprotected float[] getConstantOutput(int nodeIndex, float[][] evalPoints, java.lang.String origin) throws StructuralException, SimulationException
nodeIndex
- Index of Node for which to find output at various inputsevalPoints
- Vector points at which to find output (each one must have same dimension as
encoder)origin
- Name of Origin from which to collect output
StructuralException
- If CONSTANT_RATE is not supported by the given Node
SimulationException
- If the Node does not have an Origin with the given namepublic int getDimension()
getDimension
in interface ExpandableNode
getDimension
in interface NEFEnsemble
getDimension
in class EnsembleImpl
NEFEnsemble.getDimension()
public float[][] getEncoders()
getEncoders
in interface NEFEnsemble
NEFEnsemble.getEncoders()
public void setEncoders(float[][] encoders)
encoders
- New encoding vectors (row per Node)public boolean getReuseApproximators()
public void setReuseApproximators(boolean reuse)
reuse
- True if LinearApproximators for a Node Origin are re-used for decoding multiple decoded Origins.public Origin addDecodedOrigin(java.lang.String name, Function[] functions, java.lang.String nodeOrigin) throws StructuralException
NEFEnsemble
addDecodedOrigin
in interface NEFEnsemble
name
- Name of decodingfunctions
- Functions that define the decoding (one function for each dimension of output).
All functions must have an input dimension equal to the dimension of this NEFEnsemble.nodeOrigin
- Name of the Node-level Origins from which this Ensemble-level Origin is derived
(often Neuron.AXON)
StructuralException
- if functions do not all have the same input dimension as the
dimension of this ensembleNEFEnsemble.addDecodedOrigin(java.lang.String, Function[], String)
public BiasOrigin addBiasOrigin(Origin existing, int numInterneurons, java.lang.String name, boolean excitatory) throws StructuralException
NEFEnsemble
addBiasOrigin
in interface NEFEnsemble
existing
- An existing Origin on this NEFEnsemblenumInterneurons
- Number of interneuronsname
- Name of BiasOrigin (name of associated interneuron ensemble is also derived from this)excitatory
- If true, effective weights will be positive; if false they will be negative (inhibitory)
StructuralException
- if given Origin is not a DecodedOrigin or if there is a construction problemNEFEnsemble.addBiasOrigin(ca.nengo.model.Origin, int, java.lang.String, boolean)
public Termination addDecodedTermination(java.lang.String name, float[][] matrix, float tauPSC, boolean isModulatory) throws StructuralException
NEFEnsemble
addDecodedTermination
in interface NEFEnsemble
name
- Unique name for this Termination (in the scope of this Ensemble)matrix
- Transformation matrix which defines a linear map on incoming information,
onto the space of vectors that can be represented by this NEFEnsemble. The first dimension
is taken as matrix rows, and must have the same length as the Origin that will be connected
to this Termination. The second dimension is taken as matrix columns, and must have the same
length as the encoders of this NEFEnsemble. TODO: this is transposed?tauPSC
- Time constant of post-synaptic current decay (all Terminations have
this property but it may have slightly different interpretations depending other properties
of the Termination).isModulatory
- If true, inputs to this Termination do not drive Nodes in the Ensemble directly
but may have modulatory influences (eg related to plasticity). If false, the transformation matrix
output dimension must match the dimension of this Ensemble.
StructuralException
- if given transformation matrix is not a matrixNEFEnsemble.addDecodedTermination(java.lang.String, float[][], float, boolean)
public Termination addDecodedTermination(java.lang.String name, float[][] matrix, float[] tfNumerator, float[] tfDenominator, float passthrough, boolean isModulatory) throws StructuralException
NEFEnsemble
addDecodedTermination
in interface NEFEnsemble
name
- Unique name for this Termination (in the scope of this Ensemble)matrix
- Transformation matrix which defines a linear map on incoming informationtfNumerator
- Coefficients of transfer function numerator (see CanonicalModel.getRealization(...)
for details)tfDenominator
- Coefficients of transfer function denominatorisModulatory
- If true, inputs to this Termination do not drive Nodes in the Ensemble directly
but may have modulatory influences (eg related to plasticity). If false, the transformation matrix
output dimension must match the dimension of this Ensemble.
StructuralException
- if given transformation matrix is not a matrix or there is a problem
with the transfer functionNEFEnsemble.addDecodedTermination(java.lang.String, float[][], float[], float[], float, boolean)
public BiasTermination[] addBiasTerminations(DecodedTermination baseTermination, float interneuronTauPSC, float[][] biasDecoders, float[][] functionDecoders) throws StructuralException
NEFEnsemble
addBiasTerminations
in interface NEFEnsemble
baseTermination
- The Termination that is to be biased (so that projections to it consist of weights of a single sign)interneuronTauPSC
- Time constant of post-synaptic current decay of inhibitory termination from interneurons onto this ensemblebiasDecoders
- The decoding weights of the associated BiasOriginfunctionDecoders
- The decoding vectors of the BiasOrigin's associated base origin
StructuralException
NEFEnsemble.addBiasTerminations(ca.nengo.model.nef.impl.DecodedTermination, float, float[][], float[][])
public void removeDecodedTermination(java.lang.String name)
removeDecodedTermination
in interface NEFEnsemble
name
- Name of Termination to remove.NEFEnsemble.removeDecodedTermination(java.lang.String)
public Termination[] getTerminations()
getTerminations
in interface Node
getTerminations
in class EnsembleImpl
Node.getTerminations()
public DecodedTermination[] getDecodedTerminations()
public DecodedOrigin[] getDecodedOrigins()
public void run(float startTime, float endTime) throws SimulationException
AbstractEnsemble
run
in interface Node
run
in class DecodableEnsembleImpl
startTime
- simulation time at which running starts (s)endTime
- simulation time at which running ends (s)
SimulationException
- if a problem is encountered while trying to runNode.run(float, float)
public float getRadialInput(float[] state, int node)
state
- State vectornode
- Node number
public Termination getTermination(java.lang.String name) throws StructuralException
getTermination
in interface Node
getTermination
in class EnsembleImpl
name
- Name of a Termination onto this Node
StructuralException
- if the named Termination does not existNode.getTermination(java.lang.String)
public void setMode(SimulationMode mode)
EnsembleImpl
setMode
in interface SimulationMode.ModeConfigurable
setMode
in class EnsembleImpl
mode
- SimulationMode in which it is desired that the object runs.SimulationMode.ModeConfigurable.setMode(ca.nengo.model.SimulationMode)
public void fixMode()
public boolean getModeFixed()
public void reset(boolean randomize)
AbstractEnsemble
reset
in interface Resettable
reset
in class PlasticEnsembleImpl
randomize
- True indicates that the object should be reset to a
randomly selected initial state (the object must be aware of the
distribution from which to draw from). False indicates that the
object should be reset to a fixed initial state (which it must
also know). Some objects may not support randomization of the initial
state, in which case a fixed state will be used in either case.Resettable.reset(boolean)
public void setEnsembleFactory(NEFEnsembleFactory factory)
NEFEnsemble
setEnsembleFactory
in interface NEFEnsemble
public NEFEnsembleFactory getEnsembleFactory()
getEnsembleFactory
in interface NEFEnsemble
public int getNodeCount()
NEFEnsemble
getNodeCount
in interface NEFEnsemble
public void setNodeCount(int n) throws StructuralException
setNodeCount
in interface NEFEnsemble
StructuralException
public TimeSeries getHistory(java.lang.String stateName) throws SimulationException
Probeable
getHistory
in interface Probeable
getHistory
in class DecodableEnsembleImpl
stateName
- A state variable name
SimulationException
- if the Probeable does not have the requested stateProbeable.getHistory(java.lang.String)
public java.util.Properties listStates()
listStates
in interface Probeable
listStates
in class DecodableEnsembleImpl
Probeable.listStates()
public NEFEnsemble clone() throws java.lang.CloneNotSupportedException
clone
in interface Node
clone
in class DecodableEnsembleImpl
java.lang.CloneNotSupportedException
public void releaseMemory()
releaseMemory
in interface NEFEnsemble
public void setNeurons(int count) throws StructuralException
StructuralException
public int getNeurons()
public float[] getStaticNeuronData()
public boolean isGPUNode()
public void setGPU(boolean useGPU)
public void killNeurons(float killrate, boolean saveRelays)
killrate
- the percentage of neurons to stop firingsaveRelays
- if true, do nothing if there is only one node in this population
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |