Package adams.data.outlier
Class AbstractOutlierDetector<T extends DataContainer>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.outlier.AbstractOutlierDetector<T>
-
- Type Parameters:
T
- the type of data to process
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<OutlierDetector>
,SizeOfHandler
,OutlierDetector<T>
,Serializable
,Comparable
- Direct Known Subclasses:
AbstractDatabaseConnectionOutlierDetector
,AbstractScript
,AbstractScriptedOutlierDetector
,Excluded
,FieldRequired
,MinMax
,PassThrough
,StringMatcher
,TargetRequired
,TimeseriesMinPoints
,TimeseriesRange
,TimeseriesTimestampCheck
public abstract class AbstractOutlierDetector<T extends DataContainer> extends AbstractOptionHandler implements OutlierDetector<T>, QuickInfoSupporter
Abstract base class for outlier detectors. Derived classes only have to override theprocessData()
method. Thereset()
method can be used to reset an algorithms internal state, e.g., after setting options, which invalidate the previously generated data.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractOutlierDetector.DetectorJob<T extends DataContainer>
A job class specific to outlier detectors.
-
Field Summary
-
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 AbstractOutlierDetector()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkData(T data)
The default implementation only checks whether there is any data set.void
cleanUp()
Cleans up data structures, frees up memory.int
compareTo(Object o)
Compares this object with the specified object for order.void
destroy()
Frees up memory in a "destructive" non-reversible way.List<String>
detect(T data)
Returns the detections on the specified data.boolean
equals(Object o)
Returns whether the two objects are the same.static AbstractOutlierDetector
forCommandLine(String cmdline)
Instantiates the detector from the given commandline (i.e., classname and optional options).static AbstractOutlierDetector
forName(String classname, String[] options)
Instantiates the detector with the given options.static String[]
getOutlierDetectors()
Returns a list with classnames of detector.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.protected abstract List<String>
processData(T data)
Performs the actual detection.void
reset()
Resets the detector.AbstractOutlierDetector
shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.AbstractOutlierDetector
shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
reset
public void reset()
Resets the detector. Derived classes must call this method in set-methods of parameters to assure the invalidation of previously generated data.- Overrides:
reset
in classAbstractOptionHandler
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory. Sets the input data to null.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.
Calls cleanUp() and cleans up the options.- Specified by:
destroy
in interfaceDestroyable
- Overrides:
destroy
in classAbstractOptionHandler
- See Also:
AbstractOptionHandler.cleanUpOptions()
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.
Default implementation returns null.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Returns:
- null if no info available, otherwise short string
-
detect
public List<String> detect(T data)
Returns the detections on the specified data.- Specified by:
detect
in interfaceOutlierDetector<T extends DataContainer>
- Parameters:
data
- the data to process- Returns:
- the detections
-
checkData
protected void checkData(T data)
The default implementation only checks whether there is any data set.- Parameters:
data
- the data to process
-
processData
protected abstract List<String> processData(T data)
Performs the actual detection.- Parameters:
data
- the data to process- Returns:
- the detections
-
compareTo
public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Only compares the commandlines of the two objects.- Specified by:
compareTo
in interfaceComparable<T extends DataContainer>
- Parameters:
o
- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
ClassCastException
- if the specified object's type prevents it from being compared to this object.
-
equals
public boolean equals(Object o)
Returns whether the two objects are the same.
Only compares the commandlines of the two objects.
-
shallowCopy
public AbstractOutlierDetector shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceOutlierDetector<T extends DataContainer>
- Specified by:
shallowCopy
in interfaceShallowCopySupporter<T extends DataContainer>
- Returns:
- the shallow copy
-
shallowCopy
public AbstractOutlierDetector shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceOutlierDetector<T extends DataContainer>
- Specified by:
shallowCopy
in interfaceShallowCopySupporter<T extends DataContainer>
- Parameters:
expand
- whether to expand variables to their current values- Returns:
- the shallow copy
-
getOutlierDetectors
public static String[] getOutlierDetectors()
Returns a list with classnames of detector.- Returns:
- the detector classnames
-
forName
public static AbstractOutlierDetector forName(String classname, String[] options)
Instantiates the detector with the given options.- Parameters:
classname
- the classname of the detector to instantiateoptions
- the options for the detector- Returns:
- the instantiated detector or null if an error occurred
-
forCommandLine
public static AbstractOutlierDetector forCommandLine(String cmdline)
Instantiates the detector from the given commandline (i.e., classname and optional options).- Parameters:
cmdline
- the classname (and optional options) of the detector to instantiate- Returns:
- the instantiated detector or null if an error occurred
-
-