# How do I predict a set of frequently bought items?

I have a dataset of retail transactions wherein different users buy certain items together. For example, a user A buys a toothpaste, a toothbrush and a floss at the same time, and a user B buys a toothpaste, a shampoo and a soap together.

I'm required to find out for each item in the dataset a list of items that are frequently bought together with it. For instance, one may expect that whenever a toothbrush is purchased, a toothpaste can be one of the items that are frequently bought together with it.

I tried to make use of the Apriori Algorithm but that would only give me sets of items that are bought together or, I'm unaware if it can somehow be modified to predict frequent purchases for a list of items in the dataset.

Which other algorithm can I put to use here?

The simplest way is to build a matrix representing how often two items are bough together: $$M[i,j]$$ is the count of how many times items $$i$$ and $$j$$ are bought together (note that you need to fill only a diagonal matrix, since it's symmetric).
From there you can calculate whatever you need: most frequent $$B$$ item bought with a given item $$A$$, top most frequent pairs of items in general, etc.