Example #1
0
 /**
  * Calls the SubProcessWrapper using the given arguments
  *
  * @param args Any arguments.
  */
 public static void main(String[] args) {
   SubProcessWrapper wrapper = new SubProcessWrapper();
   try {
     wrapper.run(args);
   } catch (Exception e) {
     System.exit(1);
   }
   System.exit(0);
 }
  @DoInBackground(indeterminateProgress = true, cancelable = false)
  public void makePredictions(BackgroundEvent evt) {
    // Go grab the experiment, and see what stuff we should end up loading
    try {
      // Get the model
      File modelFile =
          new File(
              mExperimentText.getText()
                  + File.separator
                  + "trained."
                  + mSelectedSeedLabel.getText()
                  + ".model");
      if (!modelFile.exists()) {
        Properties props = new Properties();
        String seed = mSelectedSeedLabel.getText();
        File experimentDir = new File(mExperimentText.getText());
        props.put("modelOutputFilePrefix", experimentDir.getAbsolutePath() + "/trained." + seed);
        SubProcessWrapper.getErrorAndTime(
            experimentDir,
            Experiment.createFromFolder(experimentDir),
            "default",
            mBest.rawArgs,
            seed,
            props);
      }

      File attribSelectFile =
          new File(
              mExperimentText.getText()
                  + File.separator
                  + "trained."
                  + mSelectedSeedLabel.getText()
                  + ".attributeselection");
      String attribSelectPath = null;
      if (attribSelectFile.exists()) attribSelectPath = attribSelectFile.getAbsolutePath();

      File tmpFile = File.createTempFile("predictions", ".tmp");
      tmpFile.deleteOnExit();
      TrainedModelPredictionMaker tmpm =
          new TrainedModelPredictionMaker(
              attribSelectPath,
              modelFile.getAbsolutePath(),
              mTestingSetText.getText(),
              "last",
              tmpFile.getAbsolutePath());

      ResultsWindow resWindow = new ResultsWindow(tmpm.eval.toSummaryString(), tmpFile);
      resWindow.setVisible(true);
    } catch (Exception e) {
      UIUtil.showExceptionDialog(this, "Failed to get predictions", e);
    }
  }