# Calculating probability on sets

I was reading about calculating the support and confidence in regard to "associate rule mining" and found the following definitions:

An association rule is defined as: $A \rightarrow B$ where $A\subset T$, $B\subset T$, and $A \cap B = \emptyset$.

Support: $c(A \rightarrow B) = P(A \cup B)$. In the other words, Support should be the ratio of the transactions that contains both $\{A\}$ and $\{B\}$ divided by total number of the transactions in the database.

For example, consider the following transactions stored in the Database:

\begin{array}{|c|c|} \hline {\bf ID} & {\bf Transaction} \\ \hline 1 & \{Beer, Dipper, Milk\} \\ \hline 2 & \{Beer, Milk\} \\ \hline 3 & \{Beer, Potato Chips\} \\ \hline 4 & \{Dipper, Cheese, Butter \} \\ \hline \end{array}

So based on the above definitions and description I want to calculate the support for $c(\{Beer\} \rightarrow \{Milk\})$. Therefore, I have to compute the $P(\{Beer\} \cup \{Milk\})$ (the probablity that a given transaction contains Beer or Milk). What is confusing to me is, given that $\{Beer\}$ and $\{Milk\}$ are sets, should I compute the union by constructing the $\{Beer, Milk\}$ set and then compute the probability of $P(\{Beer, Milk\})$ ?

Case 1) If we don't give precedence to union operation before computing the probability: $P(\{Beer\} \cup \{Milk\}) = P(\{Beer\} ) + P(\{Milk\}) - P(\{Beer\} \cap \{Milk\})$

$P(\{Beer\} \cup \{Milk\}) = \frac{3}{4} + \frac{2}{4} - \frac{2}{4} = \frac{3}{4} = 0.75$

Case 2) But if we assume that sets are not events, and we have to compute the union of two sets and then compute the probability:

$P(\{Beer\} \cup \{Milk\}) = P(\{Beer, Milk\}) = \frac{2}{4} = 0.5$

My Question) To me, case-1 is mathematically correct with the information provided, but case-2 is the right answer. Which one is mathematically correct in terms of writing? Is valid to say $P(\{Beer\} \cup \{Milk\})$ = P({Beer, Milk}) since they are sets and not variables?

• The right arrow is used for different operations in different circumstances. What are you using $\rightarrow$ to mean? Oct 7, 2015 at 1:04
• How do you obtain probabilities of the events? e.g. $P(\{Beer\})$? I'm a little rusty in this area but I can't see how you do it. Oct 13, 2015 at 8:34

The second answer is correct - if you think about it, picking a random transaction, 2 of the 4 transactions have beer and milk, and so the probability is $\frac24$.
As for your notation, $P(\{\text{Beer, Milk}\}=P(\{Beer\}\cap\{Milk\})$, and not $P(\{Beer\}\cup\{Milk\})$ (the difference is the direction the cap is pointing).