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.Filterm_ActualFilterthe actual filter.protected weka.filters.Filterm_Filterthe filter to use for filtering.protected intm_NumNeighborsthe number of neighbors to use.protected weka.core.Instancesm_RawTrainingDatathe 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 voiddefineOptions()Adds options to the internal list of options.StringfilterTipText()Returns the tip text for this property.protected weka.core.neighboursearch.NearestNeighbourSearchgetDefaultSearch()Returns the default search algorithm to use.weka.filters.FiltergetFilter()Returns the filter to use.intgetNumNeighbors()Returns the number of neighbors to use in the neighborhood.StringglobalInfo()Returns a string describing the object.voidinitSerializationSetup()Regenerates all the objects that are necessary for serialization.StringnumNeighborsTipText()Returns the tip text for this property.protected booleanperformBuild(weka.core.Instances data)Builds the evaluator.protected FloatperformEvaluate(weka.core.Instance data)Performs the actual evaluation.Object[]retrieveSerializationSetup()Returns the member variables to serialize to a file.voidsetFilter(weka.filters.Filter value)Sets the filter to use.voidsetNumNeighbors(int value)Sets the number of neighbors to use in the neighborhood.voidsetSerializationSetup(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:
globalInfoin interfaceadams.core.GlobalInfoSupporter- Specified by:
globalInfoin 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:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classAbstractNearestNeighborBasedEvaluator
-
getDefaultSearch
protected weka.core.neighboursearch.NearestNeighbourSearch getDefaultSearch()
Returns the default search algorithm to use.- Specified by:
getDefaultSearchin 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:
performBuildin 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:
initSerializationSetupin interfaceadams.core.SerializableObject- Overrides:
initSerializationSetupin classAbstractNearestNeighborBasedEvaluator
-
performEvaluate
protected Float performEvaluate(weka.core.Instance data)
Performs the actual evaluation.- Overrides:
performEvaluatein classAbstractEvaluator- Parameters:
data- the instance to check- Returns:
- evaluation metric,
AbstractEvaluator.m_MissingEvaluationin case the class value is missing
-
-