|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sjm.machlearn.util.Util
Class UTIL Contains some basic utilities that will be used by other classes.
Constructor Summary | |
Util()
|
Method Summary | |
static int |
argmax(double[] a)
|
static int |
argmax(int[] a)
|
static int |
argmin(double[] a)
|
static double |
average(double[] values)
average() : averages the double values in the * array * |
static boolean |
copyTextFile(java.lang.String dest,
java.lang.String src)
|
static boolean |
createDir(java.lang.String directory)
|
static boolean |
deleteFile(java.lang.String file)
|
static boolean |
isLowMem()
|
static double |
log(double value,
double base)
|
static double |
max(double[] a)
|
static double |
max(double a,
double b)
|
static int |
max(int[] a)
|
static int |
max(int a,
int b)
max() : return the max of two integers. |
static double |
min(double[] a)
|
static double |
min(double a,
double b)
|
static int |
min(int a,
int b)
|
static java.lang.String |
padzeroleft(int value,
int digits)
|
static java.lang.String |
printArray(boolean[] a)
|
static java.lang.String |
printArray(double[] a)
|
static java.lang.String |
printArray(int[] a)
|
static boolean |
randomBoolean()
randomBoolean() returns a true or false value drawn pseudo-randomly. |
static boolean |
randomBoolean(double prob)
randomBoolean() * returns a true or false value determined by the * probability of a true value. |
static int |
randomInteger(double[] probs)
|
static int |
randomInteger(int min,
int max)
|
static int |
randomIntegerE(double[] probs)
randomIntegerE() : picks a random integer between array index 0 to the array length-1. |
static int[] |
randomIntList(int min,
int max)
|
static void |
randomizeDbl(double[] w,
double min,
double max)
|
static java.lang.String |
spliceString(java.lang.String[] sarray,
java.lang.String separator)
spliceString() : returns a string that is a splice of the strings in sarray separated by a separator. |
static java.lang.String |
stripPadding(java.lang.String line)
|
static double |
sum(double[] values)
sum() : sums the values in the array * |
static int |
sum(int[] values)
sum() : sums the values in the array * |
static void |
swap(boolean[] values,
int i,
int j)
swap() : swaps two boolean values in an array * |
static void |
swap(double[] values,
int i,
int j)
swap() : swaps two double values in an array * |
static void |
swap(int[] array,
int i,
int j)
|
static void |
writeText(java.lang.String filename,
java.lang.String text)
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Util()
Method Detail |
public static void randomizeDbl(double[] w, double min, double max)
public static int[] randomIntList(int min, int max)
public static void swap(double[] values, int i, int j)
values
- array to do the swapping *i
- 1st index for swap *j
- 2nd index for swap *public static void swap(boolean[] values, int i, int j)
values
- array to do the swapping *i
- 1st index for swap *j
- 2nd index for swap *public static int sum(int[] values)
values
- array to be summed *public static double sum(double[] values)
values
- array to be summed *public static double average(double[] values)
values
- double array of values to average *public static double log(double value, double base)
public static boolean randomBoolean()
public static boolean randomBoolean(double prob)
prob
- probability of a true value 0-1.0 *public static int max(int a, int b)
a
- 1st number *b
- 2nd number *public static double max(double a, double b)
public static int min(int a, int b)
public static double min(double a, double b)
public static double min(double[] a)
public static double max(double[] a)
public static int max(int[] a)
public static int argmax(int[] a)
public static int argmax(double[] a)
public static int argmin(double[] a)
public static java.lang.String printArray(int[] a)
public static java.lang.String printArray(double[] a)
public static java.lang.String printArray(boolean[] a)
public static int randomInteger(int min, int max)
public static int randomIntegerE(double[] probs)
public static int randomInteger(double[] probs)
public static void writeText(java.lang.String filename, java.lang.String text) throws java.io.IOException
public static java.lang.String padzeroleft(int value, int digits)
public static void swap(int[] array, int i, int j)
public static boolean copyTextFile(java.lang.String dest, java.lang.String src)
public static boolean createDir(java.lang.String directory)
public static boolean deleteFile(java.lang.String file)
public static java.lang.String spliceString(java.lang.String[] sarray, java.lang.String separator)
public static java.lang.String stripPadding(java.lang.String line)
public static boolean isLowMem()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |