Program: 32026
Project: 32026
Buggy source:
@Override public void init(WorkerContext<DTMasterParams,DTWorkerParams> context){
  Properties props=context.getProps();
  try {
    SourceType sourceType=SourceType.valueOf(props.getProperty(CommonConstants.MODELSET_SOURCE_TYPE,SourceType.HDFS.toString()));
    this.modelConfig=CommonUtils.loadModelConfig(props.getProperty(CommonConstants.SHIFU_MODEL_CONFIG),sourceType);
    this.columnConfigList=CommonUtils.loadColumnConfigList(props.getProperty(CommonConstants.SHIFU_COLUMN_CONFIG),sourceType);
    for (    ColumnConfig config : this.columnConfigList) {
      if (config.isCategorical()) {
        Map<String,Integer> categoryMap=new HashMap<String,Integer>();
        for (int i=0; i < config.getBinCategory().size(); i++) {
          categoryMap.put(config.getBinCategory().get(i),i);
        }
        this.categoryIndexMap.put(config.getColumnNum(),categoryMap);
      }
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  this.trainerId=Integer.valueOf(context.getProps().getProperty(CommonConstants.SHIFU_TRAINER_ID));
  this.isOneVsAll=modelConfig.isClassification() && modelConfig.getTrain().isOneVsAll();
  this.treeNum=Integer.valueOf(this.modelConfig.getTrain().getParams().get("String_Node_Str").toString());
  ;
  double memoryFraction=Double.valueOf(context.getProps().getProperty("String_Node_Str","String_Node_Str"));
  LOG.info("String_Node_Str",Runtime.getRuntime().maxMemory(),memoryFraction);
  this.trainingData=new MemoryLimitedList<Data>((long)(Runtime.getRuntime().maxMemory() * memoryFraction),new LinkedList<Data>());
  int[] inputOutputIndex=DTrainUtils.getNumericAndCategoricalInputAndOutputCounts(this.columnConfigList);
  this.numericInputCount=inputOutputIndex[0];
  this.categoricalInputCount=inputOutputIndex[1];
  this.outputNodeCount=modelConfig.isRegression() ? inputOutputIndex[2] : modelConfig.getTags().size();
  this.isAfterVarSelect=inputOutputIndex[3] == 1 ? true : false;
  this.rng=new PoissonDistribution[treeNum];
  for (int i=0; i < treeNum; i++) {
    this.rng[i]=new PoissonDistribution(this.modelConfig.getTrain().getBaggingSampleRate());
  }
  int numClasses=this.modelConfig.isClassification() ? this.modelConfig.getFlattenTags().size() : 2;
  String imStr=this.modelConfig.getTrain().getParams().get("String_Node_Str").toString();
  int minInstancesPerNode=Integer.valueOf(this.modelConfig.getParams().get("String_Node_Str").toString());
  double minInfoGain=Double.valueOf(this.modelConfig.getParams().get("String_Node_Str").toString());
  if (imStr.equalsIgnoreCase("String_Node_Str")) {
    impurity=new Entropy(numClasses,minInstancesPerNode,minInfoGain);
  }
 else   if (imStr.equalsIgnoreCase("String_Node_Str")) {
    impurity=new Gini(numClasses,minInstancesPerNode,minInfoGain);
  }
 else {
    impurity=new Variance(minInstancesPerNode,minInfoGain);
  }
  this.isRF=ALGORITHM.RF.toString().equalsIgnoreCase(modelConfig.getAlgorithm());
  this.isGBDT=ALGORITHM.GBT.toString().equalsIgnoreCase(modelConfig.getAlgorithm());
  String lossStr=this.modelConfig.getTrain().getParams().get("String_Node_Str").toString();
  if (lossStr.equalsIgnoreCase("String_Node_Str")) {
    this.loss=new LogLoss();
  }
 else   if (lossStr.equalsIgnoreCase("String_Node_Str")) {
    this.loss=new AbsoluteLoss();
  }
 else {
    this.loss=new SquaredLoss();
  }
  if (this.isGBDT) {
    this.learningRate=Double.valueOf(this.modelConfig.getParams().get(NNTrainer.LEARNING_RATE).toString());
    Object swrObj=this.modelConfig.getParams().get("String_Node_Str");
    if (swrObj != null) {
      this.gbdtSampleWithReplacement=Boolean.TRUE.toString().equalsIgnoreCase(swrObj.toString());
    }
  }
  LOG.info("String_Node_Str",isAfterVarSelect,treeNum,impurity.getClass().getName(),loss.getClass().getName(),this.learningRate,this.gbdtSampleWithReplacement,this.isRF,this.isGBDT);
}

Fixed version (ground truth):
@Override public void init(WorkerContext<DTMasterParams,DTWorkerParams> context){
  Properties props=context.getProps();
  try {
    SourceType sourceType=SourceType.valueOf(props.getProperty(CommonConstants.MODELSET_SOURCE_TYPE,SourceType.HDFS.toString()));
    this.modelConfig=CommonUtils.loadModelConfig(props.getProperty(CommonConstants.SHIFU_MODEL_CONFIG),sourceType);
    this.columnConfigList=CommonUtils.loadColumnConfigList(props.getProperty(CommonConstants.SHIFU_COLUMN_CONFIG),sourceType);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  for (  ColumnConfig config : this.columnConfigList) {
    if (config.isCategorical()) {
      Map<String,Integer> categoryMap=new HashMap<String,Integer>();
      for (int i=0; i < config.getBinCategory().size(); i++) {
        categoryMap.put(config.getBinCategory().get(i),i);
      }
      this.categoryIndexMap.put(config.getColumnNum(),categoryMap);
    }
  }
  this.workerThreadCount=modelConfig.getTrain().getWorkerThreadCount();
  this.threadPool=Executors.newFixedThreadPool(this.workerThreadCount);
  context.addCompletionCallBack(new WorkerCompletionCallBack<DTMasterParams,DTWorkerParams>(){
    @Override public void callback(    WorkerContext<DTMasterParams,DTWorkerParams> context){
      DTWorker.this.threadPool.shutdownNow();
      try {
        DTWorker.this.threadPool.awaitTermination(2,TimeUnit.SECONDS);
      }
 catch (      InterruptedException e) {
        Thread.currentThread().interrupt();
      }
    }
  }
);
  this.trainerId=Integer.valueOf(context.getProps().getProperty(CommonConstants.SHIFU_TRAINER_ID,"String_Node_Str"));
  this.isOneVsAll=modelConfig.isClassification() && modelConfig.getTrain().isOneVsAll();
  this.treeNum=Integer.valueOf(this.modelConfig.getTrain().getParams().get("String_Node_Str").toString());
  ;
  double memoryFraction=Double.valueOf(context.getProps().getProperty("String_Node_Str","String_Node_Str"));
  LOG.info("String_Node_Str",Runtime.getRuntime().maxMemory(),memoryFraction);
  this.trainingData=new MemoryLimitedList<Data>((long)(Runtime.getRuntime().maxMemory() * memoryFraction),new LinkedList<Data>());
  int[] inputOutputIndex=DTrainUtils.getNumericAndCategoricalInputAndOutputCounts(this.columnConfigList);
  this.numericInputCount=inputOutputIndex[0];
  this.categoricalInputCount=inputOutputIndex[1];
  this.outputNodeCount=modelConfig.isRegression() ? inputOutputIndex[2] : modelConfig.getTags().size();
  this.isAfterVarSelect=inputOutputIndex[3] == 1 ? true : false;
  this.rng=new PoissonDistribution[treeNum];
  for (int i=0; i < treeNum; i++) {
    this.rng[i]=new PoissonDistribution(this.modelConfig.getTrain().getBaggingSampleRate());
  }
  int numClasses=this.modelConfig.isClassification() ? this.modelConfig.getTags().size() : 2;
  String imStr=this.modelConfig.getTrain().getParams().get("String_Node_Str").toString();
  int minInstancesPerNode=Integer.valueOf(this.modelConfig.getParams().get("String_Node_Str").toString());
  double minInfoGain=Double.valueOf(this.modelConfig.getParams().get("String_Node_Str").toString());
  if (imStr.equalsIgnoreCase("String_Node_Str")) {
    impurity=new Entropy(numClasses,minInstancesPerNode,minInfoGain);
  }
 else   if (imStr.equalsIgnoreCase("String_Node_Str")) {
    impurity=new Gini(numClasses,minInstancesPerNode,minInfoGain);
  }
 else {
    impurity=new Variance(minInstancesPerNode,minInfoGain);
  }
  this.isRF=ALGORITHM.RF.toString().equalsIgnoreCase(modelConfig.getAlgorithm());
  this.isGBDT=ALGORITHM.GBT.toString().equalsIgnoreCase(modelConfig.getAlgorithm());
  String lossStr=this.modelConfig.getTrain().getParams().get("String_Node_Str").toString();
  if (lossStr.equalsIgnoreCase("String_Node_Str")) {
    this.loss=new LogLoss();
  }
 else   if (lossStr.equalsIgnoreCase("String_Node_Str")) {
    this.loss=new AbsoluteLoss();
  }
 else {
    this.loss=new SquaredLoss();
  }
  if (this.isGBDT) {
    this.learningRate=Double.valueOf(this.modelConfig.getParams().get(NNTrainer.LEARNING_RATE).toString());
    Object swrObj=this.modelConfig.getParams().get("String_Node_Str");
    if (swrObj != null) {
      this.gbdtSampleWithReplacement=Boolean.TRUE.toString().equalsIgnoreCase(swrObj.toString());
    }
  }
  LOG.info("String_Node_Str",isAfterVarSelect,treeNum,impurity.getClass().getName(),loss.getClass().getName(),this.learningRate,this.gbdtSampleWithReplacement,this.isRF,this.isGBDT);
}