class FeatureBinsUtil {

    public static double calcWoe(long binTotal, long binPositiveTotal, long positiveTotal, long negativeTotal){
        long binNegativeTotal = binTotal - binPositiveTotal;
        Double woe = Double.NaN;
        if(positiveTotal > 0 && negativeTotal > 0){
            double binPositiveRate = 1.0 * (binPositiveTotal + 0.5) / positiveTotal;
            double binNegativeRate = 1.0 * (binNegativeTotal + 0.5) / negativeTotal;
            woe = Math.log(binPositiveRate / binNegativeRate);
        }
        return woe;
    }

}