Is it possible to concatenate rulesets in Knime

I have the following situation: in my data, there is a field indicating a category.with 5 possible values.
I filter the data according to this category and learn a decision tree on the filtered data. From the decision tree a ruleset is created.

I would like to concatenate these 5 rules to one big rule set by adding an extra condition “if cat=1” then ruleset 1 else if cat=2 then ruleset2 etc…"

Is this possible to do this in KNIME?
(ps there is a reason for not making the decision tree on the whole dataset: I would like to study the effect of merging categories.

Hi @RAPosthumus,

I would suggest you to learn a Decision Tree model on all your data, using the Force root split column option and specifying your category column there. You will have to also deactivate the Binary nominal splits option. Then in the Rules Table of the Decision Tree to Ruleset node you will have the rules with all the categories and if needed could split them using the Row Filter (Row Splitter) node with the wild card or regex option.

Best,
Anna

Clever! will try that.

Alas this doesn’t work: my data arises from a document vector node and not all input fields are propegated.
Besides that, it would be good to have accuracy estimates for each of the several categories.

Wouldn’t the following setup work for you?

After the decision trees use the Decision Tree to Ruleset node with the “Use additional parentheses to document precedence rules” option. For each output prepend the conditions you want like $cat = 1 AND to the rules. Concatenate the tables. Use the Rule Engine (Dictionary) node on the concatenated results.

1 Like

Thanks that worked!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.