Program: 32914
Project: 32914
Buggy source:
static void report(Config config,String dataName,Logger logger) throws Exception {
  logger.info("String_Node_Str" + dataName);
  String output=config.getString("String_Node_Str");
  String modelName="String_Node_Str";
  File analysisFolder=new File(new File(output,"String_Node_Str"),dataName + "String_Node_Str");
  analysisFolder.mkdirs();
  FileUtils.cleanDirectory(analysisFolder);
  IMLGradientBoosting boosting=IMLGradientBoosting.deserialize(new File(output,modelName));
  String predictTarget=config.getString("String_Node_Str");
  PluginPredictor<IMLGradientBoosting> pluginPredictorTmp=null;
switch (predictTarget) {
case "String_Node_Str":
    pluginPredictorTmp=new SubsetAccPredictor(boosting);
  break;
case "String_Node_Str":
pluginPredictorTmp=new HammingPredictor(boosting);
break;
case "String_Node_Str":
pluginPredictorTmp=new InstanceF1Predictor(boosting);
break;
case "String_Node_Str":
TunedMarginalClassifier tunedMarginalClassifier=(TunedMarginalClassifier)Serialization.deserialize(new File(output,"String_Node_Str"));
pluginPredictorTmp=new MacroF1Predictor(boosting,tunedMarginalClassifier);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + predictTarget);
}
final PluginPredictor<IMLGradientBoosting> pluginPredictor=pluginPredictorTmp;
MultiLabelClfDataSet dataSet=loadData(config,dataName);
MLMeasures mlMeasures=new MLMeasures(pluginPredictor,dataSet);
mlMeasures.getMacroAverage().setLabelTranslator(boosting.getLabelTranslator());
logger.info("String_Node_Str" + dataName);
logger.info(mlMeasures.toString());
boolean simpleCSV=true;
if (simpleCSV) {
logger.info("String_Node_Str");
double probThreshold=config.getDouble("String_Node_Str");
File csv=new File(analysisFolder,"String_Node_Str");
List<String> strs=IntStream.range(0,dataSet.getNumDataPoints()).parallel().mapToObj(i -> IMLGBInspector.simplePredictionAnalysis(boosting,pluginPredictor,dataSet,i,probThreshold)).collect(Collectors.toList());
try (BufferedWriter bw=new BufferedWriter(new FileWriter(csv))){
for (int i=0; i < dataSet.getNumDataPoints(); i++) {
String str=strs.get(i);
bw.write(str);
}
}
 logger.info("String_Node_Str");
}
boolean rulesToJson=config.getBoolean("String_Node_Str");
if (rulesToJson) {
logger.info("String_Node_Str");
int ruleLimit=config.getInt("String_Node_Str");
int numDocsPerFile=config.getInt("String_Node_Str");
int numFiles=(int)Math.ceil((double)dataSet.getNumDataPoints() / numDocsPerFile);
double probThreshold=config.getDouble("String_Node_Str");
int labelSetLimit=config.getInt("String_Node_Str");
IntStream.range(0,numFiles).forEach(i -> {
int start=i * numDocsPerFile;
int end=start + numDocsPerFile;
List<MultiLabelPredictionAnalysis> partition=IntStream.range(start,Math.min(end,dataSet.getNumDataPoints())).parallel().mapToObj(a -> IMLGBInspector.analyzePrediction(boosting,pluginPredictor,dataSet,a,ruleLimit,labelSetLimit,probThreshold)).collect(Collectors.toList());
ObjectMapper mapper=new ObjectMapper();
String file="String_Node_Str" + (i + 1) + "String_Node_Str";
try {
mapper.writeValue(new File(analysisFolder,file),partition);
}
 catch (IOException e) {
e.printStackTrace();
}
logger.info("String_Node_Str" + Progress.percentage(i + 1,numFiles));
}
);
logger.info("String_Node_Str");
}
boolean dataInfoToJson=true;
if (dataInfoToJson) {
logger.info("String_Node_Str");
Set<String> modelLabels=IntStream.range(0,boosting.getNumClasses()).mapToObj(i -> boosting.getLabelTranslator().toExtLabel(i)).collect(Collectors.toSet());
Set<String> dataSetLabels=DataSetUtil.gatherLabels(dataSet).stream().map(i -> dataSet.getLabelTranslator().toExtLabel(i)).collect(Collectors.toSet());
JsonGenerator jsonGenerator=new JsonFactory().createGenerator(new File(analysisFolder,"String_Node_Str"),JsonEncoding.UTF8);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("String_Node_Str",dataName);
jsonGenerator.writeNumberField("String_Node_Str",boosting.getNumClasses());
jsonGenerator.writeNumberField("String_Node_Str",dataSetLabels.size());
jsonGenerator.writeNumberField("String_Node_Str",dataSet.getNumClasses());
Set<String> modelNotDataLabels=SetUtil.complement(modelLabels,dataSetLabels);
Set<String> dataNotModelLabels=SetUtil.complement(dataSetLabels,modelLabels);
jsonGenerator.writeNumberField("String_Node_Str",dataNotModelLabels.size());
jsonGenerator.writeNumberField("String_Node_Str",modelNotDataLabels.size());
jsonGenerator.writeArrayFieldStart("String_Node_Str");
for (String label : dataNotModelLabels) {
jsonGenerator.writeObject(label);
}
jsonGenerator.writeEndArray();
jsonGenerator.writeArrayFieldStart("String_Node_Str");
for (String label : modelNotDataLabels) {
jsonGenerator.writeObject(label);
}
jsonGenerator.writeEndArray();
jsonGenerator.writeNumberField("String_Node_Str",dataSet.labelCardinality());
jsonGenerator.writeEndObject();
jsonGenerator.close();
logger.info("String_Node_Str");
}
boolean modelConfigToJson=true;
if (modelConfigToJson) {
logger.info("String_Node_Str");
ObjectMapper objectMapper=new ObjectMapper();
objectMapper.writeValue(new File(analysisFolder,"String_Node_Str"),config);
logger.info("String_Node_Str");
}
boolean dataConfigToJson=true;
if (dataConfigToJson) {
logger.info("String_Node_Str");
File dataConfigFile=Paths.get(config.getString("String_Node_Str"),"String_Node_Str",dataName,"String_Node_Str").toFile();
if (dataConfigFile.exists()) {
FileUtils.copyFileToDirectory(dataConfigFile,analysisFolder);
}
logger.info("String_Node_Str");
}
boolean performanceToJson=true;
if (performanceToJson) {
ObjectMapper objectMapper=new ObjectMapper();
objectMapper.writeValue(new File(analysisFolder,"String_Node_Str"),mlMeasures);
}
boolean individualPerformance=true;
if (individualPerformance) {
logger.info("String_Node_Str");
ObjectMapper objectMapper=new ObjectMapper();
objectMapper.writeValue(new File(analysisFolder,"String_Node_Str"),mlMeasures.getMacroAverage());
logger.info("String_Node_Str");
}
if (config.getBoolean("String_Node_Str")) {
Visualizer.produceHtml(analysisFolder);
}
logger.info("String_Node_Str");
}

Fixed version (ground truth):
static void report(Config config,String dataName,Logger logger) throws Exception {
  logger.info("String_Node_Str" + dataName);
  String output=config.getString("String_Node_Str");
  String modelName="String_Node_Str";
  File analysisFolder=new File(new File(output,"String_Node_Str"),dataName + "String_Node_Str");
  analysisFolder.mkdirs();
  FileUtils.cleanDirectory(analysisFolder);
  IMLGradientBoosting boosting=IMLGradientBoosting.deserialize(new File(output,modelName));
  String predictTarget=config.getString("String_Node_Str");
  PluginPredictor<IMLGradientBoosting> pluginPredictorTmp=null;
switch (predictTarget) {
case "String_Node_Str":
    pluginPredictorTmp=new SubsetAccPredictor(boosting);
  break;
case "String_Node_Str":
pluginPredictorTmp=new HammingPredictor(boosting);
break;
case "String_Node_Str":
pluginPredictorTmp=new InstanceF1Predictor(boosting);
break;
case "String_Node_Str":
TunedMarginalClassifier tunedMarginalClassifier=(TunedMarginalClassifier)Serialization.deserialize(new File(output,"String_Node_Str"));
pluginPredictorTmp=new MacroF1Predictor(boosting,tunedMarginalClassifier);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + predictTarget);
}
final PluginPredictor<IMLGradientBoosting> pluginPredictor=pluginPredictorTmp;
MultiLabelClfDataSet dataSet=loadData(config,dataName);
MLMeasures mlMeasures=new MLMeasures(pluginPredictor,dataSet);
mlMeasures.getMacroAverage().setLabelTranslator(boosting.getLabelTranslator());
logger.info("String_Node_Str" + dataName);
logger.info(mlMeasures.toString());
boolean simpleCSV=true;
if (simpleCSV) {
logger.info("String_Node_Str");
double probThreshold=config.getDouble("String_Node_Str");
File csv=new File(analysisFolder,"String_Node_Str");
List<String> strs=IntStream.range(0,dataSet.getNumDataPoints()).parallel().mapToObj(i -> IMLGBInspector.simplePredictionAnalysis(boosting,pluginPredictor,dataSet,i,probThreshold)).collect(Collectors.toList());
try (BufferedWriter bw=new BufferedWriter(new FileWriter(csv))){
for (int i=0; i < dataSet.getNumDataPoints(); i++) {
String str=strs.get(i);
bw.write(str);
}
}
 logger.info("String_Node_Str");
}
boolean rulesToJson=config.getBoolean("String_Node_Str");
if (rulesToJson) {
logger.info("String_Node_Str");
int ruleLimit=config.getInt("String_Node_Str");
int numDocsPerFile=config.getInt("String_Node_Str");
int numFiles=(int)Math.ceil((double)dataSet.getNumDataPoints() / numDocsPerFile);
double probThreshold=config.getDouble("String_Node_Str");
int labelSetLimit=config.getInt("String_Node_Str");
IntStream.range(0,numFiles).forEach(i -> {
int start=i * numDocsPerFile;
int end=start + numDocsPerFile;
List<MultiLabelPredictionAnalysis> partition=IntStream.range(start,Math.min(end,dataSet.getNumDataPoints())).parallel().mapToObj(a -> IMLGBInspector.analyzePrediction(boosting,pluginPredictor,dataSet,a,ruleLimit,labelSetLimit,probThreshold)).collect(Collectors.toList());
ObjectMapper mapper=new ObjectMapper();
String file="String_Node_Str" + (i + 1) + "String_Node_Str";
try {
mapper.writeValue(new File(analysisFolder,file),partition);
}
 catch (IOException e) {
e.printStackTrace();
}
logger.info("String_Node_Str" + Progress.percentage(i + 1,numFiles));
}
);
logger.info("String_Node_Str");
}
boolean dataInfoToJson=true;
if (dataInfoToJson) {
logger.info("String_Node_Str");
Set<String> modelLabels=IntStream.range(0,boosting.getNumClasses()).mapToObj(i -> boosting.getLabelTranslator().toExtLabel(i)).collect(Collectors.toSet());
Set<String> dataSetLabels=DataSetUtil.gatherLabels(dataSet).stream().map(i -> dataSet.getLabelTranslator().toExtLabel(i)).collect(Collectors.toSet());
JsonGenerator jsonGenerator=new JsonFactory().createGenerator(new File(analysisFolder,"String_Node_Str"),JsonEncoding.UTF8);
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("String_Node_Str",dataName);
jsonGenerator.writeNumberField("String_Node_Str",boosting.getNumClasses());
jsonGenerator.writeNumberField("String_Node_Str",dataSetLabels.size());
jsonGenerator.writeNumberField("String_Node_Str",dataSet.getNumClasses());
Set<String> modelNotDataLabels=SetUtil.complement(modelLabels,dataSetLabels);
Set<String> dataNotModelLabels=SetUtil.complement(dataSetLabels,modelLabels);
jsonGenerator.writeNumberField("String_Node_Str",dataNotModelLabels.size());
jsonGenerator.writeNumberField("String_Node_Str",modelNotDataLabels.size());
jsonGenerator.writeArrayFieldStart("String_Node_Str");
for (String label : dataNotModelLabels) {
jsonGenerator.writeObject(label);
}
jsonGenerator.writeEndArray();
jsonGenerator.writeArrayFieldStart("String_Node_Str");
for (String label : modelNotDataLabels) {
jsonGenerator.writeObject(label);
}
jsonGenerator.writeEndArray();
jsonGenerator.writeNumberField("String_Node_Str",dataSet.labelCardinality());
jsonGenerator.writeEndObject();
jsonGenerator.close();
logger.info("String_Node_Str");
}
boolean modelConfigToJson=true;
if (modelConfigToJson) {
logger.info("String_Node_Str");
ObjectMapper objectMapper=new ObjectMapper();
objectMapper.writeValue(new File(analysisFolder,"String_Node_Str"),config);
logger.info("String_Node_Str");
}
boolean dataConfigToJson=true;
if (dataConfigToJson) {
logger.info("String_Node_Str");
File dataConfigFile=Paths.get(config.getString("String_Node_Str"),"String_Node_Str",dataName,"String_Node_Str").toFile();
if (dataConfigFile.exists()) {
FileUtils.copyFileToDirectory(dataConfigFile,analysisFolder);
}
logger.info("String_Node_Str");
}
boolean performanceToJson=true;
if (performanceToJson) {
ObjectMapper objectMapper=new ObjectMapper();
objectMapper.writeValue(new File(analysisFolder,"String_Node_Str"),mlMeasures);
}
boolean individualPerformance=true;
if (individualPerformance) {
logger.info("String_Node_Str");
ObjectMapper objectMapper=new ObjectMapper();
objectMapper.writeValue(new File(analysisFolder,"String_Node_Str"),mlMeasures.getMacroAverage());
logger.info("String_Node_Str");
}
if (config.getBoolean("String_Node_Str")) {
logger.info("String_Node_Str");
Visualizer visualizer=new Visualizer(logger);
visualizer.produceHtml(analysisFolder);
visualizer.close();
logger.info("String_Node_Str");
}
logger.info("String_Node_Str");
}