Skip to content

Commit

Permalink
Improved support for unused features
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Dec 18, 2023
1 parent 8f5f701 commit 3f9bec7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pmml-xgboost/src/main/java/org/jpmml/xgboost/Learner.java
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,11 @@ private class FeatureTransformer implements Function<Feature, Feature> {
public Feature apply(Feature feature){
int splitIndex = getSplitIndex(feature);

int splitType = getSplitType(splitIndex);
Integer splitType = getSplitType(splitIndex);
if(splitType == null){
return feature;
}

switch(splitType){
case Node.SPLIT_NUMERICAL:
return transformNumerical(feature);
Expand All @@ -685,11 +689,11 @@ public Feature apply(Feature feature){
}
}

private int getSplitType(int splitIndex){
private Integer getSplitType(int splitIndex){
Set<Integer> splitTypes = Learner.this.gbtree.getSplitType(splitIndex);

if(splitTypes.size() == 0){
return Node.SPLIT_NUMERICAL;
return null;
} else

if(splitTypes.size() == 1){
Expand Down

0 comments on commit 3f9bec7

Please sign in to comment.