Class CAND

  • All Implemented Interfaces:
    Configurable, Serializable, CapabilitiesHandler, Classifier, MultiClassClassifier, AWTRenderable, Learner<Example<Instance>>, MOAObject, OptionHandler

    public class CAND
    extends AbstractClassifier
    implements MultiClassClassifier, CapabilitiesHandler
    Continuously Adaptive Neural networks for Data streams

    Continuously Adaptive Neural networks for Data streams (CAND). For every prediction, CAND chooses the current best network from a pool of candidates by continuously monitoring the performance of all candidate networks. The candidates are trained using different optimizers and hyperparameters. There are two orthogonal heuristics (skip back propagation, smaller training pool) for accelerating CAND, which trade-off small amounts of accuracy for significant runtime gains. When training, small mini-batches yields similar accuracy to single-instance fully incremental training, even on evolving data streams.

    See details in:
    Nuwan Gunasekara, Heitor Murilo Gomes, Bernhard Pfahringer, Albert Bifet. Online Hyperparameter Optimization for Streaming Neural Networks. International Joint Conference on Neural Networks (IJCNN), 2022.

    Parameters:

    • -P : The larger pool type. P10 = { learning rates: 5.0E-(1 to 5), optimizes: SGD,Adam, neurons in 1st layer: 2^(8 to 10) }, P30 = { learning rates: 5.0E-(1 to 5), optimizes: Adam, neurons in 1st layer: 2^9 }
    • -o : Number of MLPs to train at a given time (after -s numberOfInstancesToTrainAllMLPsAtStart instances).
    • -L : Number of layers in each MLP.
    • -s : Number of instances to train all MLPs at start.
    • -B : Mini Batch Size.
    • -h : Use one hot encoding.
    • -n : Normalize data.
    • -b : Skip back propagation loss threshold.
    • -d : Choose device to run the model(For GPU, needs CUDA installed on the system. Use CPU if GPUs are not available)
    • -t : Do NOT train each MLP using a separate thread.
    • -f : Votes dump file name.
    • -F : Stats dump file name.
    Version:
    $Revision: 1 $
    Author:
    Nuwan Gunasekara (ng98 at students dot waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • nn

        protected MLP[] nn
      • featureValuesArraySize

        protected int featureValuesArraySize
      • samplesSeen

        protected long samplesSeen
      • numberOfMLPsToTrainOption

        public IntOption numberOfMLPsToTrainOption
      • numberOfLayersInEachMLP

        public IntOption numberOfLayersInEachMLP
      • numberOfInstancesToTrainAllMLPsAtStartOption

        public IntOption numberOfInstancesToTrainAllMLPsAtStartOption
      • miniBatchSize

        public IntOption miniBatchSize
      • useOneHotEncode

        public FlagOption useOneHotEncode
      • useNormalization

        public FlagOption useNormalization
      • backPropLossThreshold

        public FloatOption backPropLossThreshold
      • doNotTrainEachMLPUsingASeparateThread

        public FlagOption doNotTrainEachMLPUsingASeparateThread
      • djlRandomSeed

        public IntOption djlRandomSeed
    • Constructor Detail

      • CAND

        public CAND()
    • Method Detail

      • resetLearningImpl

        public void resetLearningImpl()
        Description copied from class: AbstractClassifier
        Resets this classifier. It must be similar to starting a new classifier from scratch.

        The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.
        Specified by:
        resetLearningImpl in class AbstractClassifier
      • trainOnInstanceImpl

        public void trainOnInstanceImpl​(Instance instance)
        Description copied from class: AbstractClassifier
        Trains this classifier incrementally using the given instance.

        The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.
        Specified by:
        trainOnInstanceImpl in class AbstractClassifier
        Parameters:
        instance - the instance to be used for training
      • getVotesForInstance

        public double[] getVotesForInstance​(Instance instance)
        Description copied from interface: Classifier
        Predicts the class memberships for a given instance. If an instance is unclassified, the returned array elements must be all zero.
        Specified by:
        getVotesForInstance in interface Classifier
        Specified by:
        getVotesForInstance in class AbstractClassifier
        Parameters:
        instance - the instance to be classified
        Returns:
        an array containing the estimated membership probabilities of the test instance in each class
      • isRandomizable

        public boolean isRandomizable()
        Description copied from interface: Learner
        Gets whether this learner needs a random seed. Examples of methods that needs a random seed are bagging and boosting.
        Specified by:
        isRandomizable in interface Learner<Example<Instance>>
        Returns:
        true if the learner needs a random seed.
      • getModelDescription

        public void getModelDescription​(StringBuilder arg0,
                                        int arg1)
        Description copied from class: AbstractClassifier
        Returns a string representation of the model.
        Specified by:
        getModelDescription in class AbstractClassifier
        Parameters:
        arg0 - the stringbuilder to add the description
        arg1 - the number of characters to indent
      • getModelMeasurementsImpl

        protected Measurement[] getModelMeasurementsImpl()
        Description copied from class: AbstractClassifier
        Gets the current measurements of this classifier.

        The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.
        Specified by:
        getModelMeasurementsImpl in class AbstractClassifier
        Returns:
        an array of measurements to be used in evaluation tasks
      • initNNs

        protected void initNNs​(Instance instance)