public class Safe_Level_SMOTE extends Metodo
File: Safe_Level_SMOTE.java
The Safe Level SMOTE algorithm is an oversampling method used to deal with the imbalanced problem.clasesTest, clasesTrain, datosTest, datosTrain, distanceEu, entradas, ficheroSalida, ficheroTest, ficheroTraining, ficheroValidation, nEntradas, nominalDistance, nominalTrain, nulosTrain, realTest, realTrain, relation, salida, stdDev, test, training
Constructor and Description |
---|
Safe_Level_SMOTE(java.lang.String ficheroScript)
Constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
static int |
evaluationKNNClass(int nvec,
double[][] conj,
double[][] real,
int[][] nominal,
boolean[][] nulos,
int[] clases,
double[] ejemplo,
double[] ejReal,
int[] ejNominal,
boolean[] ejNulos,
int nClases,
boolean distance,
int[] vecinos,
int clase)
Computes the k nearest neighbors of a given item belonging to a fixed class.
|
void |
leerConfiguracion(java.lang.String ficheroScript)
Obtains the parameters used in the execution of the algorithm and stores
them in the private variables of the class
|
protected void |
normalizar()
This function builds the data matrix for reference data and normalizes inputs values
|
void |
run()
The main method of the class that includes the operations of the algorithm.
|
public Safe_Level_SMOTE(java.lang.String ficheroScript)
Constructor of the class. It configures the execution of the algorithm by reading the configuration script that indicates the parameters that are going to be used.
ficheroScript
- Name of the configuration script that indicates the
parameters that are going to be used during the execution of the algorithmpublic void run()
The main method of the class that includes the operations of the algorithm. It includes all the operations that the algorithm has and finishes when it writes the output information into files.
public static int evaluationKNNClass(int nvec, double[][] conj, double[][] real, int[][] nominal, boolean[][] nulos, int[] clases, double[] ejemplo, double[] ejReal, int[] ejNominal, boolean[] ejNulos, int nClases, boolean distance, int[] vecinos, int clase)
Computes the k nearest neighbors of a given item belonging to a fixed class. With that neighbors a suggested class for the item is returned.
nvec
- Number of nearest neighbors that are going to be searchedconj
- Matrix with the data of all the items in the datasetreal
- Matrix with the data associated to the real attributes of the datasetnominal
- Matrix with the data associated to the nominal attributes of the datasetnulos
- Matrix with the data associated to the missing values of the datasetclases
- Array with the associated class for each item in the datasetejemplo
- Array with the data of the specific item in the dataset used
as a reference in the nearest neighbor searchejReal
- Array with the data of the real attributes of the specific item in the datasetejNominal
- Array with the data of the nominal attributes of the specific item in the datasetejNulos
- Array with the data of the missing values of the specific item in the datasetnClases
- Class of the specific item in the datasetdistance
- Kind of distance used in the nearest neighbors computation.
If true the distance used is the euclidean, if false the HVMD distance is usedvecinos
- Array that will have the nearest neighbours id for the current specific itemclase
- Class of the neighbours searched for the itempublic void leerConfiguracion(java.lang.String ficheroScript)
Obtains the parameters used in the execution of the algorithm and stores them in the private variables of the class
leerConfiguracion
in class Metodo
ficheroScript
- Name of the configuration script that indicates the
parameters that are going to be used during the execution of the algorithmprotected void normalizar() throws CheckException
normalizar
in class Metodo
CheckException
- Can not be normalized