Пример #1
0
 /** It reads the configuration file for performing the EUS-CHC method */
 public void readConfiguration(String ficheroScript) {
   parseParameters param = new parseParameters();
   param.parseConfigurationFile(ficheroScript);
   ficheroTraining = param.getTrainingInputFile();
   ficheroTest = param.getTestInputFile();
   ficheroSalida = new String[2];
   ficheroSalida[0] = param.getTrainingOutputFile();
   ficheroSalida[1] = param.getTestOutputFile();
   int i = 0;
   seed = Long.parseLong(param.getParameter(i++));
   popSize = Integer.parseInt(param.getParameter(i++));
   nEval = Integer.parseInt(param.getParameter(i++));
   r = Double.parseDouble(param.getParameter(i++));
   prob0to1Rec = Double.parseDouble(param.getParameter(i++));
   prob0to1Div = Double.parseDouble(param.getParameter(i++));
   wrapper = param.getParameter(i++);
   k = Integer.parseInt(param.getParameter(i++));
   distanceEu = param.getParameter(i++).equalsIgnoreCase("Euclidean") ? true : false;
   evMeas = param.getParameter(i++);
   if (param.getParameter(i++).equalsIgnoreCase("majority_selection")) majSelection = true;
   else majSelection = false;
   if (param.getParameter(i++).equalsIgnoreCase("EBUS")) pFactor = true;
   else pFactor = false;
   P = Double.parseDouble(param.getParameter(i++));
   hybrid = param.getParameter(i++);
   kSMOTE = Integer.parseInt(param.getParameter(i++));
   if (param.getParameter(i).equalsIgnoreCase("both")) ASMO = 0;
   else if (param.getParameter(i).equalsIgnoreCase("minority")) ASMO = 1;
   else ASMO = 2;
   i++;
   if (param.getParameter(i++).equalsIgnoreCase("YES")) balance = true;
   else balance = false;
   smoting = Double.parseDouble(param.getParameter(i++));
 }
Пример #2
0
  /**
   * Obtains the parameters used in the execution of the algorithm and stores them in the private
   * variables of the class
   *
   * @param ficheroScript Name of the configuration script that indicates the parameters that are
   *     going to be used during the execution of the algorithm
   */
  public void leerConfiguracion(String ficheroScript) {

    String fichero, linea, token;
    StringTokenizer lineasFichero, tokens;
    byte line[];
    int i, j;

    ficheroSalida = new String[2];

    fichero = Fichero.leeFichero(ficheroScript);
    lineasFichero = new StringTokenizer(fichero, "\n\r");

    lineasFichero.nextToken();
    linea = lineasFichero.nextToken();

    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    token = tokens.nextToken();

    /*Getting the names of the training and test files*/
    line = token.getBytes();
    for (i = 0; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroTraining = new String(line, i, j - i);
    for (i = j + 1; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroTest = new String(line, i, j - i);

    /*Getting the path and base name of the results files*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    token = tokens.nextToken();

    /*Getting the names of output files*/
    line = token.getBytes();
    for (i = 0; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroSalida[0] = new String(line, i, j - i);
    for (i = j + 1; line[i] != '\"'; i++) ;
    i++;
    for (j = i; line[j] != '\"'; j++) ;
    ficheroSalida[1] = new String(line, i, j - i);

    /*Getting the seed*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    semilla = Long.parseLong(tokens.nextToken().substring(1));

    /*Getting the number of neighbors*/
    linea = lineasFichero.nextToken();
    tokens = new StringTokenizer(linea, "=");
    tokens.nextToken();
    k = Integer.parseInt(tokens.nextToken().substring(1));
  }
Пример #3
0
  private void config_read(String fileParam) {
    parseParameters parameters;
    parameters = new parseParameters();
    parameters.parseConfigurationFile(fileParam);
    input_train_name = parameters.getTrainingInputFile();
    // input_validation_name = parameters.getValidationInputFile();
    input_test_name = parameters.getTestInputFile();

    output_train_name = parameters.getTrainingOutputFile();
    output_test_name = parameters.getTestOutputFile();

    seed = Long.parseLong(parameters.getParameter(0));
    kernelType = parameters.getParameter(1);
    C = Double.parseDouble(parameters.getParameter(2));
    eps = Double.parseDouble(parameters.getParameter(3));
    degree = Integer.parseInt(parameters.getParameter(4));
    gamma = Double.parseDouble(parameters.getParameter(5));
    coef0 = Double.parseDouble(parameters.getParameter(6));
    nu = Double.parseDouble(parameters.getParameter(7));
    p = Double.parseDouble(parameters.getParameter(8));
    shrinking = Integer.parseInt(parameters.getParameter(9));
  }
Пример #4
0
 /**
  * obtain a long value from the parameter file
  *
  * @param s is the StringTokenizer
  */
 private long getParamLong(StringTokenizer s) {
   String val = s.nextToken();
   val = s.nextToken();
   return Long.parseLong(val);
 }