Beispiel #1
0
  /** Method interface for Automatic Branch and Bound */
  public void ejecutar() {
    String resultado;
    int i, numFeatures;
    Date d;

    d = new Date();
    resultado =
        "RESULTS generated at "
            + String.valueOf((Date) d)
            + " \n--------------------------------------------------\n";
    resultado += "Algorithm Name: " + params.nameAlgorithm + "\n";

    /* call of ABB algorithm */
    runABB();

    resultado += "\nPARTITION Filename: " + params.trainFileNameInput + "\n---------------\n\n";
    resultado += "Features selected: \n";

    for (i = numFeatures = 0; i < features.length; i++)
      if (features[i] == true) {
        resultado += Attributes.getInputAttribute(i).getName() + " - ";
        numFeatures++;
      }

    resultado +=
        "\n\n"
            + String.valueOf(numFeatures)
            + " features of "
            + Attributes.getInputNumAttributes()
            + "\n\n";

    resultado +=
        "Error in test (using train for prediction): "
            + String.valueOf(data.validacionCruzada(features))
            + "\n";
    resultado +=
        "Error in test (using test for prediction): "
            + String.valueOf(data.LVOTest(features))
            + "\n";

    resultado += "---------------\n";

    System.out.println("Experiment completed successfully");

    /* creates the new training and test datasets only with the selected features */
    Files.writeFile(params.extraFileNameOutput, resultado);
    data.generarFicherosSalida(params.trainFileNameOutput, params.testFileNameOutput, features);
  }
Beispiel #2
0
  /**
   * Creates a boolean array with all values to true
   *
   * @return returns a boolean vector with all values to true
   */
  private boolean[] startSolution() {
    boolean fv[];

    fv = new boolean[Attributes.getInputNumAttributes()];

    for (int i = 0; i < fv.length; i++) fv[i] = true;

    return fv;
  }