Package moa.classifiers.multilabel.trees
Class ISOUPTree
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.classifiers.AbstractClassifier
-
- moa.classifiers.AbstractMultiLabelLearner
-
- moa.classifiers.multilabel.trees.ISOUPTree
-
- All Implemented Interfaces:
Configurable
,Serializable
,CapabilitiesHandler
,Classifier
,MultiLabelLearner
,MultiTargetLearnerSemiSupervised
,MultiTargetRegressor
,AWTRenderable
,Learner<Example<Instance>>
,MOAObject
,OptionHandler
- Direct Known Subclasses:
ISOUPTreeRF
public class ISOUPTree extends AbstractMultiLabelLearner implements MultiTargetRegressor, MultiTargetLearnerSemiSupervised
iSOUPTree class for structured output prediction.- Version:
- $Revision: 1 $
- Author:
- Aljaž Osojnik (aljaz.osojnik@ijs.si)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ISOUPTree.InnerNode
static class
ISOUPTree.LeafNode
class
ISOUPTree.MultitargetPerceptron
static class
ISOUPTree.Node
static class
ISOUPTree.SplitNode
-
Field Summary
-
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 ISOUPTree()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
attemptToSplit(ISOUPTree.LeafNode node, ISOUPTree.InnerNode parent, int parentIndex)
boolean
buildingModelTree()
long
calcByteSize()
protected void
checkRoot()
void
closeWriter()
static double
computeHoeffdingBound(double range, double confidence, double n)
double
computeSD(double squaredVal, double val, double size)
void
getModelDescription(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.double[]
getNormalizedError(Instance inst, double[] prediction)
Prediction
getPredictionForInstance(MultiLabelInstance inst)
String
getPurposeString()
Dictionary with option texts and objectsPrediction
getTrainingPrediction()
void
initWriter(String filename)
boolean
isRandomizable()
Gets whether this learner needs a random seed.void
loadWeights()
void
log(String s)
List<Integer>
newInputIndexes()
ISOUPTree.MultitargetPerceptron
newLeafModel()
protected ISOUPTree.LeafNode
newLeafNode()
NominalStatisticsObserver
newNominalClassObserver()
protected NumericStatisticsObserver
newNumericClassObserver()
protected ISOUPTree.SplitNode
newSplitNode(Predicate predicate)
boolean
normalize()
double[]
normalizedInputVector(Instance inst)
double[]
normalizedTargetVector(Instance instance)
double
normalizeTargetValue(double value, int i)
double
normalizeTargetValue(Instance inst, int i)
double[]
normalizeTargetVector(double[] pred)
void
processInstance(Instance inst, ISOUPTree.Node node, double[] prediction, double[] normalError, boolean growthAllowed, boolean inAlternate)
void
resetLearningImpl()
Resets this classifier.static double
scalarProduct(DoubleVector u, DoubleVector v)
void
setModelContext(InstancesHeader ih)
Sets the reference to the header of the data stream.void
trainOnInstanceImpl(MultiLabelInstance instance)
Method for updating (training) the model using a new instance-
Methods inherited from class moa.classifiers.AbstractMultiLabelLearner
getPredictionForInstance, getPredictionForInstance, getVotesForInstance, trainOnInstanceImpl
-
Methods inherited from class moa.classifiers.AbstractClassifier
contextIsCompatible, copy, correctlyClassifies, defineImmutableCapabilities, getAttributeNameString, getAWTRenderer, getClassLabelString, getClassNameString, getDescription, getModel, getModelContext, getModelMeasurements, getNominalValueString, getSubClassifiers, getSublearners, getVotesForInstance, modelAttIndexToInstanceAttIndex, modelAttIndexToInstanceAttIndex, prepareForUseImpl, resetLearning, setRandomSeed, 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.gui.AWTRenderable
getAWTRenderer
-
Methods inherited from interface moa.capabilities.CapabilitiesHandler
getCapabilities
-
Methods inherited from interface moa.classifiers.Classifier
copy, correctlyClassifies, getPredictionForInstance, getSubClassifiers, getVotesForInstance, trainOnInstance
-
Methods inherited from interface moa.learners.Learner
getModel, getModelContext, getModelMeasurements, getPredictionForInstance, getSublearners, getVotesForInstance, resetLearning, setRandomSeed, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance
-
Methods inherited from interface moa.MOAObject
getDescription, measureByteSize
-
Methods inherited from interface moa.options.OptionHandler
getCLICreationString, getOptions, prepareForUse, prepareForUse
-
-
-
-
Field Detail
-
treeRoot
public ISOUPTree.Node treeRoot
-
learningWeight
protected double learningWeight
-
examplesSeen
public DoubleVector examplesSeen
-
sumOfValues
public DoubleVector sumOfValues
-
sumOfSquares
public DoubleVector sumOfSquares
-
weightOfInputs
public DoubleVector weightOfInputs
-
sumOfAttrValues
public DoubleVector sumOfAttrValues
-
sumOfAttrSquares
public DoubleVector sumOfAttrSquares
-
maxID
public int maxID
-
targetWeights
public DoubleVector targetWeights
-
gracePeriodOption
public IntOption gracePeriodOption
-
splitConfidenceOption
public FloatOption splitConfidenceOption
-
tieThresholdOption
public FloatOption tieThresholdOption
-
PageHinckleyAlphaOption
public FloatOption PageHinckleyAlphaOption
-
PageHinckleyThresholdOption
public IntOption PageHinckleyThresholdOption
-
alternateTreeFadingFactorOption
public FloatOption alternateTreeFadingFactorOption
-
alternateTreeTMinOption
public IntOption alternateTreeTMinOption
-
alternateTreeTimeOption
public IntOption alternateTreeTimeOption
-
regressionTreeOption
public FlagOption regressionTreeOption
-
learningRatioOption
public FloatOption learningRatioOption
-
learningRateDecayFactorOption
public FloatOption learningRateDecayFactorOption
-
learningRatioConstOption
public FlagOption learningRatioConstOption
-
runAsPCTOption
public FlagOption runAsPCTOption
-
doNotNormalizeOption
public FlagOption doNotNormalizeOption
-
weightFile
public FileOption weightFile
-
-
Method Detail
-
getPurposeString
public String getPurposeString()
Description copied from class:AbstractOptionHandler
Dictionary with option texts and objects- Specified by:
getPurposeString
in interfaceOptionHandler
- Overrides:
getPurposeString
in classAbstractClassifier
- Returns:
- the string with the purpose of this object
-
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
-
setModelContext
public void setModelContext(InstancesHeader ih)
Description copied from interface:Learner
Sets the reference to the header of the data stream. The header of the data stream is extended from WEKAInstances
. This header is needed to know the number of classes and attributes- Specified by:
setModelContext
in interfaceLearner<Example<Instance>>
- Overrides:
setModelContext
in classAbstractClassifier
- Parameters:
ih
- the reference to the data stream header
-
loadWeights
public void loadWeights()
-
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 interfaceLearner<Example<Instance>>
- Returns:
- true if the learner needs a random seed.
-
getModelDescription
public void getModelDescription(StringBuilder out, int indent)
Description copied from class:AbstractClassifier
Returns a string representation of the model.- Specified by:
getModelDescription
in classAbstractClassifier
- Parameters:
out
- the stringbuilder to add the descriptionindent
- 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 classAbstractClassifier
- Returns:
- an array of measurements to be used in evaluation tasks
-
calcByteSize
public long calcByteSize()
-
getPredictionForInstance
public Prediction getPredictionForInstance(MultiLabelInstance inst)
- Specified by:
getPredictionForInstance
in interfaceMultiLabelLearner
- Specified by:
getPredictionForInstance
in interfaceMultiTargetLearnerSemiSupervised
- Specified by:
getPredictionForInstance
in classAbstractMultiLabelLearner
-
getTrainingPrediction
public Prediction getTrainingPrediction()
- Specified by:
getTrainingPrediction
in interfaceMultiTargetLearnerSemiSupervised
-
normalizedInputVector
public double[] normalizedInputVector(Instance inst)
-
normalizedTargetVector
public double[] normalizedTargetVector(Instance instance)
-
normalizeTargetVector
public double[] normalizeTargetVector(double[] pred)
-
normalizeTargetValue
public double normalizeTargetValue(Instance inst, int i)
-
normalizeTargetValue
public double normalizeTargetValue(double value, int i)
-
getNormalizedError
public double[] getNormalizedError(Instance inst, double[] prediction)
-
trainOnInstanceImpl
public void trainOnInstanceImpl(MultiLabelInstance instance)
Method for updating (training) the model using a new instance- Specified by:
trainOnInstanceImpl
in interfaceMultiLabelLearner
- Specified by:
trainOnInstanceImpl
in interfaceMultiTargetLearnerSemiSupervised
- Specified by:
trainOnInstanceImpl
in classAbstractMultiLabelLearner
-
processInstance
public void processInstance(Instance inst, ISOUPTree.Node node, double[] prediction, double[] normalError, boolean growthAllowed, boolean inAlternate)
-
newNumericClassObserver
protected NumericStatisticsObserver newNumericClassObserver()
-
newNominalClassObserver
public NominalStatisticsObserver newNominalClassObserver()
-
newSplitNode
protected ISOUPTree.SplitNode newSplitNode(Predicate predicate)
-
newLeafNode
protected ISOUPTree.LeafNode newLeafNode()
-
newLeafModel
public ISOUPTree.MultitargetPerceptron newLeafModel()
-
checkRoot
protected void checkRoot()
-
computeHoeffdingBound
public static double computeHoeffdingBound(double range, double confidence, double n)
-
buildingModelTree
public boolean buildingModelTree()
-
normalize
public boolean normalize()
-
attemptToSplit
protected void attemptToSplit(ISOUPTree.LeafNode node, ISOUPTree.InnerNode parent, int parentIndex)
-
computeSD
public double computeSD(double squaredVal, double val, double size)
-
scalarProduct
public static double scalarProduct(DoubleVector u, DoubleVector v)
-
initWriter
public void initWriter(String filename)
-
closeWriter
public void closeWriter()
-
log
public void log(String s)
-
-