Class Helper
java.lang.Object
si.ijs.kt.clus.ext.semisupervised.Helper
Some handy functions
- Author:
- jurical
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
arrayToString
(double[] array) Return the values of an array in a comma separated stringstatic String
arrayToString
(double[] array, String sep) Return the values of an array in a string separatedsep
static String
arrayToString
(String[] array, String sep) Return the values of an array in a string separatedsep
static String
arrayToString
(IndiceValuePair[] array, String sep) Return the values of an array in a string separatedsep
static double
average
(double[] values) Calculates average of an array of valuesstatic double
averageIgnoreZeros
(double[] values) static double[]
getArrayOfSecond
(DoublesPair[] dpArrray) Return array containing just the second values of the DoublePairs arraystatic double
getMean
(double[] data) static double
getStdDev
(double[] data) corrected sample standard deviationstatic double
getVariance
(double[] data) static IndiceValuePair[]
greatestKelements
(double[] myArray, int K) Returns K greatest elements of an array, together with indicesstatic IndiceValuePair[]
leastKelements
(double[] myArray, int K) Returns K least elements of an array, together with indicesstatic double
max
(double[] values) Calculates maximum of an array of valuesstatic double
median
(double[] data) static double
min
(double[] values) Calculates minimum of an array of valuesstatic void
printArray
(double[] array) static void
printArray
(DoublesPair[] array) Prints arraystatic double
stDevOpt
(double[] a) Calculates standard deviation IMPORTANT: this implementation is buggy, it returns Double.NaN, when stdDev should be 0static double
sum
(double[] values) Calculates sum of an array of values
-
Constructor Details
-
Helper
public Helper()
-
-
Method Details
-
average
public static double average(double[] values) Calculates average of an array of values -
averageIgnoreZeros
public static double averageIgnoreZeros(double[] values) -
min
public static double min(double[] values) Calculates minimum of an array of values -
sum
public static double sum(double[] values) Calculates sum of an array of values -
max
public static double max(double[] values) Calculates maximum of an array of values -
arrayToString
Return the values of an array in a comma separated string- Parameters:
array
-
-
arrayToString
Return the values of an array in a string separatedsep
- Parameters:
array
-sep
- separator
-
arrayToString
Return the values of an array in a string separatedsep
- Parameters:
array
-sep
- separator
-
arrayToString
Return the values of an array in a string separatedsep
- Parameters:
array
-sep
- separator
-
stDevOpt
public static double stDevOpt(double[] a) Calculates standard deviation IMPORTANT: this implementation is buggy, it returns Double.NaN, when stdDev should be 0 -
getArrayOfSecond
Return array containing just the second values of the DoublePairs array -
printArray
Prints array- Parameters:
array
-
-
printArray
public static void printArray(double[] array) -
getMean
public static double getMean(double[] data) -
getVariance
public static double getVariance(double[] data) -
getStdDev
public static double getStdDev(double[] data) corrected sample standard deviation- Parameters:
data
-
-
median
public static double median(double[] data) -
leastKelements
Returns K least elements of an array, together with indices- Parameters:
myArray
- array may contain Double.NaN, such elements of arrray are ignoredK
-- Returns:
- array of K least elements (index,value pairs) of an input array
-
greatestKelements
Returns K greatest elements of an array, together with indices- Parameters:
myArray
-K
-- Returns:
- array of K greatest elements (index,value pairs) of an input array
-