public class DecodedOrigin extends java.lang.Object implements Origin, Resettable, SimulationMode.ModeConfigurable, Noise.Noisy, Configurable, ShortTermPlastic
Constructor and Description |
---|
DecodedOrigin(Node node,
java.lang.String name,
Node[] nodes,
java.lang.String nodeOrigin,
Function[] functions,
float[][] decoders,
int dummy)
With this constructor decoding vectors are specified by the caller.
|
DecodedOrigin(Node node,
java.lang.String name,
Node[] nodes,
java.lang.String nodeOrigin,
Function[] functions,
LinearApproximator approximator)
With this constructor, decoding vectors are generated using default settings.
|
DecodedOrigin(Node node,
java.lang.String name,
Node[] nodes,
java.lang.String nodeOrigin,
TimeSeries targetSignal,
LinearApproximator approximator)
With this constructor the target is a signal over time rather than a function.
|
Modifier and Type | Method and Description |
---|---|
DecodedOrigin |
clone() |
DecodedOrigin |
clone(Node node)
Clone method that changes necessary parameters to point to a new parent,
for use in cloning ensembles, etc.
|
Configuration |
getConfiguration() |
float[][] |
getDecoders() |
int |
getDimensions() |
float[] |
getError() |
float[] |
getError(int samples) |
ExpressModel |
getExpressModel() |
Function[] |
getFunctions() |
SimulationMode |
getMode() |
java.lang.String |
getName() |
Node |
getNode() |
protected java.lang.String |
getNodeOrigin() |
Noise |
getNoise() |
boolean |
getRequiredOnCPU() |
DynamicalSystem |
getSTPDynamics() |
DynamicalSystem |
getSTPDynamics(int i)
Provides access to copy of dynamics for an individual node, to allow node-by-node
parameterization.
|
protected TimeSeries |
getSTPHistory() |
InstantaneousOutput |
getValues() |
void |
rebuildDecoder(LinearApproximator approximator)
Recalculates the decoders
|
void |
redefineNodes(Node[] nodes,
LinearApproximator approximator)
Changes the set of nodes and recalculates the decoders
|
void |
rescaleDecoders(float[] scale)
Rescales the decoders.
|
void |
reset(boolean randomize) |
void |
run(float[] state,
float startTime,
float endTime)
Must be called at each time step after Nodes are run and before getValues().
|
void |
setDecoders(float[][] decoders) |
void |
setExpressModel(ExpressModel em) |
void |
setMode(SimulationMode mode)
Sets the object to run in either the given mode or the closest mode that it supports
(all ModeConfigurables must support SimulationMode.DEFAULT, and must default to this mode).
|
void |
setNoise(Noise noise) |
void |
setNoises(Noise[] noises) |
void |
setRequiredOnCPU(boolean val) |
void |
setSTPDynamics(DynamicalSystem dynamics) |
void |
setValues(InstantaneousOutput val) |
void |
setValues(RealOutput ro) |
public DecodedOrigin(Node node, java.lang.String name, Node[] nodes, java.lang.String nodeOrigin, Function[] functions, LinearApproximator approximator) throws StructuralException
node
- The parent Nodename
- Name of this Originnodes
- Nodes that belong to the NEFEnsemble from which this Origin arisesnodeOrigin
- Name of the Origin on each given node from which output is to be decodedfunctions
- Output Functions on the vector that is represented by the NEFEnsemble
(one Function per dimension of output). For example if the Origin is to output
x1*x2, where the ensemble represents [x1 x1], then one 2D function would be
needed in this list. The input dimension of each function must be the same as the
dimension of the state vector represented by this ensemble.approximator
- A LinearApproximator that can be used to approximate new functions as a weighted sum of the node outputs.StructuralException
- if functions do not all have the same input dimension (we
don't check against the state dimension at this point)public DecodedOrigin(Node node, java.lang.String name, Node[] nodes, java.lang.String nodeOrigin, Function[] functions, float[][] decoders, int dummy) throws StructuralException
node
- The parent Nodename
- As in other constructornodes
- As in other constructornodeOrigin
- Name of the Origin on each given node from which output is to be decodedfunctions
- As in other constructordecoders
- Decoding vectors which are scaled by the main output of each Node, and
then summed, to estimate the same function of the ensembles state vector that is
defined by the 'functions' arg. The 'functions' arg is still needed, because in DIRECT
SimulationMode, these functions are used directly. The 'decoders' arg allows the caller
to provide decoders that are generated with non-default methods or parameters (eg an
unusual number of singular values). Must be a matrix with one row per Node and one
column per function.StructuralException
- If dimensions.length != neurons.length, decoders is not a matrix
(ie all elements with same length), or if the number of columns in decoders is not equal
to the number of functionspublic DecodedOrigin(Node node, java.lang.String name, Node[] nodes, java.lang.String nodeOrigin, TimeSeries targetSignal, LinearApproximator approximator) throws StructuralException
node
- The parent Nodename
- As in other constructornodes
- As in other constructornodeOrigin
- Name of the Origin on each given node from which output is to be decodedtargetSignal
- Signal over time that this origin should produce.approximator
- A LinearApproximator that can be used to approximate new signals as a weighted sum of the node outputs.StructuralException
public ExpressModel getExpressModel()
public void setExpressModel(ExpressModel em)
em
- Simplified model of deviations from DIRECT mode that are associated with spiking simulationspublic Configuration getConfiguration()
getConfiguration
in interface Configurable
Configurable.getConfiguration()
public float[] getError()
public float[] getError(int samples)
samples
- The number of input vectors the error is sampled overpublic void setNoise(Noise noise)
setNoise
in interface Noise.Noisy
noise
- New output noise model (defaults to no noise)public void setNoises(Noise[] noises) throws SimulationException
noises
- New output noise model for each dimension of outputSimulationException
public Noise getNoise()
getNoise
in interface Noise.Noisy
public void reset(boolean randomize)
reset
in interface Resettable
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 java.lang.String getName()
getName
in interface Origin
Origin.getName()
public int getDimensions()
getDimensions
in interface Origin
Origin.getDimensions()
public float[][] getDecoders()
public DynamicalSystem getSTPDynamics()
getSTPDynamics
in interface ShortTermPlastic
ShortTermPlastic.getSTPDynamics()
public DynamicalSystem getSTPDynamics(int i)
i
- Node numberpublic void setSTPDynamics(DynamicalSystem dynamics)
setSTPDynamics
in interface ShortTermPlastic
dynamics
- New dynamics of short-term plasticityShortTermPlastic.setSTPDynamics(ca.nengo.dynamics.DynamicalSystem)
public void setDecoders(float[][] decoders)
decoders
- New decoding vectors (row per Node)public void setMode(SimulationMode mode)
SimulationMode.ModeConfigurable
setMode
in interface SimulationMode.ModeConfigurable
mode
- Requested simulation modepublic SimulationMode getMode()
getMode
in interface SimulationMode.ModeConfigurable
public void run(float[] state, float startTime, float endTime) throws SimulationException
state
- Idealized state (as defined by inputs) which can be fed into (idealized) functions
that make up the Origin, when it is running in DIRECT mode. This is not used in other modes,
and can be null.startTime
- simulation time of timestep onsetendTime
- simulation time of timestep endSimulationException
- If the given state is not of the expected dimension (ie the input
dimension of the functions provided in the constructor)protected TimeSeries getSTPHistory()
public InstantaneousOutput getValues() throws SimulationException
getValues
in interface Origin
SimulationException
- if there is any problem retrieving valuesOrigin.getValues()
public void setValues(InstantaneousOutput val)
public void setValues(RealOutput ro)
ro
- Values to be setpublic Function[] getFunctions()
protected java.lang.String getNodeOrigin()
public Node getNode()
getNode
in interface Origin
Origin.getNode()
public DecodedOrigin clone() throws java.lang.CloneNotSupportedException
public DecodedOrigin clone(Node node) throws java.lang.CloneNotSupportedException
Origin
public void rescaleDecoders(float[] scale)
scale
- vector to multiply each decoder bypublic void rebuildDecoder(LinearApproximator approximator)
approximator
- approximator?public void redefineNodes(Node[] nodes, LinearApproximator approximator)
nodes
- Nodes to replace existing nodesapproximator
- approximator?public void setRequiredOnCPU(boolean val)
setRequiredOnCPU
in interface Origin
public boolean getRequiredOnCPU()
getRequiredOnCPU
in interface Origin