示例#1
0
文件: Main.java 项目: micyee/granada
  /** @param args the command line arguments */
  public static void main(String[] args) {
    ParserParameters.doParse(args[0]);
    LogManager.initLogManager();

    InstanceSet is = new InstanceSet();
    try {
      is.readSet(Parameters.trainInputFile, true);
    } catch (Exception e) {
      LogManager.printErr(e.toString());
      System.exit(1);
    }
    checkDataset();

    Discretizer dis;
    String name = Parameters.algorithmName;
    dis = new FayyadDiscretizer();
    dis.buildCutPoints(is);
    dis.applyDiscretization(Parameters.trainInputFile, Parameters.trainOutputFile);
    dis.applyDiscretization(Parameters.testInputFile, Parameters.testOutputFile);
    LogManager.closeLog();
  }
示例#2
0
 static void checkDataset(InstanceSet is) {
   Attribute[] outputs = Attributes.getOutputAttributes();
   if (outputs.length != 1) {
     LogManager.printErr("Only datasets with one output are supported");
     System.exit(1);
   }
   if (outputs[0].getType() != Attribute.NOMINAL) {
     LogManager.printErr("Output attribute should be nominal");
     System.exit(1);
   }
   Parameters.numClasses = outputs[0].getNumNominalValues();
   Parameters.numAttributes = Attributes.getInputAttributes().length;
   Parameters.numInstances = is.getNumInstances();
 }