Program: 32107
Project: 32107
Buggy source:
@Test public void categoricalNormalizeTest(){
  ColumnConfig config=new ColumnConfig();
  config.setMean(0.2);
  config.setStdDev(1.0);
  config.setColumnType(ColumnType.C);
  ColumnBinning cbin=new ColumnBinning();
  cbin.setBinCountWoe(Arrays.asList(new Double[]{10.0,11.0,12.0,13.0,6.5}));
  cbin.setBinWeightedWoe(Arrays.asList(new Double[]{20.0,21.0,22.0,23.0,16.5}));
  cbin.setBinCategory(Arrays.asList(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}));
  cbin.setBinPosRate(Arrays.asList(new Double[]{0.2,0.4,0.8,1.0}));
  config.setColumnBinning(cbin);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",4.0,NormType.ZSCALE),0.2);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.ZSCALE),0.2);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",4.0,NormType.ZSCALE),0.0);
  Assert.assertEquals(Normalizer.normalize(config,null,4.0,NormType.ZSCALE),0.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",4.0,NormType.OLD_ZSCALE),0.2);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.OLD_ZSCALE),0.2);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",4.0,NormType.OLD_ZSCALE),0.0);
  Assert.assertEquals(Normalizer.normalize(config,null,4.0,NormType.OLD_ZSCALE),0.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WEIGHT_WOE),22.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WEIGHT_WOE),16.5);
  Assert.assertEquals(Normalizer.normalize(config,null,null,NormType.WEIGHT_WOE),16.5);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WOE),12.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WOE),6.5);
  Assert.assertEquals(Normalizer.normalize(config,null,null,NormType.WOE),6.5);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.HYBRID),10.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.HYBRID),6.5);
  Assert.assertEquals(Normalizer.normalize(config,null,null,NormType.HYBRID),6.5);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WEIGHT_HYBRID),20.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WEIGHT_HYBRID),16.5);
  Assert.assertEquals(Normalizer.normalize(config,null,null,NormType.WEIGHT_HYBRID),16.5);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",12.0,NormType.WOE_ZSCORE),0.2);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",13.0,NormType.WOE_ZSCORE),-1.6);
  Assert.assertEquals(Normalizer.normalize(config,null,13.0,NormType.WOE_ZSCORE),-1.6);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",22.0,NormType.WEIGHT_WOE_ZSCORE),0.2);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",23.0,NormType.WEIGHT_WOE_ZSCORE),-1.6);
  Assert.assertEquals(Normalizer.normalize(config,null,23.0,NormType.WEIGHT_WOE_ZSCORE),-1.6);
}

Fixed version (ground truth):
@Test public void categoricalNormalizeTest(){
  ColumnConfig config=new ColumnConfig();
  config.setMean(0.2);
  config.setStdDev(1.0);
  config.setColumnType(ColumnType.C);
  ColumnBinning cbin=new ColumnBinning();
  cbin.setBinCountWoe(Arrays.asList(new Double[]{10.0,11.0,12.0,13.0,6.5}));
  cbin.setBinWeightedWoe(Arrays.asList(new Double[]{20.0,21.0,22.0,23.0,16.5}));
  cbin.setBinCategory(Arrays.asList(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}));
  cbin.setBinPosRate(Arrays.asList(new Double[]{0.2,0.4,0.8,1.0}));
  cbin.setBinCountNeg(Arrays.asList(1,2,3,4,5));
  cbin.setBinCountPos(Arrays.asList(5,4,3,2,1));
  config.setColumnBinning(cbin);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",4.0,NormType.ZSCALE),0.2);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.ZSCALE),0.2);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",4.0,NormType.ZSCALE),0.0);
  Assert.assertEquals(Normalizer.normalize(config,null,4.0,NormType.ZSCALE),0.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",4.0,NormType.OLD_ZSCALE),0.2);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.OLD_ZSCALE),0.2);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",4.0,NormType.OLD_ZSCALE),0.0);
  Assert.assertEquals(Normalizer.normalize(config,null,4.0,NormType.OLD_ZSCALE),0.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WEIGHT_WOE),22.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WEIGHT_WOE),16.5);
  Assert.assertEquals(Normalizer.normalize(config,null,null,NormType.WEIGHT_WOE),16.5);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WOE),12.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WOE),6.5);
  Assert.assertEquals(Normalizer.normalize(config,null,null,NormType.WOE),6.5);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.HYBRID),10.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.HYBRID),6.5);
  Assert.assertEquals(Normalizer.normalize(config,null,null,NormType.HYBRID),6.5);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WEIGHT_HYBRID),20.0);
  Assert.assertEquals(Normalizer.normalize(config,"String_Node_Str",null,NormType.WEIGHT_HYBRID),16.5);
  Assert.assertEquals(Normalizer.normalize(config,null,null,NormType.WEIGHT_HYBRID),16.5);
}