Class StreamingRandomPatches

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

    public class StreamingRandomPatches
    extends AbstractClassifier
    implements MultiClassClassifier, CapabilitiesHandler
    Streaming Random Patches

    Streaming Random Patches (SRP). This ensemble method uses a hoeffding tree by default, but it can be used with any other base model (differently from random forest variations). This algorithm can be used to simulate bagging or random subspaces, see parameter -t. The default algorithm uses both bagging and random subspaces, namely Random Patches.

    See details in:
    Heitor Murilo Gomes, Jesse Read, Albert Bifet. Streaming Random Patches for Evolving Data Stream Classification. IEEE International Conference on Data Mining (ICDM), 2019.

    Parameters:

    • -l : Classifier to train. Default to a Hoeffding Tree, but it is not restricted to decision trees.
    • -s : The number of learners 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.
    • -t : The training method to use: Random Patches, Random Subspaces or Bagging.
    • -a : The lambda value for the poisson distribution (used to emulate bagging).
    • -x : Change detector for drifts and its parameters.
    • -p : Change detector for warnings.
    • -w : Should use weighted voting?
    • -u : Should use drift detection? If disabled, then the bkg learner is also disabled.
    • -q : Should use bkg learner? If disabled, then trees are reset immediately.
    Version:
    $Revision: 1 $
    Author:
    Heitor Murilo Gomes (heitor dot gomes at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • StreamingRandomPatches

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

        public static ArrayList<ArrayList<Integer>> localRandomKCombinations​(int k,
                                                                             int length,
                                                                             int nCombinations,
                                                                             Random random)