Program: 31615
Project: 31615
Buggy source:
@Override public void init(WorkerContext<NNParams,NNParams> context){
  this.props=context.getProps();
  loadConfigFiles(context.getProps());
  this.trainerId=Integer.valueOf(context.getProps().getProperty(CommonConstants.SHIFU_TRAINER_ID,"String_Node_Str"));
  GridSearch gs=new GridSearch(modelConfig.getTrain().getParams(),modelConfig.getTrain().getGridConfigFileContent());
  this.validParams=this.modelConfig.getTrain().getParams();
  if (gs.hasHyperParam()) {
    this.validParams=gs.getParams(trainerId);
    LOG.info("String_Node_Str",validParams);
  }
  Integer kCrossValidation=this.modelConfig.getTrain().getNumKFold();
  if (kCrossValidation != null && kCrossValidation > 0) {
    isKFoldCV=true;
    LOG.info("String_Node_Str",kCrossValidation);
  }
  this.poissonSampler=Boolean.TRUE.toString().equalsIgnoreCase(context.getProps().getProperty(NNConstants.NN_POISON_SAMPLER));
  this.rng=new PoissonDistribution(1.0d);
  Double upSampleWeight=modelConfig.getTrain().getUpSampleWeight();
  if (Double.compare(upSampleWeight,1d) != 0 && (modelConfig.isRegression() || (modelConfig.isClassification() && modelConfig.getTrain().isOneVsAll()))) {
    LOG.info("String_Node_Str",upSampleWeight);
    this.upSampleRng=new PoissonDistribution(upSampleWeight - 1);
  }
  Integer epochsPerIterationInteger=this.modelConfig.getTrain().getEpochsPerIteration();
  this.epochsPerIteration=epochsPerIterationInteger == null ? 1 : epochsPerIterationInteger.intValue();
  LOG.info("String_Node_Str",epochsPerIteration);
  Object elmObject=validParams.get(DTrainUtils.IS_ELM);
  isELM=elmObject == null ? false : "String_Node_Str".equalsIgnoreCase(elmObject.toString());
  LOG.info("String_Node_Str",isELM);
  Object dropoutRateObj=validParams.get(CommonConstants.DROPOUT_RATE);
  if (dropoutRateObj != null) {
    this.dropoutRate=Double.valueOf(dropoutRateObj.toString());
  }
  LOG.info("String_Node_Str",this.dropoutRate);
  int[] inputOutputIndex=DTrainUtils.getInputOutputCandidateCounts(modelConfig.getNormalizeType(),this.columnConfigList);
  this.inputNodeCount=inputOutputIndex[0] == 0 ? inputOutputIndex[2] : inputOutputIndex[0];
  this.outputNodeCount=modelConfig.isRegression() ? inputOutputIndex[1] : (modelConfig.getTrain().isOneVsAll() ? inputOutputIndex[1] : modelConfig.getTags().size());
  this.candidateCount=inputOutputIndex[2];
  boolean isAfterVarSelect=inputOutputIndex[0] != 0;
  LOG.info("String_Node_Str",inputNodeCount,outputNodeCount,candidateCount);
  this.allFeatures=CommonUtils.getAllFeatureList(columnConfigList,isAfterVarSelect);
  String subsetStr=context.getProps().getProperty(CommonConstants.SHIFU_NN_FEATURE_SUBSET);
  if (StringUtils.isBlank(subsetStr)) {
    this.subFeatures=this.allFeatures;
  }
 else {
    String[] splits=subsetStr.split("String_Node_Str");
    this.subFeatures=new ArrayList<Integer>(splits.length);
    for (    String split : splits) {
      int featureIndex=Integer.parseInt(split);
      this.subFeatures.add(featureIndex);
    }
  }
  this.subFeatureSet=new HashSet<Integer>(this.subFeatures);
  LOG.info("String_Node_Str",subFeatures.size());
  this.featureInputsCnt=DTrainUtils.getFeatureInputsCnt(this.modelConfig,this.columnConfigList,this.subFeatureSet);
  this.wgtInit="String_Node_Str";
  Object wgtInitObj=validParams.get("String_Node_Str");
  if (wgtInitObj != null) {
    this.wgtInit=wgtInitObj.toString();
  }
  Object lossObj=validParams.get("String_Node_Str");
  this.lossStr=lossObj != null ? lossObj.toString() : "String_Node_Str";
  LOG.info("String_Node_Str",this.lossStr);
  this.isDry=Boolean.TRUE.toString().equalsIgnoreCase(context.getProps().getProperty(CommonConstants.SHIFU_DRY_DTRAIN));
  this.isSpecificValidation=(modelConfig.getValidationDataSetRawPath() != null && !"String_Node_Str".equals(modelConfig.getValidationDataSetRawPath()));
  this.isStratifiedSampling=this.modelConfig.getTrain().getStratifiedSample();
  if (isOnDisk()) {
    LOG.info("String_Node_Str");
    try {
      initDiskDataSet();
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
      @Override public void run(){
        ((BufferedFloatMLDataSet)(AbstractNNWorker.this.trainingData)).close();
        ((BufferedFloatMLDataSet)(AbstractNNWorker.this.validationData)).close();
      }
    }
));
  }
 else {
    LOG.info("String_Node_Str");
    double memoryFraction=Double.valueOf(context.getProps().getProperty("String_Node_Str","String_Node_Str"));
    long memoryStoreSize=(long)(Runtime.getRuntime().maxMemory() * memoryFraction);
    LOG.info("String_Node_Str",Runtime.getRuntime().maxMemory(),memoryFraction);
    double crossValidationRate=this.modelConfig.getValidSetRate();
    try {
      if (StringUtils.isNotBlank(modelConfig.getValidationDataSetRawPath())) {
        this.trainingData=new MemoryDiskFloatMLDataSet((long)(memoryStoreSize * 0.6),DTrainUtils.getTrainingFile().toString(),this.featureInputsCnt,this.outputNodeCount);
        this.validationData=new MemoryDiskFloatMLDataSet((long)(memoryStoreSize * 0.4),DTrainUtils.getTestingFile().toString(),this.featureInputsCnt,this.outputNodeCount);
      }
 else {
        this.trainingData=new MemoryDiskFloatMLDataSet((long)(memoryStoreSize * (1 - crossValidationRate)),DTrainUtils.getTrainingFile().toString(),this.featureInputsCnt,this.outputNodeCount);
        this.validationData=new MemoryDiskFloatMLDataSet((long)(memoryStoreSize * crossValidationRate),DTrainUtils.getTestingFile().toString(),this.featureInputsCnt,this.outputNodeCount);
      }
      Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
        @Override public void run(){
          ((MemoryDiskFloatMLDataSet)(AbstractNNWorker.this.trainingData)).close();
          ((MemoryDiskFloatMLDataSet)(AbstractNNWorker.this.validationData)).close();
        }
      }
));
    }
 catch (    IOException e) {
      throw new GuaguaRuntimeException(e);
    }
  }
}

Fixed version (ground truth):
@Override public void init(WorkerContext<NNParams,NNParams> context){
  this.props=context.getProps();
  loadConfigFiles(context.getProps());
  this.trainerId=Integer.valueOf(context.getProps().getProperty(CommonConstants.SHIFU_TRAINER_ID,"String_Node_Str"));
  GridSearch gs=new GridSearch(modelConfig.getTrain().getParams(),modelConfig.getTrain().getGridConfigFileContent());
  this.validParams=this.modelConfig.getTrain().getParams();
  if (gs.hasHyperParam()) {
    this.validParams=gs.getParams(trainerId);
    LOG.info("String_Node_Str",validParams);
  }
  Integer kCrossValidation=this.modelConfig.getTrain().getNumKFold();
  if (kCrossValidation != null && kCrossValidation > 0) {
    isKFoldCV=true;
    LOG.info("String_Node_Str",kCrossValidation);
  }
  this.poissonSampler=Boolean.TRUE.toString().equalsIgnoreCase(context.getProps().getProperty(NNConstants.NN_POISON_SAMPLER));
  this.rng=new PoissonDistribution(1.0d);
  Double upSampleWeight=modelConfig.getTrain().getUpSampleWeight();
  if (Double.compare(upSampleWeight,1d) != 0 && (modelConfig.isRegression() || (modelConfig.isClassification() && modelConfig.getTrain().isOneVsAll()))) {
    LOG.info("String_Node_Str",upSampleWeight);
    this.upSampleRng=new PoissonDistribution(upSampleWeight - 1);
  }
  Integer epochsPerIterationInteger=this.modelConfig.getTrain().getEpochsPerIteration();
  this.epochsPerIteration=epochsPerIterationInteger == null ? 1 : epochsPerIterationInteger.intValue();
  LOG.info("String_Node_Str",epochsPerIteration);
  Object elmObject=validParams.get(DTrainUtils.IS_ELM);
  isELM=elmObject == null ? false : "String_Node_Str".equalsIgnoreCase(elmObject.toString());
  LOG.info("String_Node_Str",isELM);
  Object dropoutRateObj=validParams.get(CommonConstants.DROPOUT_RATE);
  if (dropoutRateObj != null) {
    this.dropoutRate=Double.valueOf(dropoutRateObj.toString());
  }
  LOG.info("String_Node_Str",this.dropoutRate);
  Object miniBatchO=validParams.get("String_Node_Str");
  if (miniBatchO != null) {
    int miniBatchs;
    try {
      miniBatchs=Integer.parseInt(miniBatchO.toString());
    }
 catch (    Exception e) {
      miniBatchs=1;
    }
    if (miniBatchs < 0) {
      this.batchs=1;
    }
 else     if (miniBatchs > 1000) {
      this.batchs=1000;
    }
 else {
      this.batchs=miniBatchs;
    }
    LOG.info("String_Node_Str",miniBatchs,batchs);
  }
  int[] inputOutputIndex=DTrainUtils.getInputOutputCandidateCounts(modelConfig.getNormalizeType(),this.columnConfigList);
  this.inputNodeCount=inputOutputIndex[0] == 0 ? inputOutputIndex[2] : inputOutputIndex[0];
  this.outputNodeCount=modelConfig.isRegression() ? inputOutputIndex[1] : (modelConfig.getTrain().isOneVsAll() ? inputOutputIndex[1] : modelConfig.getTags().size());
  this.candidateCount=inputOutputIndex[2];
  boolean isAfterVarSelect=inputOutputIndex[0] != 0;
  LOG.info("String_Node_Str",inputNodeCount,outputNodeCount,candidateCount);
  this.allFeatures=CommonUtils.getAllFeatureList(columnConfigList,isAfterVarSelect);
  String subsetStr=context.getProps().getProperty(CommonConstants.SHIFU_NN_FEATURE_SUBSET);
  if (StringUtils.isBlank(subsetStr)) {
    this.subFeatures=this.allFeatures;
  }
 else {
    String[] splits=subsetStr.split("String_Node_Str");
    this.subFeatures=new ArrayList<Integer>(splits.length);
    for (    String split : splits) {
      int featureIndex=Integer.parseInt(split);
      this.subFeatures.add(featureIndex);
    }
  }
  this.subFeatureSet=new HashSet<Integer>(this.subFeatures);
  LOG.info("String_Node_Str",subFeatures.size());
  this.featureInputsCnt=DTrainUtils.getFeatureInputsCnt(this.modelConfig,this.columnConfigList,this.subFeatureSet);
  this.wgtInit="String_Node_Str";
  Object wgtInitObj=validParams.get("String_Node_Str");
  if (wgtInitObj != null) {
    this.wgtInit=wgtInitObj.toString();
  }
  Object lossObj=validParams.get("String_Node_Str");
  this.lossStr=lossObj != null ? lossObj.toString() : "String_Node_Str";
  LOG.info("String_Node_Str",this.lossStr);
  this.isDry=Boolean.TRUE.toString().equalsIgnoreCase(context.getProps().getProperty(CommonConstants.SHIFU_DRY_DTRAIN));
  this.isSpecificValidation=(modelConfig.getValidationDataSetRawPath() != null && !"String_Node_Str".equals(modelConfig.getValidationDataSetRawPath()));
  this.isStratifiedSampling=this.modelConfig.getTrain().getStratifiedSample();
  if (isOnDisk()) {
    LOG.info("String_Node_Str");
    try {
      initDiskDataSet();
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
      @Override public void run(){
        ((BufferedFloatMLDataSet)(AbstractNNWorker.this.trainingData)).close();
        ((BufferedFloatMLDataSet)(AbstractNNWorker.this.validationData)).close();
      }
    }
));
  }
 else {
    LOG.info("String_Node_Str");
    double memoryFraction=Double.valueOf(context.getProps().getProperty("String_Node_Str","String_Node_Str"));
    long memoryStoreSize=(long)(Runtime.getRuntime().maxMemory() * memoryFraction);
    LOG.info("String_Node_Str",Runtime.getRuntime().maxMemory(),memoryFraction);
    double crossValidationRate=this.modelConfig.getValidSetRate();
    try {
      if (StringUtils.isNotBlank(modelConfig.getValidationDataSetRawPath())) {
        this.trainingData=new MemoryDiskFloatMLDataSet((long)(memoryStoreSize * 0.6),DTrainUtils.getTrainingFile().toString(),this.featureInputsCnt,this.outputNodeCount);
        this.validationData=new MemoryDiskFloatMLDataSet((long)(memoryStoreSize * 0.4),DTrainUtils.getTestingFile().toString(),this.featureInputsCnt,this.outputNodeCount);
      }
 else {
        this.trainingData=new MemoryDiskFloatMLDataSet((long)(memoryStoreSize * (1 - crossValidationRate)),DTrainUtils.getTrainingFile().toString(),this.featureInputsCnt,this.outputNodeCount);
        this.validationData=new MemoryDiskFloatMLDataSet((long)(memoryStoreSize * crossValidationRate),DTrainUtils.getTestingFile().toString(),this.featureInputsCnt,this.outputNodeCount);
      }
      Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
        @Override public void run(){
          ((MemoryDiskFloatMLDataSet)(AbstractNNWorker.this.trainingData)).close();
          ((MemoryDiskFloatMLDataSet)(AbstractNNWorker.this.validationData)).close();
        }
      }
));
    }
 catch (    IOException e) {
      throw new GuaguaRuntimeException(e);
    }
  }
}