Skip to content

Commit

Permalink
Fixed the formatting of integer split conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Mar 27, 2022
1 parent aa985bf commit 0460161
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pmml-xgboost/src/main/java/org/jpmml/xgboost/RegTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,15 @@ private org.dmg.pmml.tree.Node encodeNode(int index, Predicate predicate, boolea
DataType dataType = continuousFeature.getDataType();
switch(dataType){
case INTEGER:
splitValue = (int)(splitValue.floatValue() + 1f);
Float flooredSplitValue = (float)Math.floor(splitValue.floatValue());

if(splitValue.floatValue() == flooredSplitValue.floatValue()){
splitValue = (int)flooredSplitValue.floatValue();
} else

{
splitValue = (int)(flooredSplitValue.floatValue() + 1f);
}
break;
case FLOAT:
break;
Expand Down

0 comments on commit 0460161

Please sign in to comment.