This method is based on the assumption that if two items are bought together most of the time, then they are likely to be similar or at least belong to the same category of items that are usually purchased together.
For example, if people are using shaving gel and a razor together most of the time, then if someone buys a razor, it makes sense to suggest that person will buy shaving gel as well.
Let's analyze the historical buying patterns of these four users:
Razor | Apple | Shaving cream | Bike | Hummus | |
Mike | 1 | 1 | 1 | 0 | 1 |
Taylor | 1 | o | 1 | 1 | 1 |
Elena | 0 | 0 | 0 | 1 | 0 |
Amine | 1 | 0 | 1 | 0 | 0 |
This will create the following co-occurrence matrix:
Razor | Apple | Shaving cream | Bike | Hummus | |
Razor | - | 1 | 3 | 1 | 1 |
Apple | 1 | - | 1 | 0 | 1 |
Shaving cream | 3 | 1 | - | 1 | 2 |
Bike | 1 | 0 | 1 | - | 1 |
Hummus | 1 | 1 | 2 | 1 | - |
The preceding co-occurrence matrix summarizes the likelihood of buying two items together. Let's see how we can use it.