Program: 31998
Project: 31998
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);
  }
 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.isContinuousEnabled=Boolean.TRUE.toString().equalsIgnoreCase(context.getProps().getProperty(CommonConstants.CONTINUOUS_TRAINING));
  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();
  GridSearch gs=new GridSearch(modelConfig.getTrain().getParams());
  Map<String,Object> validParams=this.modelConfig.getTrain().getParams();
  if (gs.hasHyperParam()) {
    validParams=gs.getParams(this.trainerId);
    LOG.info("String_Node_Str",validParams);
  }
  this.treeNum=Integer.valueOf(validParams.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);
  double validationRate=this.modelConfig.getCrossValidationRate();
  if (Double.compare(validationRate,0d) != 0) {
    this.trainingData=new MemoryLimitedList<Data>((long)(Runtime.getRuntime().maxMemory() * memoryFraction * (1 - validationRate)),new LinkedList<Data>());
    this.validationData=new MemoryLimitedList<Data>((long)(Runtime.getRuntime().maxMemory() * memoryFraction * validationRate),new LinkedList<Data>());
  }
 else {
    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=validParams.get("String_Node_Str").toString();
  int minInstancesPerNode=Integer.valueOf(validParams.get("String_Node_Str").toString());
  double minInfoGain=Double.valueOf(validParams.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   if (imStr.equalsIgnoreCase("String_Node_Str")) {
    impurity=new FriedmanMSE(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=validParams.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   if (lossStr.equalsIgnoreCase("String_Node_Str")) {
    this.loss=new HalfGradSquaredLoss();
  }
 else {
    this.loss=new SquaredLoss();
  }
  if (this.isGBDT) {
    this.learningRate=Double.valueOf(validParams.get(NNTrainer.LEARNING_RATE).toString());
    Object swrObj=validParams.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.isContinuousEnabled=Boolean.TRUE.toString().equalsIgnoreCase(context.getProps().getProperty(CommonConstants.CONTINUOUS_TRAINING));
  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();
  GridSearch gs=new GridSearch(modelConfig.getTrain().getParams());
  Map<String,Object> validParams=this.modelConfig.getTrain().getParams();
  if (gs.hasHyperParam()) {
    validParams=gs.getParams(this.trainerId);
    LOG.info("String_Node_Str",validParams);
  }
  this.treeNum=Integer.valueOf(validParams.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);
  double validationRate=this.modelConfig.getCrossValidationRate();
  if (Double.compare(validationRate,0d) != 0) {
    this.trainingData=new MemoryLimitedList<Data>((long)(Runtime.getRuntime().maxMemory() * memoryFraction * (1 - validationRate)),new LinkedList<Data>());
    this.validationData=new MemoryLimitedList<Data>((long)(Runtime.getRuntime().maxMemory() * memoryFraction * validationRate),new LinkedList<Data>());
  }
 else {
    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;
  int numClasses=this.modelConfig.isClassification() ? this.modelConfig.getTags().size() : 2;
  String imStr=validParams.get("String_Node_Str").toString();
  int minInstancesPerNode=Integer.valueOf(validParams.get("String_Node_Str").toString());
  double minInfoGain=Double.valueOf(validParams.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   if (imStr.equalsIgnoreCase("String_Node_Str")) {
    impurity=new FriedmanMSE(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=validParams.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   if (lossStr.equalsIgnoreCase("String_Node_Str")) {
    this.loss=new HalfGradSquaredLoss();
  }
 else {
    this.loss=new SquaredLoss();
  }
  if (this.isGBDT) {
    this.learningRate=Double.valueOf(validParams.get(NNTrainer.LEARNING_RATE).toString());
    Object swrObj=validParams.get("String_Node_Str");
    if (swrObj != null) {
      this.gbdtSampleWithReplacement=Boolean.TRUE.toString().equalsIgnoreCase(swrObj.toString());
    }
  }
  if (this.isRF || (this.isGBDT && this.gbdtSampleWithReplacement)) {
    this.rng=new PoissonDistribution[treeNum];
    for (int i=0; i < treeNum; i++) {
      this.rng[i]=new PoissonDistribution(this.modelConfig.getTrain().getBaggingSampleRate());
    }
  }
  LOG.info("String_Node_Str",isAfterVarSelect,treeNum,impurity.getClass().getName(),loss.getClass().getName(),this.learningRate,this.gbdtSampleWithReplacement,this.isRF,this.isGBDT);
}