|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.core.NormalizableDistance
weka.core.SAXDistance
public class SAXDistance
Implementing Euclidean distance (or similarity) function.
One object defines not one distance but the data model in which the distances between objects of that data model can be computed.
Attention: For efficiency reasons the use of consistency checks (like are the data models of the two instances exactly the same), is low.
For more information, see:
Wikipedia. Euclidean distance. URL http://en.wikipedia.org/wiki/Euclidean_distance.
@misc{missing_id,
author = {Wikipedia},
title = {Euclidean distance},
URL = {http://en.wikipedia.org/wiki/Euclidean_distance}
}
Valid options are:
-D Turns off the normalization of attribute values in distance calculation.
-R <col1,col2-col4,...> Specifies list of columns to used in the calculation of the distance. 'first' and 'last' are valid indices. (default: first-last)
-V Invert matching sense of column indices.
| Field Summary | |
|---|---|
protected int |
m_bins
number of gaussian bins. |
protected double[][] |
m_distMatrix
|
protected int |
m_n
pre-sax number of attributes. |
protected weka.filters.unsupervised.attribute.Normalize |
m_norm
suid. |
| Fields inherited from class weka.core.NormalizableDistance |
|---|
m_ActiveIndices, m_AttributeIndices, m_Data, m_DontNormalize, m_Ranges, m_Validated, R_MAX, R_MIN, R_WIDTH |
| Constructor Summary | |
|---|---|
SAXDistance()
Constructs an Euclidean Distance object, Instances must be still set. |
|
SAXDistance(weka.core.Instances data)
Constructs an Euclidean Distance object and automatically initializes the ranges. |
|
| Method Summary | |
|---|---|
String |
binsPointTipText()
Returns the tip text for this property. |
protected double |
difference(int index,
double val1,
double val2)
Computes the difference between two given attribute values. |
double |
distance(weka.core.Instance first,
weka.core.Instance second)
Calculates the distance between two instances. |
double |
distance(weka.core.Instance first,
weka.core.Instance second,
weka.core.neighboursearch.PerformanceStats stats)
Calculates the distance (or similarity) between two instances. |
int |
getBins()
Returns the nth point setting. |
double |
getMiddle(double[] ranges)
Returns value in the middle of the two parameter values. |
int |
getN()
Returns the nth point setting. |
String[] |
getOptions()
Gets the current settings of the filter. |
String |
getRevision()
Returns the revision string. |
weka.core.TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on. |
String |
globalInfo()
Returns a string describing this object. |
protected void |
initialize()
initializes the ranges and the attributes being used. |
Enumeration |
listOptions()
Returns an enumeration describing the available options. |
String |
nPointTipText()
Returns the tip text for this property. |
void |
postProcessDistances(double[] distances)
Does post processing of the distances (if necessary) returned by distance(distance(Instance first, Instance second, double cutOffValue). |
void |
setBins(int value)
Sets the nth point setting. |
void |
setN(int value)
Sets the nth point setting. |
void |
setOptions(String[] options)
Parses a list of options for this object. |
double |
sqDifference(int index,
double val1,
double val2)
Returns the squared difference of two values of an attribute. |
protected weka.core.Instance |
transform(weka.core.Instance i)
|
protected double |
updateDistance(double currDist,
double diff)
Updates the current distance calculated so far with the new difference between two attributes. |
boolean |
valueIsSmallerEqual(weka.core.Instance instance,
int dim,
double value)
Returns true if the value of the given dimension is smaller or equal the value to be compared with. |
| Methods inherited from class weka.core.NormalizableDistance |
|---|
attributeIndicesTipText, distance, distance, dontNormalizeTipText, getAttributeIndices, getDontNormalize, getInstances, getInvertSelection, getRanges, initializeAttributeIndices, initializeRanges, initializeRanges, initializeRanges, initializeRangesEmpty, inRanges, invalidate, invertSelectionTipText, norm, rangesSet, setAttributeIndices, setDontNormalize, setInstances, setInvertSelection, toString, update, updateRanges, updateRanges, updateRanges, updateRangesFirst, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected weka.filters.unsupervised.attribute.Normalize m_norm
protected int m_bins
protected int m_n
protected double[][] m_distMatrix
| Constructor Detail |
|---|
public SAXDistance()
public SAXDistance(weka.core.Instances data)
data - the instances the distance function should work on| Method Detail |
|---|
protected void initialize()
initialize in class weka.core.NormalizableDistancepublic String globalInfo()
globalInfo in class weka.core.NormalizableDistancepublic Enumeration listOptions()
listOptions in interface weka.core.OptionHandlerlistOptions in class weka.core.NormalizableDistance
public void setOptions(String[] options)
throws Exception
setOptions in interface weka.core.OptionHandlersetOptions in class weka.core.NormalizableDistanceoptions - the list of options as an array of strings
Exception - if an option is not supported#reset()public String[] getOptions()
getOptions in interface weka.core.OptionHandlergetOptions in class weka.core.NormalizableDistancepublic void setBins(int value)
value - the nth pointpublic void setN(int value)
value - the nth pointpublic int getBins()
public int getN()
public String binsPointTipText()
public String nPointTipText()
public weka.core.TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface weka.core.TechnicalInformationHandler
public double distance(weka.core.Instance first,
weka.core.Instance second)
distance in interface weka.core.DistanceFunctiondistance in class weka.core.NormalizableDistancefirst - the first instancesecond - the second instance
public double distance(weka.core.Instance first,
weka.core.Instance second,
weka.core.neighboursearch.PerformanceStats stats)
distance in interface weka.core.DistanceFunctiondistance in class weka.core.NormalizableDistancefirst - the first instancesecond - the second instancestats - the structure for storing performance statistics.
protected double updateDistance(double currDist,
double diff)
updateDistance in class weka.core.NormalizableDistancecurrDist - the current distance calculated so fardiff - the difference between two new attributes
difference(int, double, double)
protected double difference(int index,
double val1,
double val2)
difference in class weka.core.NormalizableDistanceindex - the attribute indexval1 - the first valueval2 - the second value
public void postProcessDistances(double[] distances)
postProcessDistances in interface weka.core.DistanceFunctionpostProcessDistances in class weka.core.NormalizableDistancedistances - the distances to post-process
public double sqDifference(int index,
double val1,
double val2)
index - the attribute indexval1 - the first valueval2 - the second value
public double getMiddle(double[] ranges)
ranges - the ranges to this dimension
protected weka.core.Instance transform(weka.core.Instance i)
public boolean valueIsSmallerEqual(weka.core.Instance instance,
int dim,
double value)
instance - the instance where the value should be taken ofdim - the dimension of the valuevalue - the value to compare with
public String getRevision()
getRevision in interface weka.core.RevisionHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||