Java Code Examples for org.dmg.pmml.DiscretizeBin#getBinValue()
The following examples show how to use
org.dmg.pmml.DiscretizeBin#getBinValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValueParser.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 6 votes |
@Override public VisitorAction visit(DiscretizeBin discretizeBin){ Discretize discretize = (Discretize)getParent(); DataType dataType = discretize.getDataType(); if(dataType != null){ Object binValue = discretizeBin.getBinValue(); if(binValue != null){ binValue = parseOrCast(dataType, binValue); discretizeBin.setBinValue(binValue); } } return super.visit(discretizeBin); }
Example 2
Source File: DiscretizationUtil.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 6 votes |
static private RangeMap<Double, Object> parseDiscretize(Discretize discretize){ RangeMap<Double, Object> result = TreeRangeMap.create(); List<DiscretizeBin> discretizeBins = discretize.getDiscretizeBins(); for(DiscretizeBin discretizeBin : discretizeBins){ Interval interval = discretizeBin.getInterval(); if(interval == null){ throw new MissingElementException(discretizeBin, PMMLElements.DISCRETIZEBIN_INTERVAL); } Range<Double> range = toRange(interval); Object binValue = discretizeBin.getBinValue(); if(binValue == null){ throw new MissingAttributeException(discretizeBin, PMMLAttributes.DISCRETIZEBIN_BINVALUE); } result.put(range, binValue); } return result; }