Package adams.data.evaluator.instance
Class DistanceToCenter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.evaluator.instance.AbstractEvaluator
-
- adams.data.evaluator.instance.AbstractSerializableEvaluator
-
- adams.data.evaluator.instance.AbstractNearestNeighborBasedEvaluator
-
- adams.data.evaluator.instance.DistanceToCenter
-
- All Implemented Interfaces:
adams.core.CleanUpHandler
,adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.SerializableObject
,adams.core.ShallowCopySupporter<Evaluator>
,adams.core.SizeOfHandler
,Evaluator
,Serializable
,Comparable
public class DistanceToCenter extends AbstractNearestNeighborBasedEvaluator
Uses the specified nearest neighbor search to determine a neighborhood. From this neighborhood the center is calculated (only using numeric attributes) and the distance to the center is returned.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-missing-evaluation <float> (property: missingEvaluation) The value to use as replacement for missing evaluations. default: NaN
-serialization-file <adams.core.io.PlaceholderFile> (property: serializationFile) The file to serialize the generated internal model to. default: ${CWD}
-override-serialized-file <boolean> (property: overrideSerializedFile) If set to true, then any serialized file will be ignored and the setup for serialization will be regenerated. default: false
-search <weka.core.neighboursearch.NearestNeighbourSearch> (property: search) The nearest neighbor search to use. default: weka.core.neighboursearch.LinearNNSearch -A \"weka.core.EuclideanDistance -R first-last\"
-filter <weka.filters.Filter> (property: filter) The filter to apply to the data. default: weka.filters.AllFilter
-num-neighbors <int> (property: numNeighbors) The number of neighbors to use in the neighborhood. default: 100 minimum: 1
- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.filters.Filter
m_ActualFilter
the actual filter.protected weka.filters.Filter
m_Filter
the filter to use for filtering.protected int
m_NumNeighbors
the number of neighbors to use.protected weka.core.Instances
m_RawTrainingData
the raw training data.-
Fields inherited from class adams.data.evaluator.instance.AbstractNearestNeighborBasedEvaluator
m_ActualSearch, m_Header, m_Search, m_TrainingData
-
Fields inherited from class adams.data.evaluator.instance.AbstractSerializableEvaluator
m_OverrideSerializationFile, m_SerializableObjectHelper, m_SerializationFile
-
Fields inherited from class adams.data.evaluator.instance.AbstractEvaluator
DEFAULT_METRIC, m_MissingEvaluation
-
-
Constructor Summary
Constructors Constructor Description DistanceToCenter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.String
filterTipText()
Returns the tip text for this property.protected weka.core.neighboursearch.NearestNeighbourSearch
getDefaultSearch()
Returns the default search algorithm to use.weka.filters.Filter
getFilter()
Returns the filter to use.int
getNumNeighbors()
Returns the number of neighbors to use in the neighborhood.String
globalInfo()
Returns a string describing the object.void
initSerializationSetup()
Regenerates all the objects that are necessary for serialization.String
numNeighborsTipText()
Returns the tip text for this property.protected boolean
performBuild(weka.core.Instances data)
Builds the evaluator.protected Float
performEvaluate(weka.core.Instance data)
Performs the actual evaluation.Object[]
retrieveSerializationSetup()
Returns the member variables to serialize to a file.void
setFilter(weka.filters.Filter value)
Sets the filter to use.void
setNumNeighbors(int value)
Sets the number of neighbors to use in the neighborhood.void
setSerializationSetup(Object[] value)
Updates the member variables with the provided objects obtained from deserialization.-
Methods inherited from class adams.data.evaluator.instance.AbstractNearestNeighborBasedEvaluator
cleanUp, getDefaultMissingEvaluation, getSearch, initSearch, searchTipText, setSearch
-
Methods inherited from class adams.data.evaluator.instance.AbstractSerializableEvaluator
destroy, getOverrideSerializedFile, getSerializationFile, initialize, isSetupLoadedOrGenerated, overrideSerializedFileTipText, preCheck, reset, serializationFileTipText, setLoggingLevel, setOverrideSerializedFile, setSerializationFile, setSetupLoadedOrGenerated
-
Methods inherited from class adams.data.evaluator.instance.AbstractEvaluator
build, compareTo, equals, evaluate, forCommandLine, forName, getEvaluators, getMissingEvaluation, missingEvaluationTipText, performMultiEvaluate, preCheck, setMissingEvaluation, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Filter
protected weka.filters.Filter m_Filter
the filter to use for filtering.
-
m_ActualFilter
protected weka.filters.Filter m_ActualFilter
the actual filter.
-
m_NumNeighbors
protected int m_NumNeighbors
the number of neighbors to use.
-
m_RawTrainingData
protected transient weka.core.Instances m_RawTrainingData
the raw training data.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classAbstractNearestNeighborBasedEvaluator
-
getDefaultSearch
protected weka.core.neighboursearch.NearestNeighbourSearch getDefaultSearch()
Returns the default search algorithm to use.- Specified by:
getDefaultSearch
in classAbstractNearestNeighborBasedEvaluator
- Returns:
- the default
-
setFilter
public void setFilter(weka.filters.Filter value)
Sets the filter to use.- Parameters:
value
- the filter
-
getFilter
public weka.filters.Filter getFilter()
Returns the filter to use.- Returns:
- the filter
-
filterTipText
public String filterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumNeighbors
public void setNumNeighbors(int value)
Sets the number of neighbors to use in the neighborhood.- Parameters:
value
- the number of neighbors
-
getNumNeighbors
public int getNumNeighbors()
Returns the number of neighbors to use in the neighborhood.- Returns:
- the number of neighbors
-
numNeighborsTipText
public String numNeighborsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
performBuild
protected boolean performBuild(weka.core.Instances data)
Builds the evaluator.- Specified by:
performBuild
in classAbstractEvaluator
- Parameters:
data
- the instance to check- Returns:
- true if build successful
-
retrieveSerializationSetup
public Object[] retrieveSerializationSetup()
Returns the member variables to serialize to a file.- Returns:
- the objects to serialize
-
setSerializationSetup
public void setSerializationSetup(Object[] value)
Updates the member variables with the provided objects obtained from deserialization.- Parameters:
value
- the deserialized objects
-
initSerializationSetup
public void initSerializationSetup()
Regenerates all the objects that are necessary for serialization.- Specified by:
initSerializationSetup
in interfaceadams.core.SerializableObject
- Overrides:
initSerializationSetup
in classAbstractNearestNeighborBasedEvaluator
-
performEvaluate
protected Float performEvaluate(weka.core.Instance data)
Performs the actual evaluation.- Overrides:
performEvaluate
in classAbstractEvaluator
- Parameters:
data
- the instance to check- Returns:
- evaluation metric,
AbstractEvaluator.m_MissingEvaluation
in case the class value is missing
-
-