Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.joone.engine
Class Monitor

    java.lang.Object
      org.joone.engine.Monitor

All Implemented Interfaces:
  java.io.Serializable

    public class Monitor

extends java.lang.Object
implements java.io.Serializable

The Monitor object is the controller of the behavior of the neural net. It controls the start/stop actions and permits to set the parameters of the net (learning rate, momentum, ecc.). Each component of the neural net (Layers and Synapses) are connected to a monitor object (the monitor can be different or the same for the all components).

See Also:
  Serialized Form

Field Summary
`int` | `learningMode`

Constructor Summary
`Monitor()` This is the default Constructor.

Method Summary
`void` | `addLearner(int i, java.lang.String learner)` Adds a new Learner to the Neural Network Usage: Monitor.addLearner(0, "org.joone.engine.BasicLearner"); Monitor.addLearner(1, "org.joone.engine.BatchLearner"); Monitor.addLearner(2, "org.joone.engine.RpropLearner");
`void` | `addNeuralNetListener(NeuralNetListener l)` adds a neural net event listener the Monitor
`void` | `addNeuralNetListener(NeuralNetListener l, boolean removable)` adds a neural net event listener to the Monitor
`java.util.TreeSet` | `check()`
`void` | `fireCicleTerminated()` Invoked when an epoch finishes
`void` | `fireErrorChanged()` Invoked when the GlobalError changes
`void` | `fireNetStarted()` Invoked when the net starts
`void` | `fireNetStopped()` Invoked when all the epochs finish
`void` | `fireNetStoppedError(java.lang.String errMsg)` Invoked when an error occurs
`int` | `getBatchSize()` Getter for the property BatchSize
`int` | `getCurrentCicle()` Returns the current epoch
`double` | `getGlobalError()` Returns the actual (R)MSE of the NN
`java.lang.String[]` | `getKeys()` Return all the keys of the parameters contained in this Monitor.
`Learner` | `getLearner()` Gets a learner for a synapse or layer.
`Learner` | `getLearner(int index)` Getter for the Learner declared at position 'index'
`protected java.util.List` | `getLearners()` Getter for property learners.
`int` | `getLearningMode()` Getter for property learningMode.
`double` | `getLearningRate()` Returns the learning rate
`double` | `getMomentum()` Returns the momentum
`int` | `getNumOfPatterns()`
`java.lang.Object` | `getParam(java.lang.String key)` Gets a custom parameter from the Monitor.
`Monitor` | `getParent()` Getter for property parent.
`int` | `getPreLearning()` Returns the initial ignored input patterns (during the training phase)
`int` | `getRun()` Needed for XML saving
`int` | `getStep()` Returns the actual elaborated pattern
`int` | `getTotCicles()` Returns the total number of epochs
`int` | `getTrainingPatterns()` Returns the number of the input training patterns
`int` | `getValidationPatterns()` Returns the number of the input validation patterns
`void` | `Go()` Runs the neural net in multi-thread mode.
`boolean` | `isExporting()` Getter for property exporting.
`boolean` | `isLearning()` Returns TRUE if the net is into a learning phase
`boolean` | `isLearningCicle(int num)` Returns the phase of the net (learning or not) for the current pattern
`boolean` | `isSingleThreadMode()`
`boolean` | `isSupervised()` Getter for property supervised.
`boolean` | `isTrainingDataForValidation()` Getter for the property trainingDataForValidation, i.e. should the training data be used for validation.
`boolean` | `isUseRMSE()` Checks if we should use RMSE (true) or MSE false.
`boolean` | `isValidation()` Getter for property validation.
`boolean` | `nextStep()` Returns if the next pattern must be elaborated
`protected java.lang.Object` | `readResolve()`
`void` | `removeAllListeners()` Removes all the NeuralNetListeners.
`void` | `removeNeuralNetListener(NeuralNetListener l)` Removes a listener
`void` | `resetCycle()`
`void` | `runAgain()` Let continue the net.
`void` | `setBatchSize(int i)` Setter for the property BatchSize
`void` | `setCurrentCicle(int newCurrentCicle)` Not used
`void` | `setExporting(boolean exporting)` Setter for property exporting.
`void` | `setGlobalError(double newGlobalError)` Sets the actual error of the NN
`void` | `setLearnerFactory(LearnerFactory aFactory)` Set learner factory.
`protected void` | `setLearners(java.util.List learners)` Setter for property learners.
`void` | `setLearning(boolean newLearning)` Sets the phase of the neural network: learning (true) or recall (false)
`void` | `setLearningMode(int learningMode)` Setter for property learningMode.
`void` | `setLearningRate(double newLearningRate)` Sets the learning rate
`void` | `setMomentum(double newMomentum)` Sets the momentum
`void` | `setParam(java.lang.String key, java.lang.Object obj)` Sets a custom parameter of the Monitor.
`void` | `setParent(Monitor parent)` Setter for property parent.
`void` | `setPreLearning(int newPreLearning)` Sets the initial ignored input patterns (during the training phase)
`void` | `setSingleThreadMode(boolean singleThreadMode)`
`void` | `setSupervised(boolean supervised)` Setter for property supervised.
`void` | `setTotCicles(int newTotCicles)` Sets the total number of epochs
`void` | `setTrainingDataForValidation(boolean aMode)` Setter for the property trainingDataForValidation.
`void` | `setTrainingPatterns(int newPatterns)` Sets the number of the input training patterns
`void` | `setUseRMSE(boolean aMode)` Uses the RMSE when set to true.
`void` | `setValidation(boolean validation)` Setter for property validation.
`void` | `setValidationPatterns(int newPatterns)` Sets the number of the input validation patterns
`void` | `Stop()` Stops the NN when running in multi-thread mode.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### learningMode

    public int learningMode

Constructor Detail

### Monitor

    public Monitor()

  This is the default Constructor.

Method Detail

### addNeuralNetListener

    public void addNeuralNetListener(NeuralNetListener l)

  adds a neural net event listener the Monitor

  Parameters:
    `l` - NeuralNetListener

### addNeuralNetListener

    public void addNeuralNetListener(NeuralNetListener l,
                                     boolean removable)

  adds a neural net event listener to the Monitor

  Parameters:
    `l` - the new NeuralNetListener
    `removable` - true if the added listener can be removed by the removeAllListeners method call

### fireCicleTerminated

    public void fireCicleTerminated()

  Invoked when an epoch finishes

### fireNetStarted

    public void fireNetStarted()

  Invoked when the net starts

### fireNetStopped

    public void fireNetStopped()

  Invoked when all the epochs finish

### fireNetStoppedError

    public void fireNetStoppedError(java.lang.String errMsg)

  Invoked when an error occurs

  Parameters:
    `errMsg` - the thrown error message

### fireErrorChanged

    public void fireErrorChanged()

  Invoked when the GlobalError changes

### getCurrentCicle

    public int getCurrentCicle()

  Returns the current epoch

  Returns:
    int

### getGlobalError

    public double getGlobalError()

  Returns the actual (R)MSE of the NN

  Returns:
    double

### getLearningRate

    public double getLearningRate()

  Returns the learning rate

  Returns:
    double

### getMomentum

    public double getMomentum()

  Returns the momentum

  Returns:
    double

### getTrainingPatterns

    public int getTrainingPatterns()

  Returns the number of the input training patterns

  Returns:
    int

### setTrainingPatterns

    public void setTrainingPatterns(int newPatterns)

  Sets the number of the input training patterns

  Parameters:
    `newPatterns` - int

### getPreLearning

    public int getPreLearning()

  Returns the initial ignored input patterns (during the training phase)

  Returns:
    int

### getStep

    public int getStep()

  Returns the actual elaborated pattern

  Returns:
    int

### getTotCicles

    public int getTotCicles()

  Returns the total number of epochs

  Returns:
    int

### Go

    public void Go()

  Runs the neural net in multi-thread mode. WARNING: AVOID to invoke this method. Use instead NeuralNet.go()

  See Also:
    `org.joone.net.NeuralNet.go()`

### isLearning

    public boolean isLearning()

  Returns TRUE if the net is into a learning phase

  Returns:
    boolean

### isLearningCicle

    public boolean isLearningCicle(int num)

  Returns the phase of the net (learning or not) for the current pattern

  Parameters:
    `num` - the pattern requested
  Returns:
    boolean

### resetCycle

    public void resetCycle()

### nextStep

    public boolean nextStep()

  Returns if the next pattern must be elaborated

  Returns:
    boolean

### readResolve

    protected java.lang.Object readResolve()

### removeNeuralNetListener

    public void removeNeuralNetListener(NeuralNetListener l)

  Removes a listener

  Parameters:
    `l` - the listener to be removed

### runAgain

    public void runAgain()

  Let continue the net.

### setCurrentCicle

    public void setCurrentCicle(int newCurrentCicle)

  Not used

  Parameters:
    `newCurrentCicle` - int

### setGlobalError

    public void setGlobalError(double newGlobalError)

  Sets the actual error of the NN

  Parameters:
    `newGlobalError` - double

### setLearning

    public void setLearning(boolean newLearning)

  Sets the phase of the neural network: learning (true) or recall (false)

  Parameters:
    `newLearning` - boolean

### setLearningRate

    public void setLearningRate(double newLearningRate)

  Sets the learning rate

  Parameters:
    `newLearningRate` - double

### setMomentum

    public void setMomentum(double newMomentum)

  Sets the momentum

  Parameters:
    `newMomentum` - double

### setPreLearning

    public void setPreLearning(int newPreLearning)

  Sets the initial ignored input patterns (during the training phase)

  Parameters:
    `newPreLearning` - int

### setTotCicles

    public void setTotCicles(int newTotCicles)

  Sets the total number of epochs

  Parameters:
    `newTotCicles` - int

### Stop

    public void Stop()

  Stops the NN when running in multi-thread mode. WARNING: DO NOT INVOKE directly, use instead NeuralNet.stop()

  See Also:
    `org.joone.net.NeuralNet.stop()`

### isExporting

    public boolean isExporting()

  Getter for property exporting.

  Returns:
    Value of property exporting.

### setExporting

    public void setExporting(boolean exporting)

  Setter for property exporting.

  Parameters:
    `exporting` - New value of property exporting.

### getRun

    public int getRun()

  Needed for XML saving

### isValidation

    public boolean isValidation()

  Getter for property validation.

  Returns:
    Value of property validation.

### setValidation

    public void setValidation(boolean validation)

  Setter for property validation.

  Parameters:
    `validation` - New value of property validation.

### isTrainingDataForValidation

    public boolean isTrainingDataForValidation()

  Getter for the property trainingDataForValidation, i.e. should the training data be used for validation.

  Returns:
    true if the training data should be used, false otherwise.

### setTrainingDataForValidation

    public void setTrainingDataForValidation(boolean aMode)

  Setter for the property trainingDataForValidation.

  Parameters:
    `aMode` - true if the training data should be used for validation, false otherwise.

### removeAllListeners

    public void removeAllListeners()

  Removes all the NeuralNetListeners. Removes only the listeners marked as removable

  See Also:
    `addNeuralNetListener`

### getParent

    public Monitor getParent()

  Getter for property parent.

  Returns:
    Value of property parent.

### setParent

    public void setParent(Monitor parent)

  Setter for property parent.

  Parameters:
    `parent` - New value of property parent.

### getValidationPatterns

    public int getValidationPatterns()

  Returns the number of the input validation patterns

  Returns:
    int

### setValidationPatterns

    public void setValidationPatterns(int newPatterns)

  Sets the number of the input validation patterns

  Parameters:
    `newPatterns` - int

### getNumOfPatterns

    public int getNumOfPatterns()

### check

    public java.util.TreeSet check()

### isSupervised

    public boolean isSupervised()

  Getter for property supervised.

  Returns:
    Value of property supervised.

### setSupervised

    public void setSupervised(boolean supervised)

  Setter for property supervised. (default = false)

  Parameters:
    `supervised` - New value of property supervised.

### getBatchSize

    public int getBatchSize()

  Getter for the property BatchSize

  Returns:
    the size (# of cycles) of the batch mode

### setBatchSize

    public void setBatchSize(int i)

  Setter for the property BatchSize

  Parameters:
    `the` - size (# of cycles) of the batch mode

### getLearningMode

    public int getLearningMode()

  Getter for property learningMode. The learningMode determines the kind of learning algorithm applied to the neural network.

  Returns:
    Value of property learningMode.
  See Also:
    `getLearners()`

### setLearningMode

    public void setLearningMode(int learningMode)

  Setter for property learningMode.

  Parameters:
    `learningMode` - New value of property learningMode.

### getLearner

    public Learner getLearner(int index)

  Getter for the Learner declared at position 'index'

  Parameters:
    `the` - index of the Learner to get
  Returns:
    the Learner at 'index' position
  See Also:
    `getLearners()`

### getLearner

    public Learner getLearner()

  Gets a learner for a synapse or layer.

  Returns:
    a learner for a synapse or layer.

### getLearners

    protected java.util.List getLearners()

  Getter for property learners.

  Returns:
    Value of property learners.

### setLearners

    protected void setLearners(java.util.List learners)

  Setter for property learners. Used to set all the Learner objects used by this NN.

  Parameters:
    `learners` - New value of property learners.

### addLearner

    public void addLearner(int i,
                           java.lang.String learner)

  Adds a new Learner to the Neural Network Usage: Monitor.addLearner(0, "org.joone.engine.BasicLearner"); Monitor.addLearner(1, "org.joone.engine.BatchLearner"); Monitor.addLearner(2, "org.joone.engine.RpropLearner");

  Parameters:
    `i` - the index of the new Learner
    `learner` - a String containing the class name of the Learner to add

### getParam

    public java.lang.Object getParam(java.lang.String key)

  Gets a custom parameter from the Monitor. The user is free to use the custom parameters as s/he wants. They are useful to store a whatever value that could be used by the nnet's components. It has been introduced to set the parameters of new added Learners.

  Parameters:
    `key` - The searched key
  Returns:
    The value of the parameter if found, otherwise null

### setParam

    public void setParam(java.lang.String key,
                         java.lang.Object obj)

  Sets a custom parameter of the Monitor. The user is free to use the custom parameters as s/he wants. They are useful to store a whatever value that could be used by the nnet's components. It has been introduced to set the parameters of new added Learners.

  Parameters:
    `key` - The key of the param
    `obj` - The value of the param

### getKeys

    public java.lang.String[] getKeys()

  Return all the keys of the parameters contained in this Monitor.

  Returns:
    An array of Strings containing all the keys if found, otherwise null

### setUseRMSE

    public void setUseRMSE(boolean aMode)

  Uses the RMSE when set to true. Uses MSE when set to false.

  Parameters:
    `aMode` - the mode to set true for RMSE, false for MSE.

### isUseRMSE

    public boolean isUseRMSE()

  Checks if we should use RMSE (true) or MSE false.

  Returns:
    true if we should use RMSE, false if we should use MSE.

### setLearnerFactory

    public void setLearnerFactory(LearnerFactory aFactory)

  Set learner factory.

  Parameters:
    `aFactory` - the learner factory to set.

### isSingleThreadMode

    public boolean isSingleThreadMode()

### setSingleThreadMode

    public void setSingleThreadMode(boolean singleThreadMode)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit Feedback to pmarrone@users.sourceforge.net