Class RebalanceStream

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

    public class RebalanceStream
    extends AbstractClassifier
    implements MultiClassClassifier
    RebalanceStream

    The RebalanceStream algorithm trains a model called learner as the standard algorithm implementation. Moreover, it saves every new data in input in a batch. If ADWIN detects a warning level, it starts saving the new data in input also in another batch called resetBatch. Then, when ADWIN detects a change, so there is a concept drift, it trains in parallel 3 models called learnerBal, learnerReset, learnerResetBal. The learnerBal model uses the batch data rebalanced by SMOTE, the learnerReset model uses the resetBatch data and the learnerResetBal model uses the resetBatch data rebalanced by SMOTE. Then the best model based on k-statistic is chosen to continue the experiment with a new sample.

    See details in:
    Alessio Bernardo, Albert Bifet, Emanuele Della Valle. Incremental Rebalancing Learning \\on Evolving Data Streams. In ICDM Workshop, 2020.

    Parameters:

    • -l : Classifier to train. Default is TemporallyAugmentedClassifier
    • -c : Minimum number of samples in the batch for applying SMOTE. Default is -1 (no limit)
    • -g : Maximum number of samples in the batch for applying SMOTE. Default is -1 (no limit)
    • -h : Minimum number of samples in the ResetBatch for applying SMOTE. Default is -1 (no limit)
    • -g : Maximum number of samples in the ResetBatch for applying SMOTE. Default is -1 (no limit)
    Version:
    $Revision: 1 $
    Author:
    Alessio Bernardo (alessio dot bernardo at polimi dot com)
    See Also:
    Serialized Form
    • Field Detail

      • baseLearnerOption

        public ClassOption baseLearnerOption
      • minInstanceLimitBatchOption

        public IntOption minInstanceLimitBatchOption
      • maxInstanceLimitBatchOption

        public IntOption maxInstanceLimitBatchOption
      • minInstanceLimitResetBatchOption

        public IntOption minInstanceLimitResetBatchOption
      • maxInstanceLimitResetBatchOption

        public IntOption maxInstanceLimitResetBatchOption
      • learnerResetBal

        protected Classifier learnerResetBal
      • adwin

        protected ADWIN adwin
      • nAttributes

        protected int nAttributes
      • minInstanceLimitBatch

        protected int minInstanceLimitBatch
      • maxInstanceLimitBatch

        protected int maxInstanceLimitBatch
      • minInstanceLimitResetBatch

        protected int minInstanceLimitResetBatch
      • maxInstanceLimitResetBatch

        protected int maxInstanceLimitResetBatch
      • confusionMatrixLearner

        protected int[][] confusionMatrixLearner
      • accLearner

        protected double accLearner
      • kStatLearner

        protected double kStatLearner
      • confusionMatrixResetBal

        protected int[][] confusionMatrixResetBal
      • accResetBal

        protected double accResetBal
      • kStatResetBal

        protected double kStatResetBal
      • confusionMatrixReset

        protected int[][] confusionMatrixReset
      • accReset

        protected double accReset
      • kStatReset

        protected double kStatReset
      • confusionMatrixBal

        protected int[][] confusionMatrixBal
      • accBal

        protected double accBal
      • kStatBal

        protected double kStatBal
      • modelInUse

        protected double modelInUse
      • nMinorityTotal

        protected int nMinorityTotal
      • nMajorityTotal

        protected int nMajorityTotal
      • nGeneratedMinorityTotal

        protected int nGeneratedMinorityTotal
      • nGeneratedMajorityTotal

        protected int nGeneratedMajorityTotal
      • effectiveNearestNeighbors

        protected int effectiveNearestNeighbors
      • minorityInstances

        protected weka.core.Instances minorityInstances
      • vdmMap

        protected Map vdmMap
      • indexValues

        protected int[] indexValues
    • Constructor Detail

      • RebalanceStream

        public RebalanceStream()
    • 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