nl.liacs.subdisc
Class CorrelationMeasure

java.lang.Object
  extended by nl.liacs.subdisc.CorrelationMeasure

public class CorrelationMeasure
extends java.lang.Object


Constructor Summary
CorrelationMeasure(CorrelationMeasure theBase)
           
CorrelationMeasure(int theType, Column thePrimaryColumn, Column theSecondaryColumn)
           
 
Method Summary
 void addObservation(double theYValue, double theXValue)
          Adds a new observation after which the current correlation will be outdated.
static boolean compareEMValues(double theFirstValue, double theSecondValue)
          TODO: Make use of CorrelationMeasure being comparable
 int compareTo(CorrelationMeasure theOtherCorrelationMeasure)
           
 double computeCorrelationDistance()
          Computes the difference between the correlations of this subset and its complement
 double computeEntropy()
          The correlation distance between the subset and its complement is weighted with the entropy.
 double getComplementCorrelation()
          Returns the correlation value for the complement of this subset.
 double getCorrelation()
          Returns the correlation given the observations contained by CorrelationMeasure
 double getEvaluationMeasureValue()
          There are different types of quality measures possible all closely related the correlation value.
 double getPValue()
          TODO Verify whether solution is the same when z1 - z2 and z2 - z1
 int getSampleSize()
           
 double getXSquaredSum()
           
 double getXSum()
           
 double getXYSum()
           
 double getYSquaredSum()
           
 double getYSum()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CorrelationMeasure

public CorrelationMeasure(int theType,
                          Column thePrimaryColumn,
                          Column theSecondaryColumn)

CorrelationMeasure

public CorrelationMeasure(CorrelationMeasure theBase)
                   throws java.lang.NullPointerException
Throws:
java.lang.NullPointerException
Method Detail

addObservation

public void addObservation(double theYValue,
                           double theXValue)
Adds a new observation after which the current correlation will be outdated. getCorrelation automatically takes care that the current correlation is returned by checking whether CorrelationMeasure is outdated.

Parameters:
theXValue - the x-value of an observation
theYValue - the y-value of an observation

getCorrelation

public double getCorrelation()
Returns the correlation given the observations contained by CorrelationMeasure

Returns:
the correlation

computeCorrelationDistance

public double computeCorrelationDistance()
Computes the difference between the correlations of this subset and its complement

Returns:
correlation distance

getSampleSize

public int getSampleSize()

getXSum

public double getXSum()

getYSum

public double getYSum()

getXYSum

public double getXYSum()

getXSquaredSum

public double getXSquaredSum()

getYSquaredSum

public double getYSquaredSum()

compareTo

public int compareTo(CorrelationMeasure theOtherCorrelationMeasure)

getEvaluationMeasureValue

public double getEvaluationMeasureValue()
There are different types of quality measures possible all closely related the correlation value. Corresponding with the correct type as defined in the constructor, the correct QM value is returned.

Returns:
the quality measure value

compareEMValues

public static boolean compareEMValues(double theFirstValue,
                                      double theSecondValue)
TODO: Make use of CorrelationMeasure being comparable

Parameters:
theFirstValue - the first parameter to be compared
theSecondValue - the second parameter to be compared
Returns:
true when the first parameter is better or equal than the second. false if the second value is better

getComplementCorrelation

public double getComplementCorrelation()
Returns the correlation value for the complement of this subset. Computes this value if it is not calculated yet and simply returns the value if it is.

Returns:
complement correlation value

getPValue

public double getPValue()
TODO Verify whether solution is the same when z1 - z2 and z2 - z1

Returns:
the p-value

computeEntropy

public double computeEntropy()
The correlation distance between the subset and its complement is weighted with the entropy. The entropy is defined by the function H(p) = -p*log(p)

Returns:
weighted correlation distance