Beispiel #1
0
  public void train(int[] instanceLengths, String trainfile, File train_forest) throws IOException {

    // System.out.print("About to train. ");
    // System.out.print("Num Feats: " + pipe.dataAlphabet.size());

    int i = 0;
    for (i = 0; i < options.numIters; i++) {

      System.out.print(" Iteration " + i);
      // System.out.println("========================");
      // System.out.println("Iteration: " + i);
      // System.out.println("========================");
      System.out.print("[");

      long start = System.currentTimeMillis();

      trainingIter(instanceLengths, trainfile, train_forest, i + 1);

      long end = System.currentTimeMillis();
      // System.out.println("Training iter took: " + (end-start));
      System.out.println("|Time:" + (end - start) + "]");
    }

    params.averageParams(i * instanceLengths.length);
  }
Beispiel #2
0
  public void train(int[] instanceLengths, int[] ignore, String trainfile, File train_forest)
      throws IOException {

    int i = 0;
    for (i = 0; i < options.numIters; i++) {

      System.out.print(" Iteration " + i);
      System.out.print("[");

      long start = System.currentTimeMillis();

      trainingIter(instanceLengths, ignore, trainfile, train_forest, i + 1);

      long end = System.currentTimeMillis();
      // System.out.println("Training iter took: " + (end-start));
      System.out.println("|Time:" + (end - start) + "]");
    }
    params.averageParams(i * countActualInstances(ignore));
    //	 afm 06-04-08
    if (options.separateLab) {
      LabelClassifier oc =
          new LabelClassifier(
              options, instanceLengths, ignore, trainfile, train_forest, this, pipe);
      try {
        classifier = oc.trainClassifier(100);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }