Class AdaptiveRandomForest

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

    public class AdaptiveRandomForest
    extends AbstractClassifier
    implements MultiClassClassifier, CapabilitiesHandler
    Adaptive Random Forest

    Adaptive Random Forest (ARF). The 3 most important aspects of this ensemble classifier are: (1) inducing diversity through resampling; (2) inducing diversity through randomly selecting subsets of features for node splits (See moa.classifiers.trees.ARFHoeffdingTree.java); (3) drift detectors per base tree, which cause selective resets in response to drifts. It also allows training background trees, which start training if a warning is detected and replace the active tree if the warning escalates to a drift.

    See details in:
    Heitor Murilo Gomes, Albert Bifet, Jesse Read, Jean Paul Barddal, Fabricio Enembreck, Bernhard Pfharinger, Geoff Holmes, Talel Abdessalem. Adaptive random forests for evolving data stream classification. In Machine Learning, DOI: 10.1007/s10994-017-5642-8, Springer, 2017.

    Parameters:

    • -l : Classifier to train. Must be set to ARFHoeffdingTree
    • -s : The number of trees in the ensemble
    • -o : How the number of features is interpreted (4 options): "Specified m (integer value)", "sqrt(M)+1", "M-(sqrt(M)+1)"
    • -m : Number of features allowed considered for each split. Negative values corresponds to M - m
    • -a : The lambda value for bagging (lambda=6 corresponds to levBag)
    • -j : Number of threads to be used for training
    • -x : Change detector for drifts and its parameters
    • -p : Change detector for warnings (start training bkg learner)
    • -w : Should use weighted voting?
    • -u : Should use drift detection? If disabled then bkg learner is also disabled
    • -q : Should use bkg learner? If disabled then reset tree immediately
    Version:
    $Revision: 1 $
    Author:
    Heitor Murilo Gomes (heitor_murilo_gomes at yahoo dot com dot br)
    See Also:
    Serialized Form
    • Constructor Detail

      • AdaptiveRandomForest

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

        protected void initEnsemble​(Instance instance)