Class Dependence.Utils

  • Enclosing interface:
    Dependence

    public static class Dependence.Utils
    extends java.lang.Object
    Utility functions that were previously in the abstract class.
    Author:
    Erich Schubert
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <A> double[] computeNormalizedRanks​(NumberArrayAdapter<?,​A> adapter, A data, int len)
      Compute ranks of all objects, normalized to [0;1] (where 0 is the smallest value, 1 is the largest).
      static <A> double[] ranks​(NumberArrayAdapter<?,​A> adapter, A data, int len)
      Compute ranks of all objects, ranging from 1 to len.
      static <A> double[] ranks​(NumberArrayAdapter<?,​A> adapter, A data, int[] idx)
      Compute ranks of all objects, ranging from 1 to len.
      static <A,​B>
      int
      size​(NumberArrayAdapter<?,​A> adapter1, A data1, NumberArrayAdapter<?,​B> adapter2, B data2)
      Validate the length of the two data sets (must be the same, and non-zero)
      static <A> int size​(NumberArrayAdapter<?,​A> adapter, java.util.Collection<? extends A> data)
      Validate the length of the two data sets (must be the same, and non-zero)
      static <A> int[] sortedIndex​(NumberArrayAdapter<?,​A> adapter, A data, int len)
      Build a sorted index of objects.
      • Methods inherited from class java.lang.Object

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

      • Utils

        public Utils()
    • Method Detail

      • computeNormalizedRanks

        public static <A> double[] computeNormalizedRanks​(NumberArrayAdapter<?,​A> adapter,
                                                          A data,
                                                          int len)
        Compute ranks of all objects, normalized to [0;1] (where 0 is the smallest value, 1 is the largest).
        Parameters:
        adapter - Data adapter
        data - Data array
        len - Length of data
        Returns:
        Array of scores
      • ranks

        public static <A> double[] ranks​(NumberArrayAdapter<?,​A> adapter,
                                         A data,
                                         int len)
        Compute ranks of all objects, ranging from 1 to len.

        Ties are given the average rank.

        Parameters:
        adapter - Data adapter
        data - Data array
        len - Length of data
        Returns:
        Array of scores
      • ranks

        public static <A> double[] ranks​(NumberArrayAdapter<?,​A> adapter,
                                         A data,
                                         int[] idx)
        Compute ranks of all objects, ranging from 1 to len.

        Ties are given the average rank.

        Parameters:
        adapter - Data adapter
        data - Data array
        idx - Data index
        Returns:
        Array of scores
      • size

        public static <A,​B> int size​(NumberArrayAdapter<?,​A> adapter1,
                                           A data1,
                                           NumberArrayAdapter<?,​B> adapter2,
                                           B data2)
        Validate the length of the two data sets (must be the same, and non-zero)
        Type Parameters:
        A - First array type
        B - Second array type
        Parameters:
        adapter1 - First data adapter
        data1 - First data set
        adapter2 - Second data adapter
        data2 - Second data set
      • size

        public static <A> int size​(NumberArrayAdapter<?,​A> adapter,
                                   java.util.Collection<? extends A> data)
        Validate the length of the two data sets (must be the same, and non-zero)
        Type Parameters:
        A - First array type
        Parameters:
        adapter - Data adapter
        data - Data sets
      • sortedIndex

        public static <A> int[] sortedIndex​(NumberArrayAdapter<?,​A> adapter,
                                            A data,
                                            int len)
        Build a sorted index of objects.
        Parameters:
        adapter - Data adapter
        data - Data array
        len - Length of data
        Returns:
        Sorted index