Ejemplo n.º 1
0
  /**
   * The purpose of this method is to parse the information that is listed in the learners
   * configuration file.
   *
   * @throws Exception
   */
  public static void ParseLearners() throws Exception {
    for (String line : FileUtilities.ReadLinesFromFile(LEARNER_TEMPLATES_FILE)) {
      if (line.startsWith("#") || line.trim().length() == 0) // Ignore comment characters
      continue;

      ArrayList<String> lineItems = ListUtilities.CreateStringList(line.split(";"));
      String description = lineItems.get(0);
      String learnerClassName = lineItems.get(1);
      String commandTemplate = (lineItems.size() > 2) ? lineItems.get(2) : "";

      LearnerConfigMap.put(
          description, new LearnerConfig(description, learnerClassName, commandTemplate));
    }
  }
Ejemplo n.º 2
0
  /**
   * The purpose of this method is to parse the algorithms that have been defined in the algorithm
   * configuration files.
   *
   * @throws Exception
   */
  public static void ParseAlgorithms() throws Exception {
    for (String line : FileUtilities.ReadLinesFromFile(CLASSIFICATION_ALGORITHMS_FILE)) {
      if (line.startsWith("#") || line.trim().length() == 0) // Ignore comment characters
      continue;

      ArrayList<String> lineItems = ListUtilities.CreateStringList(line.split(";"));
      String key = lineItems.remove(0);
      String learnerKey = lineItems.remove(0);

      CheckLearnerKey(key, learnerKey);
      ClassificationAlgorithms.put(key, new ClassificationAlgorithm(key, learnerKey, lineItems));
    }

    for (String line : FileUtilities.ReadLinesFromFile(FEATURE_SELECTION_ALGORITHMS_FILE)) {
      if (line.startsWith("#") || line.trim().length() == 0) // Ignore comment characters
      continue;

      ArrayList<String> lineItems = ListUtilities.CreateStringList(line.split(";"));

      String key = lineItems.remove(0);
      String learnerKey = lineItems.remove(0);
      ArrayList<String> parameters = lineItems;

      CheckLearnerKey(key, learnerKey);
      FeatureSelectionAlgorithms.put(
          key, new FeatureSelectionAlgorithm(key, learnerKey, parameters));
    }

    // The following algorithms are made available to any experiment and aren't specified in the
    // config file
    FeatureSelectionAlgorithms.put(
        "None", new FeatureSelectionAlgorithm("None", "", new ArrayList<String>()));
    FeatureSelectionAlgorithms.put(
        "PriorKnowledge",
        new FeatureSelectionAlgorithm("PriorKnowledge", "", new ArrayList<String>()));
  }