Program: 20214
Project: 20214
Buggy source:
public static void main(String[] args) throws bsh.EvalError, java.io.IOException {
  CommandOption.setSummary(Vectors2Classify.class,"String_Node_Str");
  CommandOption.process(Vectors2Classify.class,args);
  if (!trainerConstructor.wasInvoked()) {
    classifierTrainers.add(new NaiveBayesTrainer());
  }
  if (!report.wasInvoked()) {
    report.postParsing(null);
  }
  int verbosity=verbosityOption.value;
  Logger rootLogger=((MalletLogger)progressLogger).getRootLogger();
  if (verbosityOption.wasInvoked()) {
    rootLogger.setLevel(MalletLogger.LoggingLevels[verbosity]);
  }
  if (noOverwriteProgressMessagesOption.value == false) {
    Handler[] handlers=rootLogger.getHandlers();
    for (int i=0; i < handlers.length; i++) {
      if (handlers[i] instanceof ConsoleHandler) {
        handlers[i].setFormatter(new ProgressMessageLogFormatter());
      }
    }
  }
  boolean separateIlists=testFile.wasInvoked() || trainingFile.wasInvoked() || validationFile.wasInvoked();
  InstanceList ilist=null;
  InstanceList testFileIlist=null;
  InstanceList trainingFileIlist=null;
  InstanceList validationFileIlist=null;
  if (!separateIlists) {
    ilist=InstanceList.load(new File(inputFile.value));
  }
 else {
    trainingFileIlist=InstanceList.load(new File(trainingFile.value));
    logger.info("String_Node_Str" + trainingFile.value);
    if (testFile.wasInvoked()) {
      testFileIlist=InstanceList.load(new File(testFile.value));
      logger.info("String_Node_Str" + testFile.value);
    }
    if (validationFile.wasInvoked()) {
      validationFileIlist=InstanceList.load(new File(validationFile.value));
      logger.info("String_Node_Str" + validationFile.value);
    }
  }
  int numTrials=numTrialsOption.value;
  Random r=randomSeedOption.wasInvoked() ? new Random(randomSeedOption.value) : new Random();
  ClassifierTrainer[] trainers=new ClassifierTrainer[classifierTrainers.size()];
  for (int i=0; i < classifierTrainers.size(); i++) {
    trainers[i]=(ClassifierTrainer)classifierTrainers.get(i);
    logger.fine("String_Node_Str" + trainers[i].toString());
  }
  double trainAccuracy[][]=new double[trainers.length][numTrials];
  double testAccuracy[][]=new double[trainers.length][numTrials];
  double validationAccuracy[][]=new double[trainers.length][numTrials];
  String trainConfusionMatrix[][]=new String[trainers.length][numTrials];
  String testConfusionMatrix[][]=new String[trainers.length][numTrials];
  String validationConfusionMatrix[][]=new String[trainers.length][numTrials];
  double t=trainingProportionOption.value;
  double v=validationProportionOption.value;
  if (!separateIlists) {
    logger.info("String_Node_Str" + t);
    logger.info("String_Node_Str" + unlabeledProportionOption.value);
    logger.info("String_Node_Str" + v);
    logger.info("String_Node_Str" + (1 - v - t));
  }
  for (int trialIndex=0; trialIndex < numTrials; trialIndex++) {
    System.out.println("String_Node_Str" + trialIndex + "String_Node_Str");
    InstanceList[] ilists;
    BitSet unlabeledIndices=null;
    if (!separateIlists) {
      ilists=ilist.split(r,new double[]{t,1 - t - v,v});
    }
 else {
      ilists=new InstanceList[3];
      ilists[0]=trainingFileIlist;
      ilists[1]=testFileIlist;
      ilists[2]=testFileIlist;
    }
    if (unlabeledProportionOption.value > 0)     unlabeledIndices=new cc.mallet.util.Randoms(r.nextInt()).nextBitSet(ilists[0].size(),unlabeledProportionOption.value);
    long time[]=new long[trainers.length];
    for (int c=0; c < trainers.length; c++) {
      time[c]=System.currentTimeMillis();
      System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ ilists[0].size()+ "String_Node_Str");
      if (unlabeledProportionOption.value > 0)       ilists[0].hideSomeLabels(unlabeledIndices);
      trainers[c].setValidationInstances(ilists[2]);
      Classifier classifier=trainers[c].train(ilists[0]);
      if (unlabeledProportionOption.value > 0)       ilists[0].unhideAllLabels();
      System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str");
      time[c]=System.currentTimeMillis() - time[c];
      Trial trainTrial=new Trial(classifier,ilists[0]);
      Trial testTrial=new Trial(classifier,ilists[1]);
      Trial validationTrial=new Trial(classifier,ilists[2]);
      if (ilists[0].size() > 0)       trainConfusionMatrix[c][trialIndex]=new ConfusionMatrix(trainTrial).toString();
      if (ilists[1].size() > 0)       testConfusionMatrix[c][trialIndex]=new ConfusionMatrix(testTrial).toString();
      if (ilists[2].size() > 0)       validationConfusionMatrix[c][trialIndex]=new ConfusionMatrix(validationTrial).toString();
      trainAccuracy[c][trialIndex]=trainTrial.getAccuracy();
      testAccuracy[c][trialIndex]=testTrial.getAccuracy();
      validationAccuracy[c][trialIndex]=validationTrial.getAccuracy();
      if (outputFile.wasInvoked()) {
        String filename=outputFile.value;
        if (trainers.length > 1)         filename=filename + trainers[c].toString();
        if (numTrials > 1)         filename=filename + "String_Node_Str" + trialIndex;
        try {
          ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream(filename));
          oos.writeObject(classifier);
          oos.close();
        }
 catch (        Exception e) {
          e.printStackTrace();
          throw new IllegalArgumentException("String_Node_Str" + filename);
        }
      }
      if (ReportOptions[ReportOption.train][ReportOption.raw]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString());
        System.out.println("String_Node_Str");
        printTrialClassification(trainTrial);
      }
      if (ReportOptions[ReportOption.test][ReportOption.raw]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString());
        System.out.println("String_Node_Str");
        printTrialClassification(testTrial);
      }
      if (ReportOptions[ReportOption.validation][ReportOption.raw]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString());
        System.out.println("String_Node_Str");
        printTrialClassification(validationTrial);
      }
      if (ReportOptions[ReportOption.train][ReportOption.confusion]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str");
        if (ilists[0].size() > 0)         System.out.println(trainConfusionMatrix[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.train][ReportOption.accuracy]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ trainAccuracy[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.train][ReportOption.f1]) {
        String label=ReportOptionArgs[ReportOption.train][ReportOption.f1];
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ label+ "String_Node_Str"+ trainTrial.getF1(label));
      }
      if (ReportOptions[ReportOption.validation][ReportOption.confusion]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str");
        if (ilists[2].size() > 0)         System.out.println(validationConfusionMatrix[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.validation][ReportOption.accuracy]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ validationAccuracy[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.validation][ReportOption.f1]) {
        String label=ReportOptionArgs[ReportOption.validation][ReportOption.f1];
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ label+ "String_Node_Str"+ validationTrial.getF1(label));
      }
      if (ReportOptions[ReportOption.test][ReportOption.confusion]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str");
        if (ilists[1].size() > 0)         System.out.println(testConfusionMatrix[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.test][ReportOption.accuracy]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ testAccuracy[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.test][ReportOption.f1]) {
        String label=ReportOptionArgs[ReportOption.test][ReportOption.f1];
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ label+ "String_Node_Str"+ testTrial.getF1(label));
      }
    }
  }
  for (int c=0; c < trainers.length; c++) {
    System.out.println("String_Node_Str" + trainers[c].toString());
    if (ReportOptions[ReportOption.train][ReportOption.accuracy])     System.out.println("String_Node_Str" + MatrixOps.mean(trainAccuracy[c]) + "String_Node_Str"+ MatrixOps.stddev(trainAccuracy[c])+ "String_Node_Str"+ MatrixOps.stderr(trainAccuracy[c]));
    if (ReportOptions[ReportOption.validation][ReportOption.accuracy])     System.out.println("String_Node_Str" + MatrixOps.mean(validationAccuracy[c]) + "String_Node_Str"+ MatrixOps.stddev(validationAccuracy[c])+ "String_Node_Str"+ MatrixOps.stderr(validationAccuracy[c]));
    if (ReportOptions[ReportOption.test][ReportOption.accuracy])     System.out.println("String_Node_Str" + MatrixOps.mean(testAccuracy[c]) + "String_Node_Str"+ MatrixOps.stddev(testAccuracy[c])+ "String_Node_Str"+ MatrixOps.stderr(testAccuracy[c]));
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws bsh.EvalError, java.io.IOException {
  CommandOption.setSummary(Vectors2Classify.class,"String_Node_Str");
  CommandOption.process(Vectors2Classify.class,args);
  if (!trainerConstructor.wasInvoked()) {
    classifierTrainers.add(new NaiveBayesTrainer());
  }
  if (!report.wasInvoked()) {
    report.postParsing(null);
  }
  int verbosity=verbosityOption.value;
  Logger rootLogger=((MalletLogger)progressLogger).getRootLogger();
  if (verbosityOption.wasInvoked()) {
    rootLogger.setLevel(MalletLogger.LoggingLevels[verbosity]);
  }
  if (noOverwriteProgressMessagesOption.value == false) {
    Handler[] handlers=rootLogger.getHandlers();
    for (int i=0; i < handlers.length; i++) {
      if (handlers[i] instanceof ConsoleHandler) {
        handlers[i].setFormatter(new ProgressMessageLogFormatter());
      }
    }
  }
  boolean separateIlists=testFile.wasInvoked() || trainingFile.wasInvoked() || validationFile.wasInvoked();
  InstanceList ilist=null;
  InstanceList testFileIlist=null;
  InstanceList trainingFileIlist=null;
  InstanceList validationFileIlist=null;
  if (!separateIlists) {
    ilist=InstanceList.load(new File(inputFile.value));
  }
 else {
    trainingFileIlist=InstanceList.load(new File(trainingFile.value));
    logger.info("String_Node_Str" + trainingFile.value);
    if (testFile.wasInvoked()) {
      testFileIlist=InstanceList.load(new File(testFile.value));
      logger.info("String_Node_Str" + testFile.value);
    }
    if (validationFile.wasInvoked()) {
      validationFileIlist=InstanceList.load(new File(validationFile.value));
      logger.info("String_Node_Str" + validationFile.value);
    }
  }
  int numTrials=numTrialsOption.value;
  Random r=randomSeedOption.wasInvoked() ? new Random(randomSeedOption.value) : new Random();
  ClassifierTrainer[] trainers=new ClassifierTrainer[classifierTrainers.size()];
  for (int i=0; i < classifierTrainers.size(); i++) {
    trainers[i]=classifierTrainers.get(i);
    logger.fine("String_Node_Str" + trainers[i].toString());
  }
  double trainAccuracy[][]=new double[trainers.length][numTrials];
  double testAccuracy[][]=new double[trainers.length][numTrials];
  double validationAccuracy[][]=new double[trainers.length][numTrials];
  String trainConfusionMatrix[][]=new String[trainers.length][numTrials];
  String testConfusionMatrix[][]=new String[trainers.length][numTrials];
  String validationConfusionMatrix[][]=new String[trainers.length][numTrials];
  double t=trainingProportionOption.value;
  double v=validationProportionOption.value;
  if (!separateIlists) {
    logger.info("String_Node_Str" + t);
    logger.info("String_Node_Str" + unlabeledProportionOption.value);
    logger.info("String_Node_Str" + v);
    logger.info("String_Node_Str" + (1 - v - t));
  }
  for (int trialIndex=0; trialIndex < numTrials; trialIndex++) {
    System.out.println("String_Node_Str" + trialIndex + "String_Node_Str");
    InstanceList[] ilists;
    BitSet unlabeledIndices=null;
    if (!separateIlists) {
      ilists=ilist.split(r,new double[]{t,1 - t - v,v});
    }
 else {
      ilists=new InstanceList[3];
      ilists[0]=trainingFileIlist;
      ilists[1]=testFileIlist;
      ilists[2]=validationFileIlist;
    }
    if (unlabeledProportionOption.value > 0)     unlabeledIndices=new cc.mallet.util.Randoms(r.nextInt()).nextBitSet(ilists[0].size(),unlabeledProportionOption.value);
    long time[]=new long[trainers.length];
    for (int c=0; c < trainers.length; c++) {
      time[c]=System.currentTimeMillis();
      System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ ilists[0].size()+ "String_Node_Str");
      if (unlabeledProportionOption.value > 0)       ilists[0].hideSomeLabels(unlabeledIndices);
      trainers[c].setValidationInstances(ilists[2]);
      Classifier classifier=trainers[c].train(ilists[0]);
      if (unlabeledProportionOption.value > 0)       ilists[0].unhideAllLabels();
      System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str");
      time[c]=System.currentTimeMillis() - time[c];
      Trial trainTrial=new Trial(classifier,ilists[0]);
      Trial testTrial=new Trial(classifier,ilists[1]);
      Trial validationTrial=new Trial(classifier,ilists[2]);
      if (ilists[0].size() > 0)       trainConfusionMatrix[c][trialIndex]=new ConfusionMatrix(trainTrial).toString();
      if (ilists[1].size() > 0)       testConfusionMatrix[c][trialIndex]=new ConfusionMatrix(testTrial).toString();
      if (ilists[2].size() > 0)       validationConfusionMatrix[c][trialIndex]=new ConfusionMatrix(validationTrial).toString();
      trainAccuracy[c][trialIndex]=trainTrial.getAccuracy();
      testAccuracy[c][trialIndex]=testTrial.getAccuracy();
      validationAccuracy[c][trialIndex]=validationTrial.getAccuracy();
      if (outputFile.wasInvoked()) {
        String filename=outputFile.value;
        if (trainers.length > 1)         filename=filename + trainers[c].toString();
        if (numTrials > 1)         filename=filename + "String_Node_Str" + trialIndex;
        try {
          ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream(filename));
          oos.writeObject(classifier);
          oos.close();
        }
 catch (        Exception e) {
          e.printStackTrace();
          throw new IllegalArgumentException("String_Node_Str" + filename);
        }
      }
      if (ReportOptions[ReportOption.train][ReportOption.raw]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString());
        System.out.println("String_Node_Str");
        printTrialClassification(trainTrial);
      }
      if (ReportOptions[ReportOption.test][ReportOption.raw]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString());
        System.out.println("String_Node_Str");
        printTrialClassification(testTrial);
      }
      if (ReportOptions[ReportOption.validation][ReportOption.raw]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString());
        System.out.println("String_Node_Str");
        printTrialClassification(validationTrial);
      }
      if (ReportOptions[ReportOption.train][ReportOption.confusion]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str");
        if (ilists[0].size() > 0)         System.out.println(trainConfusionMatrix[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.train][ReportOption.accuracy]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ trainAccuracy[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.train][ReportOption.f1]) {
        String label=ReportOptionArgs[ReportOption.train][ReportOption.f1];
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ label+ "String_Node_Str"+ trainTrial.getF1(label));
      }
      if (ReportOptions[ReportOption.validation][ReportOption.confusion]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str");
        if (ilists[2].size() > 0)         System.out.println(validationConfusionMatrix[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.validation][ReportOption.accuracy]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ validationAccuracy[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.validation][ReportOption.f1]) {
        String label=ReportOptionArgs[ReportOption.validation][ReportOption.f1];
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ label+ "String_Node_Str"+ validationTrial.getF1(label));
      }
      if (ReportOptions[ReportOption.test][ReportOption.confusion]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str");
        if (ilists[1].size() > 0)         System.out.println(testConfusionMatrix[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.test][ReportOption.accuracy]) {
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ testAccuracy[c][trialIndex]);
      }
      if (ReportOptions[ReportOption.test][ReportOption.f1]) {
        String label=ReportOptionArgs[ReportOption.test][ReportOption.f1];
        System.out.println("String_Node_Str" + trialIndex + "String_Node_Str"+ trainers[c].toString()+ "String_Node_Str"+ label+ "String_Node_Str"+ testTrial.getF1(label));
      }
    }
  }
  for (int c=0; c < trainers.length; c++) {
    System.out.println("String_Node_Str" + trainers[c].toString());
    if (ReportOptions[ReportOption.train][ReportOption.accuracy])     System.out.println("String_Node_Str" + MatrixOps.mean(trainAccuracy[c]) + "String_Node_Str"+ MatrixOps.stddev(trainAccuracy[c])+ "String_Node_Str"+ MatrixOps.stderr(trainAccuracy[c]));
    if (ReportOptions[ReportOption.validation][ReportOption.accuracy])     System.out.println("String_Node_Str" + MatrixOps.mean(validationAccuracy[c]) + "String_Node_Str"+ MatrixOps.stddev(validationAccuracy[c])+ "String_Node_Str"+ MatrixOps.stderr(validationAccuracy[c]));
    if (ReportOptions[ReportOption.test][ReportOption.accuracy])     System.out.println("String_Node_Str" + MatrixOps.mean(testAccuracy[c]) + "String_Node_Str"+ MatrixOps.stddev(testAccuracy[c])+ "String_Node_Str"+ MatrixOps.stderr(testAccuracy[c]));
  }
}