MOA 12.03
Real Time Analytics for Data Streams
|
Classifier interface for incremental classification models. More...
Public Member Functions | |
void | setModelContext (InstancesHeader ih) |
Sets the reference to the header of the data stream. | |
InstancesHeader | getModelContext () |
Gets the reference to the header of the data stream. | |
boolean | isRandomizable () |
Gets whether this classifier needs a random seed. | |
void | setRandomSeed (int s) |
Sets the seed for random number generation. | |
boolean | trainingHasStarted () |
Gets whether training has started. | |
double | trainingWeightSeenByModel () |
Gets the sum of the weights of the instances that have been used by this classifier during the training in trainOnInstance | |
void | resetLearning () |
Resets this classifier. | |
void | trainOnInstance (Instance inst) |
Trains this classifier incrementally using the given instance. | |
double[] | getVotesForInstance (Instance inst) |
Predicts the class memberships for a given instance. | |
boolean | correctlyClassifies (Instance inst) |
Gets whether this classifier correctly classifies an instance. | |
Measurement[] | getModelMeasurements () |
Gets the current measurements of this classifier. | |
Classifier[] | getSubClassifiers () |
Gets the classifiers of this ensemble. | |
Classifier | copy () |
Produces a copy of this classifier. |
Classifier interface for incremental classification models.
Definition at line 35 of file Classifier.java.
Classifier moa.classifiers.Classifier.copy | ( | ) |
Produces a copy of this classifier.
Implements moa.MOAObject.
Implemented in moa.classifiers.AbstractClassifier.
Referenced by moa.classifiers.meta.AccuracyWeightedEnsemble.addToStored(), moa.classifiers.meta.AccuracyWeightedEnsemble.computeCandidateWeight(), moa.classifiers.AbstractClassifier.copy(), moa.tasks.LearnModel.doMainTask(), moa.classifiers.meta.AccuracyWeightedEnsemble.processChunk(), moa.classifiers.meta.AccuracyUpdatedEnsemble.processChunk(), moa.classifiers.drift.SingleClassifierDrift.resetLearningImpl(), moa.classifiers.meta.OzaBoostAdwin.resetLearningImpl(), moa.classifiers.meta.OzaBoost.resetLearningImpl(), moa.classifiers.meta.OzaBagASHT.resetLearningImpl(), moa.classifiers.meta.OzaBagAdwin.resetLearningImpl(), moa.classifiers.meta.OzaBag.resetLearningImpl(), moa.classifiers.meta.OCBoost.resetLearningImpl(), moa.classifiers.meta.LeveragingBag.resetLearningImpl(), and moa.classifiers.meta.LimAttClassifier.trainOnInstanceImpl().
boolean moa.classifiers.Classifier.correctlyClassifies | ( | Instance | inst | ) |
Gets whether this classifier correctly classifies an instance.
Uses getVotesForInstance to obtain the prediction and the instance to obtain its true class.
inst | the instance to be classified |
Implemented in moa.classifiers.AbstractClassifier.
Referenced by moa.classifiers.meta.OzaBoostAdwin.trainOnInstanceImpl(), moa.classifiers.meta.OzaBagAdwin.trainOnInstanceImpl(), moa.classifiers.meta.LimAttClassifier.trainOnInstanceImpl(), and moa.classifiers.meta.LeveragingBag.trainOnInstanceImpl().
InstancesHeader moa.classifiers.Classifier.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
Implemented in moa.classifiers.AbstractClassifier.
Measurement [] moa.classifiers.Classifier.getModelMeasurements | ( | ) |
Gets the current measurements of this classifier.
Implemented in moa.classifiers.AbstractClassifier.
Referenced by moa.tasks.EvaluatePeriodicHeldOutTest.doMainTask(), and moa.evaluation.LearningEvaluation.LearningEvaluation().
Classifier [] moa.classifiers.Classifier.getSubClassifiers | ( | ) |
Gets the classifiers of this ensemble.
Returns null if this classifier is a single classifier.
Implemented in moa.classifiers.AbstractClassifier, moa.classifiers.meta.AccuracyWeightedEnsemble, moa.classifiers.meta.LeveragingBag, moa.classifiers.meta.LimAttClassifier, moa.classifiers.meta.OCBoost, moa.classifiers.meta.OzaBag, moa.classifiers.meta.OzaBagAdwin, moa.classifiers.meta.OzaBoost, moa.classifiers.meta.OzaBoostAdwin, and moa.classifiers.meta.WeightedMajorityAlgorithm.
double [] moa.classifiers.Classifier.getVotesForInstance | ( | Instance | inst | ) |
Predicts the class memberships for a given instance.
If an instance is unclassified, the returned array elements must be all zero.
inst | the instance to be classified |
Implemented in moa.classifiers.active.ActiveClassifier, moa.classifiers.bayes.NaiveBayes, moa.classifiers.bayes.NaiveBayesMultinomial, moa.classifiers.drift.SingleClassifierDrift, moa.classifiers.functions.MajorityClass, moa.classifiers.functions.Perceptron, moa.classifiers.functions.SGD, moa.classifiers.functions.SPegasos, moa.classifiers.meta.AccuracyWeightedEnsemble, moa.classifiers.meta.LeveragingBag, moa.classifiers.meta.LimAttClassifier, moa.classifiers.meta.OCBoost, moa.classifiers.meta.OzaBag, moa.classifiers.meta.OzaBagAdwin, moa.classifiers.meta.OzaBagASHT, moa.classifiers.meta.OzaBoost, moa.classifiers.meta.OzaBoostAdwin, moa.classifiers.meta.WeightedMajorityAlgorithm, moa.classifiers.meta.WEKAClassifier, moa.classifiers.trees.DecisionStump, moa.classifiers.trees.HoeffdingAdaptiveTree, moa.classifiers.trees.HoeffdingOptionTree, and moa.classifiers.trees.HoeffdingTree.
Referenced by moa.classifiers.meta.AccuracyWeightedEnsemble.computeWeight(), moa.classifiers.meta.AccuracyUpdatedEnsemble.computeWeight(), moa.classifiers.AbstractClassifier.correctlyClassifies(), weka.classifiers.meta.MOA.distributionForInstance(), moa.tasks.EvaluatePrequential.doMainTask(), moa.tasks.EvaluatePeriodicHeldOutTest.doMainTask(), moa.tasks.EvaluateModel.doMainTask(), moa.tasks.EvaluateInterleavedTestThenTrain.doMainTask(), moa.tasks.EvaluateInterleavedChunks.doMainTask(), moa.classifiers.drift.SingleClassifierDrift.getVotesForInstance(), moa.classifiers.meta.LimAttClassifier.getVotesForInstance(), moa.classifiers.active.ActiveClassifier.getVotesForInstance(), moa.classifiers.meta.OzaBoostAdwin.getVotesForInstanceBinary(), moa.classifiers.meta.LeveragingBag.getVotesForInstanceBinary(), moa.classifiers.meta.LimAttClassifier.trainOnInstanceImpl(), and moa.classifiers.active.ActiveClassifier.trainOnInstanceImpl().
boolean moa.classifiers.Classifier.isRandomizable | ( | ) |
Gets whether this classifier needs a random seed.
Examples of methods that needs a random seed are bagging and boosting.
Implemented in moa.classifiers.active.ActiveClassifier, moa.classifiers.bayes.NaiveBayes, moa.classifiers.bayes.NaiveBayesMultinomial, moa.classifiers.drift.SingleClassifierDrift, moa.classifiers.functions.MajorityClass, moa.classifiers.functions.Perceptron, moa.classifiers.functions.SGD, moa.classifiers.functions.SPegasos, moa.classifiers.meta.AccuracyUpdatedEnsemble, moa.classifiers.meta.AccuracyWeightedEnsemble, moa.classifiers.meta.LeveragingBag, moa.classifiers.meta.LimAttClassifier, moa.classifiers.meta.OCBoost, moa.classifiers.meta.OzaBag, moa.classifiers.meta.OzaBagAdwin, moa.classifiers.meta.OzaBoost, moa.classifiers.meta.OzaBoostAdwin, moa.classifiers.meta.WeightedMajorityAlgorithm, moa.classifiers.meta.WEKAClassifier, moa.classifiers.trees.DecisionStump, moa.classifiers.trees.HoeffdingOptionTree, moa.classifiers.trees.HoeffdingTree, moa.classifiers.trees.LimAttHoeffdingTree, and moa.classifiers.trees.RandomHoeffdingTree.
Referenced by moa.classifiers.AbstractClassifier.AbstractClassifier(), and moa.classifiers.AbstractClassifier.resetLearning().
void moa.classifiers.Classifier.resetLearning | ( | ) |
Resets this classifier.
It must be similar to starting a new classifier from scratch.
Implemented in moa.classifiers.AbstractClassifier.
Referenced by weka.classifiers.meta.MOA.buildClassifier(), moa.classifiers.meta.AccuracyWeightedEnsemble.prepareForUseImpl(), moa.classifiers.meta.AccuracyWeightedEnsemble.processChunk(), moa.classifiers.meta.AccuracyUpdatedEnsemble.processChunk(), moa.classifiers.drift.SingleClassifierDrift.resetLearningImpl(), moa.classifiers.meta.OzaBoostAdwin.resetLearningImpl(), moa.classifiers.meta.OzaBoost.resetLearningImpl(), moa.classifiers.meta.OzaBagASHT.resetLearningImpl(), moa.classifiers.meta.OzaBagAdwin.resetLearningImpl(), moa.classifiers.meta.OzaBag.resetLearningImpl(), moa.classifiers.meta.OCBoost.resetLearningImpl(), moa.classifiers.meta.LeveragingBag.resetLearningImpl(), moa.classifiers.active.ActiveClassifier.resetLearningImpl(), moa.classifiers.meta.AccuracyWeightedEnsemble.resetLearningImpl(), moa.classifiers.drift.SingleClassifierDrift.trainOnInstanceImpl(), moa.classifiers.meta.OzaBoostAdwin.trainOnInstanceImpl(), moa.classifiers.meta.OzaBagAdwin.trainOnInstanceImpl(), moa.classifiers.meta.LimAttClassifier.trainOnInstanceImpl(), and moa.classifiers.meta.LeveragingBag.trainOnInstanceImpl().
void moa.classifiers.Classifier.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
ih | the reference to the data stream header |
Implemented in moa.classifiers.AbstractClassifier.
Referenced by moa.tasks.LearnModel.doMainTask(), moa.tasks.EvaluatePrequential.doMainTask(), moa.tasks.EvaluatePeriodicHeldOutTest.doMainTask(), moa.tasks.EvaluateInterleavedTestThenTrain.doMainTask(), and moa.tasks.EvaluateInterleavedChunks.doMainTask().
void moa.classifiers.Classifier.setRandomSeed | ( | int | s | ) |
Sets the seed for random number generation.
s | the seed |
Implemented in moa.classifiers.AbstractClassifier.
boolean moa.classifiers.Classifier.trainingHasStarted | ( | ) |
Gets whether training has started.
Implemented in moa.classifiers.AbstractClassifier.
double moa.classifiers.Classifier.trainingWeightSeenByModel | ( | ) |
Gets the sum of the weights of the instances that have been used by this classifier during the training in trainOnInstance
Implemented in moa.classifiers.AbstractClassifier.
void moa.classifiers.Classifier.trainOnInstance | ( | Instance | inst | ) |
Trains this classifier incrementally using the given instance.
inst | the instance to be used for training |
Implemented in moa.classifiers.AbstractClassifier.
Referenced by moa.classifiers.meta.AccuracyWeightedEnsemble.computeCandidateWeight(), moa.tasks.LearnModel.doMainTask(), moa.tasks.EvaluatePrequential.doMainTask(), moa.tasks.EvaluatePeriodicHeldOutTest.doMainTask(), moa.tasks.EvaluateInterleavedTestThenTrain.doMainTask(), moa.tasks.EvaluateInterleavedChunks.doMainTask(), moa.classifiers.meta.AccuracyWeightedEnsemble.processChunk(), moa.classifiers.drift.SingleClassifierDrift.trainOnInstanceImpl(), moa.classifiers.meta.OzaBoostAdwin.trainOnInstanceImpl(), moa.classifiers.meta.OzaBoost.trainOnInstanceImpl(), moa.classifiers.meta.OzaBagASHT.trainOnInstanceImpl(), moa.classifiers.meta.OzaBagAdwin.trainOnInstanceImpl(), moa.classifiers.meta.OzaBag.trainOnInstanceImpl(), moa.classifiers.meta.OCBoost.trainOnInstanceImpl(), moa.classifiers.meta.LimAttClassifier.trainOnInstanceImpl(), moa.classifiers.meta.LeveragingBag.trainOnInstanceImpl(), moa.classifiers.active.ActiveClassifier.trainOnInstanceImpl(), and weka.classifiers.meta.MOA.updateClassifier().