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
  /** Recursive method for ABB */
  private void abb(boolean feat[]) {
    boolean[] child;
    double measure;

    threshold = data.measureIEP(feat);

    for (int i = 0; i < cardinalidadCto(feat); i++) {
      child = removeOne(feat, i);
      measure = data.measureIEP(child);

      if (legitimate(child) && measure < threshold) {
        if (measure < data.measureIEP(features)) {
          // we keep the best found in 'features'
          System.arraycopy(child, 0, features, 0, child.length);
        }
        abb(child);
      } else { // we prune this node
        pruned.add(child);
      }
    }
  }
Beispiel #3
0
  /** Creates a new instance of ABB */
  public ABB(String ficParametros) {

    /* loads the parameter file */
    params = new Parametros(ficParametros);

    Randomize.setSeed(params.seed);

    /* loads both of training and test datasets */
    data = new Datos(params.trainFileNameInput, params.testFileNameInput, params.paramKNN);

    features = new boolean[data.returnNumFeatures()];

    pruned = new Vector<boolean[]>();
  }