Configurable
, java.io.Serializable
, CapabilitiesHandler
, Classifier
, MultiClassClassifier
, AWTRenderable
, Learner<Example<Instance>>
, MOAObject
, OptionHandler
public class SAMkNN extends AbstractClassifier implements MultiClassClassifier, CapabilitiesHandler
Valid options are:
-k number of neighbours
-w max instances
-m minimum number of instances in the STM
-p LTM size relative to max instances
-r Recalculation of the STM error
Modifier and Type | Field | Description |
---|---|---|
IntOption |
kOption |
|
IntOption |
limitOption |
|
IntOption |
minSTMSizeOption |
|
FlagOption |
recalculateSTMErrorOption |
|
FloatOption |
relativeLTMSizeOption |
classifierRandom, modelContext, randomSeed, randomSeedOption, trainingWeightSeenByModel
config
Constructor | Description |
---|---|
SAMkNN() |
Modifier and Type | Method | Description |
---|---|---|
ImmutableCapabilities |
defineImmutableCapabilities() |
Defines the set of capabilities the object has.
|
void |
getModelDescription(java.lang.StringBuilder out,
int indent) |
Returns a string representation of the model.
|
protected Measurement[] |
getModelMeasurementsImpl() |
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. |
java.lang.String |
getPurposeString() |
Dictionary with option texts and objects
|
double[] |
getVotesForInstance(Instance inst) |
Predicts the label of a given sample by using the STM, LTM and the CM.
|
protected void |
init() |
|
boolean |
isRandomizable() |
Gets whether this learner needs a random seed.
|
void |
resetLearningImpl() |
Resets this classifier.
|
void |
setModelContext(InstancesHeader context) |
Sets the reference to the header of the data stream.
|
void |
trainOnInstanceImpl(Instance inst) |
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. |
contextIsCompatible, copy, correctlyClassifies, getAttributeNameString, getAWTRenderer, getClassLabelString, getClassNameString, getDescription, getModel, getModelContext, getModelMeasurements, getNominalValueString, getPredictionForInstance, getPredictionForInstance, getSubClassifiers, getSublearners, getVotesForInstance, modelAttIndexToInstanceAttIndex, modelAttIndexToInstanceAttIndex, prepareForUseImpl, resetLearning, setRandomSeed, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance, trainOnInstance
copy, measureByteSize, measureByteSize, toString
getCLICreationString, getOptions, getPreparedClassOption, prepareClassOptions, prepareForUse, prepareForUse
getCapabilities
measureByteSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getCLICreationString, getOptions, prepareForUse, prepareForUse
public IntOption kOption
public IntOption limitOption
public IntOption minSTMSizeOption
public FloatOption relativeLTMSizeOption
public FlagOption recalculateSTMErrorOption
public java.lang.String getPurposeString()
AbstractOptionHandler
getPurposeString
in interface OptionHandler
getPurposeString
in class AbstractClassifier
protected void init()
public void setModelContext(InstancesHeader context)
Learner
Instances
.
This header is needed to know the number of classes and attributessetModelContext
in interface Learner<Example<Instance>>
setModelContext
in class AbstractClassifier
context
- the reference to the data stream headerpublic void resetLearningImpl()
AbstractClassifier
resetLearningImpl
in class AbstractClassifier
public void trainOnInstanceImpl(Instance inst)
AbstractClassifier
trainOnInstanceImpl
in class AbstractClassifier
inst
- the instance to be used for trainingpublic double[] getVotesForInstance(Instance inst)
getVotesForInstance
in interface Classifier
getVotesForInstance
in class AbstractClassifier
inst
- the instance to be classifiedprotected Measurement[] getModelMeasurementsImpl()
AbstractClassifier
getModelMeasurementsImpl
in class AbstractClassifier
public void getModelDescription(java.lang.StringBuilder out, int indent)
AbstractClassifier
getModelDescription
in class AbstractClassifier
out
- the stringbuilder to add the descriptionindent
- the number of characters to indentpublic boolean isRandomizable()
Learner
isRandomizable
in interface Learner<Example<Instance>>
public ImmutableCapabilities defineImmutableCapabilities()
CapabilitiesHandler
defineImmutableCapabilities
in interface CapabilitiesHandler
defineImmutableCapabilities
in class AbstractClassifier
Copyright © 2020 University of Waikato, Hamilton, NZ. All Rights Reserved.