Package moa.classifiers.rules
Class AbstractAMRules
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.classifiers.AbstractClassifier
-
- moa.classifiers.rules.AbstractAMRules
-
- All Implemented Interfaces:
Configurable
,Serializable
,CapabilitiesHandler
,Classifier
,AWTRenderable
,Learner<Example<Instance>>
,MOAObject
,OptionHandler
- Direct Known Subclasses:
AMRulesRegressorOld
public abstract class AbstractAMRules extends AbstractClassifier
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description IntOption
anomalyNumInstThresholdOption
protected double
attributesPercentage
protected Rule
defaultRule
FlagOption
DriftDetectionOption
IntOption
gracePeriodOption
FloatOption
multivariateAnomalyProbabilityThresholdOption
FlagOption
noAnomalyDetectionOption
static double
NORMAL_CONSTANT
ClassOption
numericObserverOption
FloatOption
pageHinckleyAlphaOption
IntOption
pageHinckleyThresholdOption
protected int
ruleNumberID
protected RuleSet
ruleSet
FloatOption
splitConfidenceOption
protected double[]
statistics
FloatOption
tieThresholdOption
FloatOption
univariateAnomalyprobabilityThresholdOption
FlagOption
unorderedRulesOption
IntOption
VerbosityOption
-
Fields inherited from class moa.classifiers.AbstractClassifier
classifierRandom, modelContext, randomSeed, randomSeedOption, trainingWeightSeenByModel
-
Fields inherited from class moa.options.AbstractOptionHandler
config
-
-
Constructor Summary
Constructors Constructor Description AbstractAMRules()
AbstractAMRules(double attributesPercentage)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
debug(String string, int level)
Print to consoledouble
getAttributesPercentage()
int
getModelAttIndexToInstanceAttIndex(int index, Instance inst)
void
getModelDescription(StringBuilder out, int indent)
print GUI learn modelprotected Measurement[]
getModelMeasurementsImpl()
print GUI evaluate modelVote
getVotes(Instance instance)
getVotes extension of the instance method getVotesForInstance in moa.classifier.java returns the prediction of the instance.double[]
getVotesForInstance(Instance instance)
getVotesForInstance extension of the instance method getVotesForInstance in moa.classifier.java returns the prediction of the instance.abstract boolean
isRandomizable()
description of the Methods used.static int
modelAttIndexToInstanceAttIndex(int index, Instance inst)
Gets the index of the attribute in the instance, given the index of the attribute in the learner.abstract ErrorWeightedVote
newErrorWeightedVote()
protected abstract Rule
newRule(int ID, RuleActiveLearningNode learningNode, double[] statistics)
Rule.Builder() to build an object with the parameters.abstract RuleActiveLearningNode
newRuleActiveLearningNode(double[] initialClassObservations)
abstract RuleActiveLearningNode
newRuleActiveLearningNode(Rule.Builder builder)
void
PrintRuleSet()
void
resetLearningImpl()
Resets this classifier.void
setAttributesPercentage(double attributesPercentage)
void
setRandomSeed(int randomSeed)
Sets the seed for random number generation.void
trainOnInstanceImpl(Instance instance)
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.protected void
VerboseToConsole(Instance inst)
-
Methods inherited from class moa.classifiers.AbstractClassifier
contextIsCompatible, copy, correctlyClassifies, defineImmutableCapabilities, getAttributeNameString, getAWTRenderer, getClassLabelString, getClassNameString, getDescription, getModel, getModelContext, getModelMeasurements, getNominalValueString, getPredictionForInstance, getPredictionForInstance, getPurposeString, getSubClassifiers, getSublearners, getVotesForInstance, modelAttIndexToInstanceAttIndex, prepareForUseImpl, resetLearning, setModelContext, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance, trainOnInstance
-
Methods inherited from class moa.options.AbstractOptionHandler
getCLICreationString, getOptions, getPreparedClassOption, prepareClassOptions, prepareForUse, prepareForUse
-
Methods inherited from class moa.AbstractMOAObject
copy, measureByteSize, measureByteSize, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface moa.capabilities.CapabilitiesHandler
getCapabilities
-
Methods inherited from interface moa.MOAObject
measureByteSize
-
Methods inherited from interface moa.options.OptionHandler
getCLICreationString, getOptions, prepareForUse, prepareForUse
-
-
-
-
Field Detail
-
ruleSet
protected RuleSet ruleSet
-
defaultRule
protected Rule defaultRule
-
ruleNumberID
protected int ruleNumberID
-
statistics
protected double[] statistics
-
NORMAL_CONSTANT
public static final double NORMAL_CONSTANT
-
splitConfidenceOption
public FloatOption splitConfidenceOption
-
tieThresholdOption
public FloatOption tieThresholdOption
-
gracePeriodOption
public IntOption gracePeriodOption
-
DriftDetectionOption
public FlagOption DriftDetectionOption
-
pageHinckleyAlphaOption
public FloatOption pageHinckleyAlphaOption
-
pageHinckleyThresholdOption
public IntOption pageHinckleyThresholdOption
-
noAnomalyDetectionOption
public FlagOption noAnomalyDetectionOption
-
multivariateAnomalyProbabilityThresholdOption
public FloatOption multivariateAnomalyProbabilityThresholdOption
-
univariateAnomalyprobabilityThresholdOption
public FloatOption univariateAnomalyprobabilityThresholdOption
-
anomalyNumInstThresholdOption
public IntOption anomalyNumInstThresholdOption
-
unorderedRulesOption
public FlagOption unorderedRulesOption
-
VerbosityOption
public IntOption VerbosityOption
-
numericObserverOption
public ClassOption numericObserverOption
-
attributesPercentage
protected double attributesPercentage
-
-
Method Detail
-
getAttributesPercentage
public double getAttributesPercentage()
-
setAttributesPercentage
public void setAttributesPercentage(double attributesPercentage)
-
isRandomizable
public abstract boolean isRandomizable()
description of the Methods used. isRandomizable resetLearningImpl newRule // to build an object with the parameters. trainOnInstanceImpl isAnomaly getVotesForInstance getModelMeasurementsImpl getModelDescription // to printout to MOA GUI debug // use debug('string') to printout to console- Returns:
- true if the learner needs a random seed.
-
newRule
protected abstract Rule newRule(int ID, RuleActiveLearningNode learningNode, double[] statistics)
Rule.Builder() to build an object with the parameters. If you have an algorithm with many parameters, especially if some of them are optional, it can be beneficial to define an object that represents all of the parameters.- Returns:
-
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 classAbstractClassifier
- Parameters:
instance
- the instance to be used for training
-
getVotesForInstance
public double[] getVotesForInstance(Instance instance)
getVotesForInstance extension of the instance method getVotesForInstance in moa.classifier.java returns the prediction of the instance. Called in EvaluateModelRegression- Specified by:
getVotesForInstance
in interfaceClassifier
- Specified by:
getVotesForInstance
in classAbstractClassifier
- Parameters:
instance
- the instance to be classified- Returns:
- an array containing the estimated membership probabilities of the test instance in each class
-
getModelMeasurementsImpl
protected Measurement[] getModelMeasurementsImpl()
print GUI evaluate model- Specified by:
getModelMeasurementsImpl
in classAbstractClassifier
- Returns:
- an array of measurements to be used in evaluation tasks
-
getModelDescription
public void getModelDescription(StringBuilder out, int indent)
print GUI learn model- Specified by:
getModelDescription
in classAbstractClassifier
- Parameters:
out
- the stringbuilder to add the descriptionindent
- the number of characters to indent
-
debug
protected void debug(String string, int level)
Print to console- Parameters:
string
-
-
VerboseToConsole
protected void VerboseToConsole(Instance inst)
-
PrintRuleSet
public void PrintRuleSet()
-
newRuleActiveLearningNode
public abstract RuleActiveLearningNode newRuleActiveLearningNode(Rule.Builder builder)
-
newRuleActiveLearningNode
public abstract RuleActiveLearningNode newRuleActiveLearningNode(double[] initialClassObservations)
-
getModelAttIndexToInstanceAttIndex
public int getModelAttIndexToInstanceAttIndex(int index, Instance inst)
-
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 classAbstractClassifier
-
modelAttIndexToInstanceAttIndex
public static int modelAttIndexToInstanceAttIndex(int index, Instance inst)
Gets the index of the attribute in the instance, given the index of the attribute in the learner.- Parameters:
index
- the index of the attribute in the learnerinst
- the instance- Returns:
- the index in the instance
-
newErrorWeightedVote
public abstract ErrorWeightedVote newErrorWeightedVote()
-
getVotes
public Vote getVotes(Instance instance)
getVotes extension of the instance method getVotesForInstance in moa.classifier.java returns the prediction of the instance. Called in WeightedRandomRules
-
setRandomSeed
public void setRandomSeed(int randomSeed)
Description copied from interface:Learner
Sets the seed for random number generation.- Specified by:
setRandomSeed
in interfaceLearner<Example<Instance>>
- Overrides:
setRandomSeed
in classAbstractClassifier
- Parameters:
randomSeed
- the seed
-
-