Example #1
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));
  }
Example #2
0
  /**
   * It reads the data from the input files (training, validation and test) and parse all the
   * parameters from the parameters array.
   *
   * @param parameters parseParameters It contains the input files, output files and parameters
   */
  public Algorithm(parseParameters parameters) {

    train = new myDataset();
    val = new myDataset();
    test = new myDataset();
    try {
      System.out.println("\nReading the training set: " + parameters.getTrainingInputFile());
      train.readRegressionSet(parameters.getTrainingInputFile(), true);
      System.out.println("\nReading the validation set: " + parameters.getValidationInputFile());
      val.readRegressionSet(parameters.getValidationInputFile(), false);
      System.out.println("\nReading the test set: " + parameters.getTestInputFile());
      test.readRegressionSet(parameters.getTestInputFile(), false);
    } catch (IOException e) {
      System.err.println("There was a problem while reading the input data-sets: " + e);
      somethingWrong = true;
    }

    // We may check if there are some numerical attributes, because our algorithm may not handle
    // them:
    // somethingWrong = somethingWrong || train.hasNumericalAttributes();
    // somethingWrong = somethingWrong || train.hasMissingAttributes();

    outputTr = parameters.getTrainingOutputFile();
    outputTst = parameters.getTestOutputFile();
    outputBC = parameters.getOutputFile(0);

    // Now we parse the parameters, for example:
    semilla = Long.parseLong(parameters.getParameter(0));
    // ...
    tamPoblacion = Integer.parseInt(parameters.getParameter(1));
    numGeneraciones = Integer.parseInt(parameters.getParameter(2));
    numGenMigration = Integer.parseInt(parameters.getParameter(3));
    Nr = Integer.parseInt(parameters.getParameter(4));
    Nf = Integer.parseInt(parameters.getParameter(5));
    K = Integer.parseInt(parameters.getParameter(6));
    probMut = Double.parseDouble(parameters.getParameter(7));

    entradas = train.getnInputs();

    Poblacion = new ArrayList<Individual>(tamPoblacion);
    for (int i = 0; i < tamPoblacion; i++) {
      Individual indi = new Individual(entradas);
      Poblacion.add(indi);
    }

    Poblacion2 = new ArrayList<Individual>(tamPoblacion);
    Hijos = new ArrayList<Individual>(tamPoblacion / 2);
    SistemaDifuso = new ArrayList<Individual>(Nr);
    BestSistemaDifuso = new ArrayList<Individual>(Nr);

    vectorNr = new int[Nr];
  }
Example #3
0
  /**
   * It reads the data from the input files (training, validation and test) and parse all the
   * parameters from the parameters array.
   *
   * @param parameters parseParameters It contains the input files, output files and parameters
   */
  public DMEL(parseParameters parameters) {

    train = new myDataset();
    val = new myDataset();
    test = new myDataset();
    try {
      System.out.println("\nReading the training set: " + parameters.getTrainingInputFile());
      train.readClassificationSet(parameters.getTrainingInputFile(), true);
      System.out.println("\nReading the validation set: " + parameters.getValidationInputFile());
      val.readClassificationSet(parameters.getValidationInputFile(), false);
      System.out.println("\nReading the test set: " + parameters.getTestInputFile());
      test.readClassificationSet(parameters.getTestInputFile(), false);
    } catch (IOException e) {
      System.err.println("There was a problem while reading the input data-sets: " + e);
      somethingWrong = true;
    }

    // We may check if there are some numerical attributes, because our algorithm may not handle
    // them:
    somethingWrong = somethingWrong || train.hasRealAttributes();

    outputTr = parameters.getTrainingOutputFile();
    outputTst = parameters.getTestOutputFile();
    outputRule = parameters.getOutputFile(0);

    // Now we parse the parameters, for example:

    seed = Long.parseLong(parameters.getParameter(0));

    popSize = Integer.parseInt(parameters.getParameter(1));
    pCross = Double.parseDouble(parameters.getParameter(2));
    pMut = Double.parseDouble(parameters.getParameter(3));
    numGenerations = Integer.parseInt(parameters.getParameter(4));

    // ...
  }