chemCast.weka
Class CosineSimilarity

java.lang.Object
  extended by EuclideanDistance
      extended by chemCast.weka.AbstractSimilarity
          extended by chemCast.weka.CosineSimilarity

public class CosineSimilarity
extends AbstractSimilarity

1-(Cosine similarity).
Cosine similarity is Cab=Zab/Math.sqrt(Zaa*Zbb).
or
Sum(Xsj*Xtj)/Math.sqrt[Sum(Xsj*Xsj)^2+Sum(Xtj*Xtj)^2] This class calculates dissimilarity (to be compatible with DistanceFunction int the form of 1-Cab

Author:
Nina Jeliazkova

Constructor Summary
CosineSimilarity()
           
CosineSimilarity(Instances data)
           
 
Method Summary
 double distance(Instance a, Instance b)
           
 double distance(Instance a, Instance b, double cutoff)
           
 double distance(Instance a, Instance b, double cutoff, boolean print)
           
 float getDistance(Instance a, Instance b)
           
 float getNativeComparison(Instance a, Instance b)
           
 void postProcessDistances(double[] distances)
           
 java.lang.String toString()
           
 
Methods inherited from class chemCast.weka.AbstractSimilarity
distance2similarity, similarity2distance, update
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CosineSimilarity

public CosineSimilarity()

CosineSimilarity

public CosineSimilarity(Instances data)
Method Detail

getDistance

public float getDistance(Instance a,
                         Instance b)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getNativeComparison

public float getNativeComparison(Instance a,
                                 Instance b)
                          throws java.lang.Exception
Throws:
java.lang.Exception

distance

public double distance(Instance a,
                       Instance b)
                throws java.lang.Exception
Throws:
java.lang.Exception

distance

public double distance(Instance a,
                       Instance b,
                       double cutoff)

distance

public double distance(Instance a,
                       Instance b,
                       double cutoff,
                       boolean print)

postProcessDistances

public void postProcessDistances(double[] distances)

toString

public java.lang.String toString()