|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.NormalizableDistance
edu.georgetown.gucs.clustering.CosineSimilarity
public class CosineSimilarity
Class for computing the cosine similarity between two instances.
Field Summary |
---|
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 | |
---|---|
CosineSimilarity()
Default constructor. |
|
CosineSimilarity(weka.core.Instances instances)
Explicit constructor. |
Method Summary | |
---|---|
double |
distance(weka.core.Instance first,
weka.core.Instance second)
Calculates the cosine similarity between two instances. |
java.lang.String |
getRevision()
|
java.lang.String |
globalInfo()
|
static void |
main(java.lang.String[] args)
A main method for testing and illustration. |
protected double |
updateDistance(double currDist,
double diff)
Updates the current distance calculated so far with the new difference between two attributes. |
Methods inherited from class weka.core.NormalizableDistance |
---|
attributeIndicesTipText, difference, distance, distance, distance, dontNormalizeTipText, getAttributeIndices, getDontNormalize, getInstances, getInvertSelection, getOptions, getRanges, initialize, initializeAttributeIndices, initializeRanges, initializeRanges, initializeRanges, initializeRangesEmpty, inRanges, invalidate, invertSelectionTipText, listOptions, norm, postProcessDistances, rangesSet, setAttributeIndices, setDontNormalize, setInstances, setInvertSelection, setOptions, toString, update, updateRanges, updateRanges, updateRanges, updateRangesFirst, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CosineSimilarity()
public CosineSimilarity(weka.core.Instances instances)
instances
- the instances the distance function should work onMethod Detail |
---|
public double distance(weka.core.Instance first, weka.core.Instance second)
distance
in interface weka.core.DistanceFunction
distance
in class weka.core.NormalizableDistance
first
- the first instancesecond
- the second instance
public java.lang.String globalInfo()
globalInfo
in class weka.core.NormalizableDistance
public java.lang.String getRevision()
getRevision
in interface weka.core.RevisionHandler
protected double updateDistance(double currDist, double diff)
updateDistance
in class weka.core.NormalizableDistance
currDist
- the current distance calculated so fardiff
- the difference between two new attributes
NormalizableDistance.difference(int, double, double)
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |