sklearn-pmml-model icon indicating copy to clipboard operation
sklearn-pmml-model copied to clipboard

Support CompoundPredicates

Open iamDecode opened this issue 7 years ago • 0 comments

rpart in R uses CompoundPredicates by default, we should support it. This can be implemented by chaining a few nodes back to back. Examples:

booleanType: and

[A < 1 and B > 2]                     [A < 1]
        └─N⟶ 2        becomes           └─N⟶ 1
        └─Y⟶ 5                          └─Y⟶ [B > 2]
                                                   └─N⟶ 1
                                                   └─Y⟶ 5

(and it seems booleanType surrogate is also treated as and, except nan-checks, which we do not yet support)

booleanType: or

[A < 1 or B > 2]                     [A < 1]
       └─Y⟶ 5        becomes           └─Y⟶ 4
       └─N⟶ 2                          └─N⟶ [B > 2]
                                                   └─Y⟶ 1
                                                   └─N⟶ 2

booleanType: xor

[A < 1 xor B > 2]                     [A < 1]
        └─Y⟶ 5        becomes           └─Y⟶ [B > 2]
        └─N⟶ 2                                   └─Y⟶ 1
                                                   └─N⟶ 3
                                          └─N⟶ [B > 2]
                                                   └─Y⟶ 2
                                                   └─N⟶ 1

iamDecode avatar Feb 11 '19 10:02 iamDecode