Class Rank
- Author:
- Paul Pavlidis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IntArrayList
order
(DoubleArrayList array) Return a permutation which puts the array in sorted order.static long
static DoubleArrayList
rankTransform
(DoubleArrayList array) Rank transform an array.static DoubleArrayList
rankTransform
(DoubleArrayList array, boolean descending) Rank transform an array.rankTransform
(Map<K, ? extends Comparable<?>> m) Rank transform a map, where the values are Comparable values we wish to rank.rankTransform
(Map<K, ? extends Comparable<?>> m, boolean desc) Ties are broken as for the other methods.
-
Constructor Details
-
Rank
public Rank()
-
-
Method Details
-
order
Return a permutation which puts the array in sorted order. In other words, the values returned indicate the positions of the sorted values in the original array (the lowest value has the lowest rank, but it could be located anywhere in the array). Indexes start from 0. Tied values are put in an arbitrary ordering.- Parameters:
array
-- Returns:
-
rankSum
- Parameters:
ranks
-- Returns:
-
rankTransform
Rank transform an array. The ranks are constructed based on the sort order of the elements. That is, low values get low numbered ranks starting from 1.Ties are resolved by assigning the average rank for tied values. For example, instead of arbitrarily assigning ties ranks 3,4,5, all three values would get a rank of 4 and no value would get a rank of 3 or 5.
Missing values are sorted in their natural order, which means they end up all at one end (at the high ('bad') end)
- Parameters:
array
- DoubleArrayListarray
- , or null if the ranks could not be computed.- Returns:
- cern.colt.list.DoubleArrayList
-
rankTransform
Rank transform an array. The ranks are constructed based on the sort order of the elements. That is, low values get low numbered ranks starting from 1, unless you set descending = true.Ties are resolved by assigning the average rank for tied values. For example, instead of arbitrarily assigning ties ranks 3,4,5, all three values would get a rank of 4 and no value would get a rank of 3 or 5.
Missing values are sorted in their natural order, which means they end up all at one end (at the high ('bad') end)
- Parameters:
array
- DoubleArrayListdescending
- - reverse the usual ordering so larger values are the the front.- Returns:
- cern.colt.list.DoubleArrayList, or null if the input is empty or null.
-
rankTransform
Rank transform a map, where the values are Comparable values we wish to rank. Ties are broken as for the other methods. Ranks are zero-basedMissing values are sorted in their natural order, which means they end up all at one end (at the high ('bad') end)
- Parameters:
m
- java.util.Map with keys Objects, values Doubles.- Returns:
- A java.util.Map keys=old keys, values=java.lang.Double rank of the key. Non-integer values mean tie splits.
-
rankTransform
Ties are broken as for the other methods. CAUTION - ranks start at 0.Missing values are sorted in their natural order, which means they end up all at one end (at the high ('bad') end)
- Type Parameters:
K
-- Parameters:
m
-desc
- if true, the lowest (first) rank will be for the highest value.- Returns:
- A java.util.Map keys=old keys, values=java.lang.Double rank of the key. Non-integer values mean tie splits.
-