Package weka.classifiers.functions
Class AttributeAsPredictionClassifier
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- weka.core.AbstractSimpleOptionHandler
-
- weka.classifiers.simple.AbstractSimpleClassifier
-
- weka.classifiers.functions.AttributeAsPredictionClassifier
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,Serializable,weka.classifiers.Classifier,weka.core.CapabilitiesHandler,weka.core.OptionHandler
public class AttributeAsPredictionClassifier extends AbstractSimpleClassifier
Simply uses the specified attribute as prediction output. Workaround for making co-variables available to Stacking.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_ActualIndexthe actual attribute index.protected WekaAttributeIndexm_AttIndexthe attribute to use as prediction.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AttributeAsPredictionClassifier()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringattIndexTipText()Returns the tip text for this property.voidbuildClassifier(weka.core.Instances data)Generates a classifier.doubleclassifyInstance(weka.core.Instance instance)Classifies the given test instance.voiddefineOptions()Adds options to the internal list of options.WekaAttributeIndexgetAttIndex()Returns the attribute to use for prediction.weka.core.CapabilitiesgetCapabilities()Returns the Capabilities of this classifier.StringglobalInfo()Returns a string describing the object.voidsetAttIndex(WekaAttributeIndex value)Sets the attribute to use for prediction.StringtoString()Returns a string representation of the options.-
Methods inherited from class weka.classifiers.simple.AbstractSimpleClassifier
distributionForInstance, runClassifier
-
Methods inherited from class weka.core.AbstractSimpleOptionHandler
getOptions, listOptions, setOptions
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_AttIndex
protected WekaAttributeIndex m_AttIndex
the attribute to use as prediction.
-
m_ActualIndex
protected int m_ActualIndex
the actual attribute index.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setAttIndex
public void setAttIndex(WekaAttributeIndex value)
Sets the attribute to use for prediction.- Parameters:
value- the index
-
getAttIndex
public WekaAttributeIndex getAttIndex()
Returns the attribute to use for prediction.- Returns:
- the index
-
attIndexTipText
public String attIndexTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns the Capabilities of this classifier.- Specified by:
getCapabilitiesin interfaceweka.core.CapabilitiesHandler- Specified by:
getCapabilitiesin interfaceweka.classifiers.Classifier- Overrides:
getCapabilitiesin classAbstractSimpleClassifier- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws ExceptionGenerates a classifier. Must initialize all fields of the classifier that are not being set via options (ie. multiple calls of buildClassifier must always lead to the same result). Must not change the dataset in any way.- Parameters:
data- set of instances serving as training data- Throws:
Exception- if the classifier has not been generated successfully
-
classifyInstance
public double classifyInstance(weka.core.Instance instance) throws ExceptionClassifies the given test instance. The instance has to belong to a dataset when it's being classified.- Specified by:
classifyInstancein interfaceweka.classifiers.Classifier- Overrides:
classifyInstancein classAbstractSimpleClassifier- Parameters:
instance- the instance to be classified- Returns:
- the predicted most likely class for the instance or Utils.missingValue() if no prediction is made
- Throws:
Exception- if an error occurred during the prediction
-
toString
public String toString()
Returns a string representation of the options.- Overrides:
toStringin classAbstractOptionHandler- Returns:
- a string representation
-
-