net.sourceforge.jabm.learning
Class SlidingWindowLearner

java.lang.Object
  extended by net.sourceforge.jabm.learning.AbstractLearner
      extended by net.sourceforge.jabm.learning.SlidingWindowLearner
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ContinuousLearner, Learner, MimicryLearner, SelfKnowledgable, Prototypeable

public class SlidingWindowLearner
extends AbstractLearner
implements MimicryLearner, SelfKnowledgable, Prototypeable, java.io.Serializable

maintains a sliding window over the trained data series and use the average of data items falling into the window as the output learned.

See Also:
Serialized Form
 

Field Summary
protected  double currentOutput
          The current output level.
protected  FixedLengthQueue memory
           
static java.lang.String P_DEF_BASE
           
static java.lang.String P_WINDOWSIZE
           
protected  cern.jet.random.AbstractContinousDistribution randomParamDistribution
           
protected  int windowSize
          A parameter used to adjust the size of the window
 
Fields inherited from class net.sourceforge.jabm.learning.AbstractLearner
monitor
 
Constructor Summary
SlidingWindowLearner(cern.jet.random.AbstractContinousDistribution randomParamDistribution)
           
SlidingWindowLearner(cern.jet.random.engine.RandomEngine prng)
           
 
Method Summary
 double act()
          Generate an output from the learning algorithm.
protected  void createMemory()
           
 void dumpState(DataWriter out)
          Write out our state data to the specified data writer.
 double getCurrentOutput()
           
 double getLearningDelta()
          Return a value indicative of the amount of learning that occured during the last iteration.
 int getWindowSize()
           
 boolean goodEnough()
           
 void initialise()
           
 java.lang.Object protoClone()
           
 void randomInitialise()
          Initialise with random values for free parameters
 void reset()
           
 void setOutputLevel(double currentOutput)
          no effect on FixedLengthQueue-based next output!
 void setWindowSize(int windowSize)
           
 java.lang.String toString()
           
 void train(double target)
          Provide a training signal to the learning algorithm.
 
Methods inherited from class net.sourceforge.jabm.learning.AbstractLearner
monitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.jabm.learning.Learner
monitor
 

Field Detail

randomParamDistribution

protected cern.jet.random.AbstractContinousDistribution randomParamDistribution

windowSize

protected int windowSize
A parameter used to adjust the size of the window


P_WINDOWSIZE

public static final java.lang.String P_WINDOWSIZE
See Also:
Constant Field Values

currentOutput

protected double currentOutput
The current output level.


P_DEF_BASE

public static final java.lang.String P_DEF_BASE
See Also:
Constant Field Values

memory

protected FixedLengthQueue memory
Constructor Detail

SlidingWindowLearner

public SlidingWindowLearner(cern.jet.random.engine.RandomEngine prng)

SlidingWindowLearner

public SlidingWindowLearner(cern.jet.random.AbstractContinousDistribution randomParamDistribution)
Method Detail

initialise

public void initialise()

reset

public void reset()

randomInitialise

public void randomInitialise()
Description copied from interface: MimicryLearner
Initialise with random values for free parameters

Specified by:
randomInitialise in interface MimicryLearner

setWindowSize

public void setWindowSize(int windowSize)

getWindowSize

public int getWindowSize()

createMemory

protected void createMemory()

act

public double act()
Description copied from interface: ContinuousLearner
Generate an output from the learning algorithm.

Specified by:
act in interface ContinuousLearner

train

public void train(double target)
Description copied from interface: MimicryLearner
Provide a training signal to the learning algorithm.

Specified by:
train in interface MimicryLearner

dumpState

public void dumpState(DataWriter out)
Description copied from interface: Learner
Write out our state data to the specified data writer.

Specified by:
dumpState in interface Learner
Specified by:
dumpState in class AbstractLearner

getCurrentOutput

public double getCurrentOutput()

setOutputLevel

public void setOutputLevel(double currentOutput)
no effect on FixedLengthQueue-based next output!

Specified by:
setOutputLevel in interface MimicryLearner

getLearningDelta

public double getLearningDelta()
Description copied from interface: Learner
Return a value indicative of the amount of learning that occured during the last iteration. Values close to 0.0 indicate that the learner has converged to an equilibrium state.

Specified by:
getLearningDelta in interface Learner
Specified by:
getLearningDelta in class AbstractLearner
Returns:
A double representing the amount of learning that occured.

protoClone

public java.lang.Object protoClone()
Specified by:
protoClone in interface Prototypeable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

goodEnough

public boolean goodEnough()
Specified by:
goodEnough in interface SelfKnowledgable