Program: 32961
Project: 32961
Buggy source:
public static void main(String[] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Config config=new Config(args[0]);
  System.out.println(config);
  String matrixType=config.getString("String_Node_Str");
  MultiLabelClfDataSet trainSet;
  MultiLabelClfDataSet testSet;
switch (matrixType) {
case "String_Node_Str":
    trainSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_SPARSE,true);
  testSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_SPARSE,true);
break;
case "String_Node_Str":
trainSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_SEQ_SPARSE,true);
testSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_SEQ_SPARSE,true);
break;
case "String_Node_Str":
trainSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_DENSE,true);
testSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_DENSE,true);
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
String output=config.getString("String_Node_Str");
String modelName=config.getString("String_Node_Str");
File path=Paths.get(output,modelName).toFile();
path.mkdirs();
BMMClassifier bmmClassifier=BMMClassifier.deserialize(new File(path,"String_Node_Str"));
bmmClassifier.setPredictMode(config.getString("String_Node_Str"));
bmmClassifier.setAllowEmpty(config.getBoolean("String_Node_Str"));
System.out.println("String_Node_Str");
Set<MultiLabel> trainLabelSet=new HashSet<>();
Set<MultiLabel> testLabelSet=new HashSet<>();
for (MultiLabel multiLabel : trainSet.getMultiLabels()) {
trainLabelSet.add(multiLabel);
}
for (MultiLabel multiLabel : testSet.getMultiLabels()) {
testLabelSet.add(multiLabel);
}
Set<MultiLabel> newTestSet=SetUtil.complement(testLabelSet,trainLabelSet);
System.out.println("String_Node_Str" + newTestSet.size());
int newTestLabelCounts=0;
for (MultiLabel label : testSet.getMultiLabels()) {
if (newTestSet.contains(label)) {
newTestLabelCounts++;
}
}
System.out.println("String_Node_Str" + newTestLabelCounts);
System.out.println("String_Node_Str" + (double)newTestLabelCounts / testSet.getNumDataPoints());
MultiLabel[] trainPred;
MultiLabel[] testPred;
System.out.println("String_Node_Str");
trainPred=bmmClassifier.predict(trainSet);
testPred=bmmClassifier.predict(testSet);
int newPredTrueCount=0;
int newPredFalseCount=0;
for (int i=0; i < testPred.length; i++) {
MultiLabel label=testPred[i];
if (!trainLabelSet.contains(label) && label.equals(testSet.getMultiLabels()[i])) {
newPredTrueCount++;
}
if (!trainLabelSet.contains(label) && !label.equals(testSet.getMultiLabels()[i])) {
newPredFalseCount++;
}
}
int totalCount=newPredFalseCount + newPredTrueCount;
System.out.println("String_Node_Str" + totalCount);
System.out.println("String_Node_Str" + newPredTrueCount + "String_Node_Str"+ (double)newPredTrueCount / testSet.getNumDataPoints());
System.out.println("String_Node_Str" + newPredFalseCount + "String_Node_Str"+ (double)newPredFalseCount / testSet.getNumDataPoints());
System.out.println();
System.out.print("String_Node_Str" + Accuracy.accuracy(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Overlap.overlap(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Accuracy.accuracy(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println("String_Node_Str" + Overlap.overlap(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println();
System.out.println();
System.out.println("String_Node_Str");
trainPred=bmmClassifier.predict(trainSet,trainSet.getMultiLabels());
testPred=bmmClassifier.predict(testSet,trainSet.getMultiLabels());
System.out.println();
System.out.print("String_Node_Str" + Accuracy.accuracy(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Overlap.overlap(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Accuracy.accuracy(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println("String_Node_Str" + Overlap.overlap(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println();
System.out.println();
System.out.println("String_Node_Str");
trainPred=bmmClassifier.predict(trainSet,testSet.getMultiLabels());
testPred=bmmClassifier.predict(testSet,testSet.getMultiLabels());
System.out.println();
System.out.print("String_Node_Str" + Accuracy.accuracy(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Overlap.overlap(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Accuracy.accuracy(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println("String_Node_Str" + Overlap.overlap(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println();
System.out.println();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  if (args.length != 1) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Config config=new Config(args[0]);
  System.out.println(config);
  String matrixType=config.getString("String_Node_Str");
  MultiLabelClfDataSet trainSet;
  MultiLabelClfDataSet testSet;
switch (matrixType) {
case "String_Node_Str":
    trainSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_SPARSE,true);
  testSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_SPARSE,true);
break;
case "String_Node_Str":
trainSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_SEQ_SPARSE,true);
testSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_SEQ_SPARSE,true);
break;
case "String_Node_Str":
trainSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_DENSE,true);
testSet=TRECFormat.loadMultiLabelClfDataSet(config.getString("String_Node_Str"),DataSetType.ML_CLF_DENSE,true);
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
String output=config.getString("String_Node_Str");
String modelName=config.getString("String_Node_Str");
File path=Paths.get(output,modelName).toFile();
path.mkdirs();
BMMClassifier bmmClassifier=BMMClassifier.deserialize(new File(path,"String_Node_Str"));
bmmClassifier.setAllowEmpty(config.getBoolean("String_Node_Str"));
System.out.println("String_Node_Str");
Set<MultiLabel> trainLabelSet=new HashSet<>();
Set<MultiLabel> testLabelSet=new HashSet<>();
for (MultiLabel multiLabel : trainSet.getMultiLabels()) {
trainLabelSet.add(multiLabel);
}
for (MultiLabel multiLabel : testSet.getMultiLabels()) {
testLabelSet.add(multiLabel);
}
Set<MultiLabel> newTestSet=SetUtil.complement(testLabelSet,trainLabelSet);
System.out.println("String_Node_Str" + newTestSet.size());
int newTestLabelCounts=0;
for (MultiLabel label : testSet.getMultiLabels()) {
if (newTestSet.contains(label)) {
newTestLabelCounts++;
}
}
System.out.println("String_Node_Str" + newTestLabelCounts);
System.out.println("String_Node_Str" + (double)newTestLabelCounts / testSet.getNumDataPoints());
MultiLabel[] trainPred;
MultiLabel[] testPred;
System.out.println("String_Node_Str");
bmmClassifier.setPredictMode("String_Node_Str");
trainPred=bmmClassifier.predict(trainSet);
testPred=bmmClassifier.predict(testSet);
int newPredTrueCount=0;
int newPredFalseCount=0;
for (int i=0; i < testPred.length; i++) {
MultiLabel label=testPred[i];
if (!trainLabelSet.contains(label) && label.equals(testSet.getMultiLabels()[i])) {
newPredTrueCount++;
}
if (!trainLabelSet.contains(label) && !label.equals(testSet.getMultiLabels()[i])) {
newPredFalseCount++;
}
}
int totalCount=newPredFalseCount + newPredTrueCount;
System.out.println("String_Node_Str" + totalCount);
System.out.println("String_Node_Str" + newPredTrueCount + "String_Node_Str"+ (double)newPredTrueCount / testSet.getNumDataPoints());
System.out.println("String_Node_Str" + newPredFalseCount + "String_Node_Str"+ (double)newPredFalseCount / testSet.getNumDataPoints());
System.out.println();
System.out.print("String_Node_Str" + Accuracy.accuracy(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Overlap.overlap(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Accuracy.accuracy(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println("String_Node_Str" + Overlap.overlap(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println();
System.out.println();
System.out.println("String_Node_Str");
bmmClassifier.setPredictMode("String_Node_Str");
bmmClassifier.setNumSample(config.getInt("String_Node_Str"));
trainPred=bmmClassifier.predict(trainSet);
testPred=bmmClassifier.predict(testSet);
newPredTrueCount=0;
newPredFalseCount=0;
for (int i=0; i < testPred.length; i++) {
MultiLabel label=testPred[i];
if (!trainLabelSet.contains(label) && label.equals(testSet.getMultiLabels()[i])) {
newPredTrueCount++;
}
if (!trainLabelSet.contains(label) && !label.equals(testSet.getMultiLabels()[i])) {
newPredFalseCount++;
}
}
totalCount=newPredFalseCount + newPredTrueCount;
System.out.println("String_Node_Str" + totalCount);
System.out.println("String_Node_Str" + newPredTrueCount + "String_Node_Str"+ (double)newPredTrueCount / testSet.getNumDataPoints());
System.out.println("String_Node_Str" + newPredFalseCount + "String_Node_Str"+ (double)newPredFalseCount / testSet.getNumDataPoints());
System.out.println();
System.out.print("String_Node_Str" + Accuracy.accuracy(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Overlap.overlap(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Accuracy.accuracy(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println("String_Node_Str" + Overlap.overlap(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println();
System.out.println();
System.out.println("String_Node_Str");
trainPred=bmmClassifier.predict(trainSet,trainSet.getMultiLabels());
testPred=bmmClassifier.predict(testSet,trainSet.getMultiLabels());
System.out.println();
System.out.print("String_Node_Str" + Accuracy.accuracy(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Overlap.overlap(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Accuracy.accuracy(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println("String_Node_Str" + Overlap.overlap(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println();
System.out.println();
System.out.println("String_Node_Str");
trainPred=bmmClassifier.predict(trainSet,testSet.getMultiLabels());
testPred=bmmClassifier.predict(testSet,testSet.getMultiLabels());
System.out.println();
System.out.print("String_Node_Str" + Accuracy.accuracy(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Overlap.overlap(trainSet.getMultiLabels(),trainPred) + "String_Node_Str");
System.out.print("String_Node_Str" + Accuracy.accuracy(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println("String_Node_Str" + Overlap.overlap(testSet.getMultiLabels(),testPred) + "String_Node_Str");
System.out.println();
System.out.println();
}