public final class MeasureUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static double |
EPSILON
The precision value
|
| Constructor and Description |
|---|
MeasureUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
bubbleSort(double[] comparable,
double[] toSort)
Apply bubble sort to another (toSort) array based on the values (comparable) array which is also sorted
|
static void |
bubbleSort(double[] comparable,
int[] toSort)
Apply bubble sort to sort indices (toSort) array based on the values (comparable) array which is also sorted
|
static boolean[] |
constructComputable(double[][] vars)
Compute the missing value array for the matrix (samples x vars)
|
static long |
countOccurencies(double[][] vectors,
double[] frequencies,
boolean[] computable)
Compute the number of occurrences of each distinct value with a precision of EPSILON (consider integers).
|
static long |
countOccurencies(double[] vector,
double[] frequencies,
boolean hasMissing)
Compute the number of occurrences of each distinct value with a precision of EPSILON (consider integers).
|
static int |
countSwap(double[] comparable)
Apply bubble sort to the comparable array and count the number of swaps
|
static double |
fastMean(double[] vector,
boolean hasMissing)
Compute the mean by summing all elements of the vector in left-right manner
|
static double |
fastMean(double[] vector,
boolean[] computable)
Compute the mean by summing all elements of the vector in left-right manner
|
static double |
fastSum(double[] vector,
boolean[] computable)
Compute the sum by summing all elements of the vector in left-right manner
|
static double |
log(double value)
Compute the log, base e but return 0 if the value is less than EPSILON
|
static int |
naturalRank(boolean[] computable,
double[] vector,
double[] ranks)
Computed the natural rank of values
|
static int |
naturalRank(boolean[] computable,
double[] vector,
double[] ranks,
int[] untied)
Computed the natural rank of values
|
static double |
sqrt(double value)
Compute the square root value by using the formula exp(0.5*log(x)) <=> sqrt(x) in order to avoid underflow.
|
public static final double EPSILON
public static final double fastSum(double[] vector,
boolean[] computable)
vector - The data vectorcomputable - The boolean array which specifies if indexes must be takenpublic static final double fastMean(double[] vector,
boolean[] computable)
vector - The data vectorcomputable - The boolean array which specifies if indexes must be takenpublic static final double fastMean(double[] vector,
boolean hasMissing)
vector - The data vectorhasMissing - True if missing values are contained in the vectorpublic static void bubbleSort(double[] comparable,
int[] toSort)
comparable - The value arraytoSort - The indices arraypublic static void bubbleSort(double[] comparable,
double[] toSort)
comparable - The value arraytoSort - The other arraypublic static int countSwap(double[] comparable)
comparable - The value arraypublic static int naturalRank(boolean[] computable,
double[] vector,
double[] ranks)
computable - The boolean array which specifies if indexes must be takenvector - The data vector (values) to rankranks - The rank destination vector (must have the same size that the vector argument)public static int naturalRank(boolean[] computable,
double[] vector,
double[] ranks,
int[] untied)
computable - The boolean array which specifies if indexes must be takenvector - The data vector (values) to rankranks - The rank destination vector (must have the same size that the vector argument)untied - Copy the natural rank attribution without dealing with ties (sort index from 1 to length)public static boolean[] constructComputable(double[][] vars)
vars - The matrixpublic static final long countOccurencies(double[] vector,
double[] frequencies,
boolean hasMissing)
vector - The vector of valuesfrequencies - The occurrences matrix, 0 for NaN if hasMissing is true, 0 for redundant value
(because n times a same distinct value result in a occurrence value of n)hasMissing - if true, check for missing value in order to ignore thempublic static final long countOccurencies(double[][] vectors,
double[] frequencies,
boolean[] computable)
vectors - The matrix of values, have to be composed of two vectors of the same sizefrequencies - The occurrences matrix, 0 for NaN if hasMissing is true, 0 for redundant value
(because n times a same distinct value result in a occurrence value of n)computable - The vector of missing value for the vector indexespublic static double sqrt(double value)
value - The value for which the function compute the square rootpublic static double log(double value)
value - The value for which the function compute the square root