Documentation of 'org.joone.engine.Monitor' Java class
Monitor
org.joone.engine

Class 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 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
      • 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.
      • 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)

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.