Class Correlation

  • Direct Known Subclasses:
    EM, Pearson

    public abstract class Correlation
    extends java.lang.Object
    Calculates correlations. Mainly has utility functions that use functions of implementing classes to calculate multiple correlations.
    • Constructor Summary

      Constructors 
      Constructor Description
      Correlation()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      double[][] calculate​(byte[][] data)
      Calculates correlations between all pairs of arrays
      abstract double calculate​(byte[] d1, byte[] d2)
      Calculates the correlation between two arrays
      java.util.Map<java.lang.Integer,​int[]> limitedtopn​(byte[][] data, int n, java.util.Set<java.lang.Integer> list)
      Similar to topn except it only considers the given arrays
      java.util.Map<java.lang.Integer,​double[]> limitedtopnvalues​(byte[][] data, int n, java.util.Set<java.lang.Integer> list)
      Similar to limitedtopn except it returns correlations
      java.util.Map<java.lang.Integer,​int[]> topn​(byte[][] data, int n)
      Returns the position of the most correlated arrays for every array.
      java.util.Map<java.lang.Integer,​double[]> topnvalues​(byte[][] data, int n)
      Similar to topn except it returns the correlations rather than the positions
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Correlation

        public Correlation()
    • Method Detail

      • calculate

        public double[][] calculate​(byte[][] data)
        Calculates correlations between all pairs of arrays
        Parameters:
        data - The data
        Returns:
        A symmetric array of correlations
      • topn

        public java.util.Map<java.lang.Integer,​int[]> topn​(byte[][] data,
                                                                 int n)
        Returns the position of the most correlated arrays for every array. The n most correlated arrays are returned
        Parameters:
        data - The data
        n - Return this number of top correlated arrays
        Returns:
        Map from the position of an array to the position of the n arrays most correlated with it
      • topnvalues

        public java.util.Map<java.lang.Integer,​double[]> topnvalues​(byte[][] data,
                                                                          int n)
        Similar to topn except it returns the correlations rather than the positions
        Parameters:
        data - The data
        n - Return this number of top correlated arrays
        Returns:
        Map from the position of an array to the correlation of the n arrays most correlated with it
      • limitedtopn

        public java.util.Map<java.lang.Integer,​int[]> limitedtopn​(byte[][] data,
                                                                        int n,
                                                                        java.util.Set<java.lang.Integer> list)
        Similar to topn except it only considers the given arrays
        Parameters:
        data - The data
        n - Return this number of top correlated arrays
        list - The position of the arrays to consider
        Returns:
        Map from the position of an array to the position of the n arrays in the list most correlated with it
      • limitedtopnvalues

        public java.util.Map<java.lang.Integer,​double[]> limitedtopnvalues​(byte[][] data,
                                                                                 int n,
                                                                                 java.util.Set<java.lang.Integer> list)
        Similar to limitedtopn except it returns correlations
        Parameters:
        data - The data
        n - Return this number of top correlated arrays
        list - The position of the arrays to consider
        Returns:
        Map from the position of an array to the correlation of the n arrays in the list most correlated with it
      • calculate

        public abstract double calculate​(byte[] d1,
                                         byte[] d2)
        Calculates the correlation between two arrays
        Parameters:
        d1 - The first array
        d2 - The second array
        Returns:
        The correlation