# How to do a 'beer and diapers' correlation analysis

I have data that is equivalent to:

shopper_1 = ['beer', 'eggs', 'water',...]
shopper_2 = ['diapers', 'beer',...]
...


I would like to do some analysis on this data set to get a correlation matrix that would have an implication similar to: if you bought x, you are likely to buy y.

Using python (or perhaps anything but MATLAB), how can I go about that? Some basic guidelines, or pointers to where I should look would help.

Thank you,

Edit - What I have learned:

1. These kinds of problems are known as association rule discovery. Wikipedia has a good article covering some of the common algorithms to do so. The classic algorithm to do so seems to be Apriori, due Agrawal et. al.

2. That lead me to orange, a python interfaced data mining package. For Linux, the best way to install it seems to be from source using the supplied setup.py

3. Orange by default reads input from files, formatted in one of several supported ways.

4. Finally, a simple Apriori association rule learning is simple in orange.

• If you were looking for an R package, arules would be worth a look. Maybe "association rules" is a good search term – Karsten W. Mar 8 '11 at 13:06
• See also the Apriori algorithm for the "standard" approach to this problem. – cardinal Mar 8 '11 at 16:53