# More details on weka association rules

What are those values right to the itemsets (for example [A=1]:18) If they are absolute support as I thought, why are they different for same items in different rules ?

[A=1]: 18 ==> [B=1]: 6 <conf 0.33)> lift 52.63)
...
[B=1]: 38 ==> [A=1]: 6 <conf 0.16)> lift 52.63)


Clearly I'm missing something here, I really hope you can help me please.

The confidence of an association rule $X \rightarrow Y$ is defined as

$$\mathrm{confidence}(X\rightarrow Y) = P(Y \mid X) = \frac{P(X \wedge Y)}{P(X)}.$$

Here, $P$ denotes probability (also known as support in the context of association rules).

Let $\mathcal D$ denote the database of transactions $t$, where each transaction consists of a subset of items.

You can calculate $P(X)$ in the following way:

$$P(X) = \frac{\mid\{ t \in \mathcal D \mid X \subseteq t\}\mid}{\mid \mathcal D \mid}.$$

In your example output, there are $6$ transactions that contain both $A = 1$ and $B = 1$. This value is inherently the same for $\mathrm{confidence}(A = 1 \rightarrow B = 1)$ and $\mathrm{confidence}(B = 1 \rightarrow A = 1)$. Furthermore, there are $18$ transactions that contain $A = 1$ and $38$ transactions that contain $B = 1$.

These values result in $$\mathrm{confidence}(A = 1 \rightarrow B = 1) = \frac{6}{18} \approx 0.33$$ and $$\mathrm{confidence}(B = 1 \rightarrow A = 1) = \frac{6}{38} \approx 0.16.$$.

• thanks for your time sir, So you are basically saying that the integer value before the confidence is the support count of the itemset from wich the rules is derived ?? Nov 21, 2015 at 17:19
• @GionJh Right, there are six transactions with A=1 and B=1. Nov 21, 2015 at 17:21
• Is this true in general, I mean the fact that weka prints a rule like this: [X ] support count od X -> [Y] support count of Y AND X ?? Nov 21, 2015 at 17:24
• @GionJh I'm not an expert of Weka; I don't know. Nov 21, 2015 at 18:54
• thanks anyway ;), neither am I, but I think it should be like we said. Nov 21, 2015 at 19:46