Assoziation rule

Hello again,

i want to analyse a shopping basket.

At first, i need a model with assoziation rules. The algorism in KNIME shows only 3 results, after i have added a "Bitvector Generator" with numeric input bevor. But i want to see assoziation rules like the GRI-algorism has. Are their possibilities to do that?

Beside that i want to creat a new column where i compare 3 boolean colums with true/false values. (e.g. eggs=true, fruits=true and fish = true). The "Column Comparator"-node supports only one compare. Perhaps the Java snipet?

thanks a lot!


what do you mean with only three results? Three bits set in the bitvector? Three found association rules?

You can configure the AssociationRule node to ouput association rules by checking the "output association rules" and then specify the confidence. The rules have several items in the antecedent and exactly one item in the consequent.

Regarding the data transformation question: you can use the StringReplacer node and convert "false" to "0" and "true" to "1", (you have to do this per column, sorry), then take the StringToNumber node and convert the Strings to numbers. After that you can use the Bitvector Generator, to generate bit vectors from the input. The AssociationRuleLearner will then find rules, where each item represents one column.

Hope that helped.




he find only three association rules. The AssociationRule node with a minimum confidence of 0,5 gives 3 rules.

Regarding the data transformation question: i h've used one StringReplacer node to convert true-values into zeros and a secound one to replace the false-values into 1.. After that i use the StringToNumber node to convert these Strings to numbers. Can I do the transformation in 0 and 1 in one node? And how can i compare 3 diffenrent columns and creat with the 3 columns a new one, for e.g. drinks = if beer=1 and wine=1 and juice=1?

thanks for your help

Hi Hagen,

the logic of the bitvector generator and the association rule learner are vice versa: convert "true" into "1" and "false" into "0".

As already said, the StringReplacer only works for one column.

The last question can be realized with the Java Snippet node. With a statement like:

int result = 0;
if ($beer$.equals("true") && $wine$.equals("true") && $juice$.equals("true")) {
    result = 1;

Append a new column with the name you like (result, consequent or whatever) of type integer and you're done.


If the data only provides 3 results for this settings you may lower the support threshold to get more results.



Hi Fabian

the code with the java snippet works, but i have already a problem with the "assocation rule learner". I didn't get acceptable rules like and the decission tree shows only attributes which i didn't need. I need attributes like earning, age... which i transform with the "number2string" node.

my workspace ist here.


Hi Hagen,

currently I'm quite busy, but I will have a look at it when I'll find some time.



Hello again,

i find my the assoziation rule learner creates rules, but these assoziation rules show only one item in the antecedent?

Furthermore, i want a meshed network where i can see coherences between my goods (eggs, fruits, fish).

an example is here: Mesh

i think the node "parallel coordinates" isn't the right one.


are there news according to my problems?

Furthermore, I have a question to the use of the assoziation rules.
How can i classify a new dataset. I didn't know how i integrate the new dataset into my stream. They should use the assoziation rules and classify them.


Hi Hagen,

we will probably not implement these meshes in near future, sorry.

We only support association rules with one item in the consequent, the number of items in the antecedent is only restricted by the option "maximal itemset length" and the combinations found within your data.

So far there is no possiblity to predict unseen data with association rules, sorry, but we do plan to implement an association rule predictor, although I can't give you any fixed date for this.