public class RBFUtils
extends java.lang.Object
Offers several utilities
| Constructor and Description |
|---|
RBFUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
array2string(double[] _a)
Creates a string from an array of doubles
|
static double |
avegDistance(double[][] _values)
Computes the average distance between vectors in a double[][]
|
static void |
createOutputFile(java.lang.String _origin,
java.lang.String _destiny)
Creates an output file following Keel rules: the header of the training/test file must be written into
the result file.
|
static double |
euclidean(double[] _a,
double[] _b)
Computes the euclidean distance between two vector of doubles with equal size.
|
static double |
geomDistance(double[] center,
int nCenter,
double[][] _values)
Computes the geometric mean of the distance between the given center and the 2 nearest vectors in a double[][]
|
static boolean |
getVerbosity()
Returns verbosity value
|
static double |
maxDistance(double[][] _values)
Computes the maximun distance between vectors in a double[][]
|
static int |
maxInVector(double[] _vector)
Returns the index of the higher value
|
static double[] |
medVect(double[][] v)
Computes the average of the rows of matrix v
|
static java.util.Hashtable |
parameters(java.lang.String fileName)
Reads a text file with parameters of the form name=value and returns a hastable containing them.
|
static void |
printArray(double[] _a)
Prints on console the elements of a double array.
|
static double |
RMSDistance(double[] center,
int nCenter,
double[][] _values,
int N)
Computes the RMSdistance between the given center and the n nearest vectors in a double[][]
|
static boolean |
setVerbosity(boolean _value)
Sets verbosity value from a given value
|
static boolean |
setVerbosity(java.util.Hashtable _hashtable)
Sets verbosity value from hashtable containing parameters
|
static double[] |
vector2doubles(java.util.Vector _v)
Turns vector of strings into a double array.
|
static double[] |
vector2Input(java.util.Vector _v,
int _inpDim)
Turns vector of strings into a double array containing only the inputs
|
static void |
vector2InputOutput(java.util.Vector _v,
int _inpDim,
double[] _input,
double[] _output)
Turns vector of strings into two double arrays, one for inputs and other for outputs.
|
static double[] |
vector2Output(java.util.Vector _v,
int _outDim)
Turns vector of strings into a double array containing only the outputs
|
static void |
verbose(java.lang.String _cad)
Prints the parameter without adding new line only if verbosity has been set to True.
|
static void |
verboseln(java.lang.String _cad)
Prints the parameter and adds a new line only if verbosity has been set to True.
|
public static boolean setVerbosity(java.util.Hashtable _hashtable)
Sets verbosity value from hashtable containing parameters
_hashtable - The hashtable containing the parameters.public static boolean setVerbosity(boolean _value)
Sets verbosity value from a given value
_value - True or falsepublic static boolean getVerbosity()
Returns verbosity value
public static void verbose(java.lang.String _cad)
Prints the parameter without adding new line only if verbosity has been set to True.
_cad - Parameter to be printed.public static void verboseln(java.lang.String _cad)
Prints the parameter and adds a new line only if verbosity has been set to True.
_cad - Parameter to be printed.public static double[] vector2doubles(java.util.Vector _v)
Turns vector of strings into a double array.
_v - The vectorpublic static void vector2InputOutput(java.util.Vector _v,
int _inpDim,
double[] _input,
double[] _output)
throws java.io.IOException
Turns vector of strings into two double arrays, one for inputs and other for outputs. It returns _input and _output because they change their values.
_v - The vector_inpDim - Input dimension_input - Array in which INPUT values are returned_output - Array in which OUTPUT values are returnedjava.io.IOException - if the dimension of inputs or outputs is 0public static double[] vector2Input(java.util.Vector _v,
int _inpDim)
throws java.io.IOException
Turns vector of strings into a double array containing only the inputs
_v - The vector_inpDim - Input dimensionjava.io.IOException - if the dimension of inputs is 0public static double[] vector2Output(java.util.Vector _v,
int _outDim)
throws java.io.IOException
Turns vector of strings into a double array containing only the outputs
_v - The vector_outDim - Output dimensionjava.io.IOException - if the dimension of outputs is 0public static void printArray(double[] _a)
Prints on console the elements of a double array.
_a - The arraypublic static java.lang.String array2string(double[] _a)
Creates a string from an array of doubles
_a - The arraypublic static double euclidean(double[] _a,
double[] _b)
Computes the euclidean distance between two vector of doubles with equal size.
_a - First vector_b - Second vectorpublic static double[] medVect(double[][] v)
Computes the average of the rows of matrix v
v - The matrixpublic static double maxDistance(double[][] _values)
Computes the maximun distance between vectors in a double[][]
_values - The array containing the vectorspublic static double avegDistance(double[][] _values)
Computes the average distance between vectors in a double[][]
_values - The array containing the vectorspublic static double geomDistance(double[] center,
int nCenter,
double[][] _values)
Computes the geometric mean of the distance between the given center and the 2 nearest vectors in a double[][]
center - centers given.nCenter - number of centers_values - The array containing the vectorspublic static double RMSDistance(double[] center,
int nCenter,
double[][] _values,
int N)
Computes the RMSdistance between the given center and the n nearest vectors in a double[][]
center - centers given._values - The array containing the vectorsnCenter - number of centersN - number of nearest elementspublic static java.util.Hashtable parameters(java.lang.String fileName)
Reads a text file with parameters of the form name=value and returns a hastable containing them.
fileName - Name of the file containing the parameters.public static void createOutputFile(java.lang.String _origin,
java.lang.String _destiny)
Creates an output file following Keel rules: the header of the training/test file must be written into the result file.
_origin - Name of the training/test file_destiny - Name of the output filepublic static int maxInVector(double[] _vector)
Returns the index of the higher value
_vector - Vector the datos in which higer values will be find