Class GreenwaldKhannaNumericAttributeClassObserver
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.classifiers.core.attributeclassobservers.GreenwaldKhannaNumericAttributeClassObserver
-
- All Implemented Interfaces:
Configurable
,Serializable
,AttributeClassObserver
,NumericAttributeClassObserver
,MOAObject
,OptionHandler
- Direct Known Subclasses:
IademGreenwaldKhannaNumericAttributeClassObserver
public class GreenwaldKhannaNumericAttributeClassObserver extends AbstractOptionHandler implements NumericAttributeClassObserver
Class for observing the class data distribution for a numeric attribute using Greenwald and Khanna methodology. This observer monitors the class distribution of a given attribute. Used in naive Bayes and decision trees to monitor data statistics on leaves.- Version:
- $Revision: 7 $
- Author:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AutoExpandVector<GreenwaldKhannaQuantileSummary>
attValDistPerClass
IntOption
numTuplesOption
-
Fields inherited from class moa.options.AbstractOptionHandler
config
-
-
Constructor Summary
Constructors Constructor Description GreenwaldKhannaNumericAttributeClassObserver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeSplitSuggestion
getBestEvaluatedSplitSuggestion(SplitCriterion criterion, double[] preSplitDist, int attIndex, boolean binaryOnly)
Gets the best split suggestion given a criterion and a class distributiondouble[][]
getClassDistsResultingFromBinarySplit(double splitValue)
void
getDescription(StringBuilder sb, int indent)
Returns a string representation of this object.void
observeAttributeClass(double attVal, int classVal, double weight)
Updates statistics of this observer given an attribute value, a class and the weight of the instance observedvoid
observeAttributeTarget(double attVal, double target)
protected void
prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
This method describes the implementation of how to prepare this object for use.double
probabilityOfAttributeValueGivenClass(double attVal, int classVal)
Gets the probability for an attribute value given a class-
Methods inherited from class moa.options.AbstractOptionHandler
copy, getCLICreationString, getOptions, getPreparedClassOption, getPurposeString, 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.MOAObject
measureByteSize
-
Methods inherited from interface moa.options.OptionHandler
copy, getCLICreationString, getOptions, getPurposeString, prepareForUse, prepareForUse
-
-
-
-
Field Detail
-
attValDistPerClass
protected AutoExpandVector<GreenwaldKhannaQuantileSummary> attValDistPerClass
-
numTuplesOption
public IntOption numTuplesOption
-
-
Method Detail
-
observeAttributeClass
public void observeAttributeClass(double attVal, int classVal, double weight)
Description copied from interface:AttributeClassObserver
Updates statistics of this observer given an attribute value, a class and the weight of the instance observed- Specified by:
observeAttributeClass
in interfaceAttributeClassObserver
- Parameters:
attVal
- the value of the attributeclassVal
- the classweight
- the weight of the instance
-
probabilityOfAttributeValueGivenClass
public double probabilityOfAttributeValueGivenClass(double attVal, int classVal)
Description copied from interface:AttributeClassObserver
Gets the probability for an attribute value given a class- Specified by:
probabilityOfAttributeValueGivenClass
in interfaceAttributeClassObserver
- Parameters:
attVal
- the attribute valueclassVal
- the class- Returns:
- probability for an attribute value given a class
-
getBestEvaluatedSplitSuggestion
public AttributeSplitSuggestion getBestEvaluatedSplitSuggestion(SplitCriterion criterion, double[] preSplitDist, int attIndex, boolean binaryOnly)
Description copied from interface:AttributeClassObserver
Gets the best split suggestion given a criterion and a class distribution- Specified by:
getBestEvaluatedSplitSuggestion
in interfaceAttributeClassObserver
- Parameters:
criterion
- the split criterion to usepreSplitDist
- the class distribution before the splitattIndex
- the attribute indexbinaryOnly
- true to use binary splits- Returns:
- suggestion of best attribute split
-
getClassDistsResultingFromBinarySplit
public double[][] getClassDistsResultingFromBinarySplit(double splitValue)
-
getDescription
public void getDescription(StringBuilder sb, int indent)
Description copied from interface:MOAObject
Returns a string representation of this object. Used inAbstractMOAObject.toString
to give a string representation of the object.- Specified by:
getDescription
in interfaceMOAObject
- Parameters:
sb
- the stringbuilder to add the descriptionindent
- the number of characters to indent
-
prepareForUseImpl
protected void prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
Description copied from class:AbstractOptionHandler
This method describes the implementation of how to prepare this object for use. All classes that extends this class have to implementprepareForUseImpl
and notprepareForUse
sinceprepareForUse
callsprepareForUseImpl
.- Specified by:
prepareForUseImpl
in classAbstractOptionHandler
- Parameters:
monitor
- the TaskMonitor to userepository
- the ObjectRepository to use
-
observeAttributeTarget
public void observeAttributeTarget(double attVal, double target)
- Specified by:
observeAttributeTarget
in interfaceAttributeClassObserver
-
-