Ejemplo n.º 1
0
  private void SaveCrossValidationAssignments() throws Exception {
    String outerFoldsFilePath =
        Settings.GetOutputSettingsDir(true) + "Validation_Assignments_for_Outer_Folds.txt";

    FileUtilities.WriteTextToFile(
        outerFoldsFilePath,
        "# The outer cross-validation fold to which each data instance was assigned.\n");
    FileUtilities.AppendTextToFile(
        outerFoldsFilePath, Singletons.InstanceVault.GetCrossValidationAssignments().toString());

    if (Singletons.InstanceVault.GetCrossValidationAssignments().NumFolds
        != Singletons.InstanceVault.TransformedDependentVariableInstances.Size())
      for (int outerFold :
          Singletons.InstanceVault.GetCrossValidationAssignments().GetAllFoldNumbers()) {
        String innerFoldFilePath =
            Settings.GetOutputSettingsDir(true)
                + "Validation_Assignments_for_Inner_Folds_in_OuterFold_"
                + outerFold
                + ".txt";
        FileUtilities.WriteTextToFile(
            innerFoldFilePath,
            "# The inner cross-validation fold (within outer fold "
                + outerFold
                + ") to which data instances were assigned.\n");
        FileUtilities.AppendTextToFile(
            innerFoldFilePath,
            Singletons.InstanceVault.GetCrossValidationAssignments()
                .GetInnerAssignments(outerFold)
                .toString());
      }
  }
Ejemplo n.º 2
0
  /**
   * This method saves various description files to the output. These tasks are quick to execute, so
   * they are grouped together rather than parallelized.
   *
   * @throws Exception
   */
  public void SaveExperimentDescriptionFiles() throws Exception {
    // Save the version file in output so people know which version was used
    FileUtilities.CopyFile(
        Settings.VERSION_FILE, Settings.GetOutputSettingsDir(false) + Settings.VERSION_FILE);

    // Copy the experiment file
    FileUtilities.WriteLineToFile(
        Settings.GetOutputSettingsDir(false) + "Experiment_Settings.txt",
        "# All settings used in this experiment, whether explicitly set or used by default in the absence of an explicit setting");
    FileUtilities.AppendTextToFile(
        Settings.GetOutputSettingsDir(false) + "Experiment_Settings.txt",
        Singletons.Config.toString());

    if (Settings.NeedToClassify()) {
      // Copy the algorithm configuration files
      FileUtilities.CopyFile(
          Settings.LEARNER_TEMPLATES_FILE,
          Settings.GetOutputSettingsDir(false)
              + new File(Settings.LEARNER_TEMPLATES_FILE).getName());

      // Copy the algorithm configuration files
      FileUtilities.CopyFile(
          Settings.CLASSIFICATION_ALGORITHMS_FILE,
          Settings.GetOutputSettingsDir(false)
              + new File(Settings.CLASSIFICATION_ALGORITHMS_FILE).getName());

      if (Settings.NeedToSelectFeatures())
        FileUtilities.CopyFile(
            Settings.FEATURE_SELECTION_ALGORITHMS_FILE,
            Settings.GetOutputSettingsDir(false)
                + new File(Settings.FEATURE_SELECTION_ALGORITHMS_FILE).getName());

      SaveExcludedTrainingIDInfo();
      SaveCrossValidationAssignments();
    }
  }