|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbe.ac.ulb.mlg.utils.MeasureUtils
public final class MeasureUtils
Field Summary | |
---|---|
static double |
EPSILON
The precision value |
Constructor Summary | |
---|---|
MeasureUtils()
|
Method Summary | |
---|---|
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 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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double EPSILON
Constructor Detail |
---|
public MeasureUtils()
Method Detail |
---|
public static final double fastSum(double[] vector, boolean[] computable)
vector
- The data vectorcomputable
- The boolean array which specifies if indexes must be taken
public static final double fastMean(double[] vector, boolean[] computable)
vector
- The data vectorcomputable
- The boolean array which specifies if indexes must be taken
public static final double fastMean(double[] vector, boolean hasMissing)
vector
- The data vectorhasMissing
- True if missing values are contained in the vector
public static void bubbleSort(double[] comparable, int[] toSort)
comparable
- The value arraytoSort
- The indices 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 matrix
public 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 them
public 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 indexes
public static double sqrt(double value)
value
- The value for which the function compute the square root
public static double log(double value)
value
- The value for which the function compute the square root
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |