Package adams.ml.model.classification
Class AbstractClassifier
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.ml.model.classification.AbstractClassifier
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,CapabilitiesHandler
,Algorithm<ClassificationModel>
,Classifier
,Serializable
- Direct Known Subclasses:
WekaClassifier
public abstract class AbstractClassifier extends AbstractOptionHandler implements Classifier
Ancestor for classification algorithms.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_StrictCapabilities
whether to use strict capability tests.-
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 AbstractClassifier()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ClassificationModel
buildModel(Dataset data)
Builds a model from the data.protected Dataset
check(Dataset data)
Performs checks on the data.void
defineOptions()
Adds options to the internal list of options.protected abstract ClassificationModel
doBuildModel(Dataset data)
Builds a model from the data.Capabilities
getCapabilities()
Returns the algorithm's capabilities in terms of data.boolean
getStrictCapabilities()
Returns whether to use a strict capabilities check.String
handles(Dataset data, boolean strict)
Checks whether the data can be handled.void
setStrictCapabilities(boolean value)
Sets whether to use a strict capabilities check.String
strictCapabilitiesTipText()
Returns the tip text for this property.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
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.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setStrictCapabilities
public void setStrictCapabilities(boolean value)
Sets whether to use a strict capabilities check.- Parameters:
value
- true if to use strict check
-
getStrictCapabilities
public boolean getStrictCapabilities()
Returns whether to use a strict capabilities check.- Returns:
- true if to use strict check
-
strictCapabilitiesTipText
public String strictCapabilitiesTipText()
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 Capabilities getCapabilities()
Returns the algorithm's capabilities in terms of data.- Specified by:
getCapabilities
in interfaceAlgorithm<ClassificationModel>
- Specified by:
getCapabilities
in interfaceCapabilitiesHandler
- Returns:
- the algorithm's capabilities
-
handles
public String handles(Dataset data, boolean strict)
Checks whether the data can be handled.- Specified by:
handles
in interfaceAlgorithm<ClassificationModel>
- Parameters:
data
- the data to checkstrict
- whether to perform a strict check- Returns:
- null if data can be handled, otherwise error message
-
check
protected Dataset check(Dataset data) throws Exception
Performs checks on the data.- Parameters:
data
- the data to check- Returns:
- the potentially adjusted data
- Throws:
Exception
- if checks fail
-
doBuildModel
protected abstract ClassificationModel doBuildModel(Dataset data) throws Exception
Builds a model from the data.- Parameters:
data
- the data to use for building the model- Returns:
- the generated model
- Throws:
Exception
- if the build fails
-
buildModel
public ClassificationModel buildModel(Dataset data) throws Exception
Builds a model from the data.- Specified by:
buildModel
in interfaceAlgorithm<ClassificationModel>
- Parameters:
data
- the data to use for building the model- Returns:
- the generated model
- Throws:
Exception
- if the build fails
-
-