Package moa.learners

Interface Learner<E extends Example>

    • Method Detail

      • isRandomizable

        boolean isRandomizable()
        Gets whether this learner needs a random seed. Examples of methods that needs a random seed are bagging and boosting.
        Returns:
        true if the learner needs a random seed.
      • setRandomSeed

        void setRandomSeed​(int s)
        Sets the seed for random number generation.
        Parameters:
        s - the seed
      • trainingHasStarted

        boolean trainingHasStarted()
        Gets whether training has started.
        Returns:
        true if training has started
      • trainingWeightSeenByModel

        double trainingWeightSeenByModel()
        Gets the sum of the weights of the instances that have been used by this learner during the training in trainOnInstance
        Returns:
        the weight of the instances that have been used training
      • resetLearning

        void resetLearning()
        Resets this learner. It must be similar to starting a new learner from scratch.
      • trainOnInstance

        void trainOnInstance​(E example)
        Trains this learner incrementally using the given example.
        Parameters:
        example - the instance to be used for training
      • getVotesForInstance

        double[] getVotesForInstance​(E example)
        Predicts the class memberships for a given instance. If an instance is unclassified, the returned array elements must be all zero.
        Parameters:
        example - the instance to be classified
        Returns:
        an array containing the estimated membership probabilities of the test instance in each class
      • getModelMeasurements

        Measurement[] getModelMeasurements()
        Gets the current measurements of this learner.
        Returns:
        an array of measurements to be used in evaluation tasks
      • getSublearners

        Learner[] getSublearners()
        Gets the learners of this ensemble. Returns null if this learner is a single learner.
        Returns:
        an array of the learners of the ensemble
      • getModel

        MOAObject getModel()
        Gets the model if this learner.
        Returns:
        the copy of this learner
      • setModelContext

        void setModelContext​(InstancesHeader ih)
        Sets the reference to the header of the data stream. The header of the data stream is extended from WEKA Instances. This header is needed to know the number of classes and attributes
        Parameters:
        ih - the reference to the data stream header
      • getModelContext

        InstancesHeader getModelContext()
        Gets the reference to the header of the data stream. The header of the data stream is extended from WEKA Instances. This header is needed to know the number of classes and attributes
        Returns:
        the reference to the data stream header
      • getPredictionForInstance

        Prediction getPredictionForInstance​(E testInst)