Skip to content

Commit

Permalink
Ensured compatibility with CHAID 5.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Mar 20, 2024
1 parent b1149f3 commit def0c18
Show file tree
Hide file tree
Showing 9 changed files with 1,928 additions and 1,910 deletions.
20 changes: 18 additions & 2 deletions pmml-sklearn/src/main/java/sklearn2pmml/tree/CHAIDUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public int compare(Node left, Node right){
Integer splitIndex = splitIndices.get(j);
Object splitValue = splitValues.get(j);

if(splitIndex == -1){
if(isMissing(splitIndex, splitValue)){
// Ignored
} else

Expand Down Expand Up @@ -168,7 +168,7 @@ public int compare(Node left, Node right){
Integer splitIndex = splitIndices.get(j);
Object splitValue = splitValues.get(j);

if(splitIndex == -1){
if(isMissing(splitIndex, splitValue)){
withMissing = true;
} else

Expand Down Expand Up @@ -264,6 +264,22 @@ public int compare(Node left, Node right){
return result;
}

static
private boolean isMissing(Integer splitIndex, Object splitValue){

// Floating-point data type columns
if(splitIndex == -1){
return true;
} else

// Object data type columns
if(splitValue == null){
return true;
}

return false;
}

static
private void removeCategory(Collection<?> values, Object splitValue){

Expand Down
Loading

0 comments on commit def0c18

Please sign in to comment.