|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mosaic.sim.neuron.netoutputs.OutputFilter
This class is a decorator for output listeners, enabling the filtering of output events: - first of all, it can pass only the first event and filter out all subsequent ones - secondly, events can be forwarded when the have reached an equilibrium, i.e. they do not change anymore within a given error range The constructor intializes the filter. When forwardMultipleEvents is true, then all events will be forwarded (depending on the value of waitForEquilibrium). If it is false, only the first event (also depending on waitForEquilibrium) will be forwarded. When waitForEquilibrium is true, then an event will forwarded only when the difference to the previously received event is within a certain, given margin. E.g. when waitForEquilibrium and forwardMultipleEvents are both true, then the filter discards all events that change too much and forwards the first one that has a small difference (as given by maxSquareError). After this forwarding, the filter resets and waits for the next equilibrium. The "error", i.e. the difference between two received events, is calculated as the squared difference between the vectors or matrices. When the error is below the given maxSquareError, then the state is regarded as being an equilibrium. Note that the error is divided by the number of elements in the vector or matrix for normalization.
Field Summary | |
protected boolean |
forwardedFirstEvent
True when an event has already been forwarded. |
protected boolean |
forwardMultipleEvents
When true, then multiple events will be forwarded. |
protected double[][] |
lastMatrix
The last matrix that has been received - used for determining if an equilibrium has been reached. |
protected double[] |
lastVector
The last vector that has been received - used for determining if an equilibrium has been reached. |
protected double |
maxSquareError
The maximum square error for determining if the received event is in an equilibrium state. |
protected MatrixOutputListener |
nextMatrixListener
The object to which the filtered matrix events will be forwarded. |
protected VectorOutputListener |
nextVectorListener
The object to which the filtered vector events will be forwarded. |
protected boolean |
waitForEquilibrium
When true, then only those events will be forwarded that are only marginally different from the previous. |
Constructor Summary | |
OutputFilter(VectorOutputListener nextVectorListener,
MatrixOutputListener nextMatrixListener,
boolean forwardMultipleEvents,
boolean waitForEquilibrium,
double maxSquareError)
Constructs an OuptutFilter object and initializes the mamber variables according to the given parameters. |
Method Summary | |
protected double |
calcSquareError(double[][] lastMatrx,
double[][] matrix)
Calculates the normalized (divided by number of elements in the matrix length) square difference between the given matrices. |
protected double |
calcSquareError(double[] lastVector,
double[] vector)
Calculates the normalized (divided by the vector length) square difference between the given vectors. |
void |
outputEvent(double[] vector)
Implementation of VectorOutputListener.outputEvent. |
void |
outputEvent(double[][] matrix)
Implementation of MatrixOutputListener.outputEvent. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected VectorOutputListener nextVectorListener
protected MatrixOutputListener nextMatrixListener
protected boolean forwardMultipleEvents
protected boolean waitForEquilibrium
protected double maxSquareError
protected boolean forwardedFirstEvent
protected double[] lastVector
protected double[][] lastMatrix
Constructor Detail |
public OutputFilter(VectorOutputListener nextVectorListener, MatrixOutputListener nextMatrixListener, boolean forwardMultipleEvents, boolean waitForEquilibrium, double maxSquareError)
nextVectorListener
- See member variable nextVectorListenernextMatrixListener
- See member variable nextMatrixListenerforwardMultipleEvents
- See member variable forwardMultipleEventswaitForEquilibrium
- See member variable waitForEquilibriummaxSquareError
- See member variable maxSquareErrorMethod Detail |
protected double calcSquareError(double[] lastVector, double[] vector)
protected double calcSquareError(double[][] lastMatrx, double[][] matrix)
public void outputEvent(double[] vector)
outputEvent
in interface VectorOutputListener
mosaic.sim.neuron.netoutputs.VectorOutputListener
vector
- The real numbered values corresponding to the spike series
using the respective coding scheme implemented by the
Spike decoder.public void outputEvent(double[][] matrix)
outputEvent
in interface MatrixOutputListener
mosaic.sim.neuron.netoutputs.MatrixOutputListener
matrix
- The real numbered values corresponding to the spike series
using the respective coding scheme implemented by the
Spike decoder.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |