What methods could someone use to find out what products are most frequently grouped with each other per order? Are there applications that can make achieving this goal easier?

  • 2
    $\begingroup$ What research have you done? $\endgroup$
    – Emre
    Aug 6, 2016 at 21:00

1 Answer 1


This is called Association Learning. Quoting Wikpedia:

Association rule learning is a method for discovering interesting relations between variables in large databases. It is intended to identify strong rules discovered in databases using some measures of interestingness

So, your question asks about how companies like Amazon and Walmart know what products are frequently bought together. So, that is done by the Apriori algorithm, which falls under the class of Association Learning algorithms.

Again, quoting Wikipedia:

Apriori is an algorithm for frequent item set mining and association rule learning over transactional databases. It proceeds by identifying the frequent individual items in the database and extending them to larger and larger item sets as long as those item sets appear sufficiently often in the database.

This algorithm generates rules which show what items are bought along with which items, depending on the support and confidence thresholds. (As you didn't ask about the particulars, I would skip the details. Pl check wikipedia for the finer details and the algorithm itself).

The arules package of R implements the apriori algorithm. Unfortunately, there is no fast implementation of the same in Python.

  • $\begingroup$ An algorithm three orders of magnitude faster than Apriori is FP-growth. Don't know about R, but a fast Python 3 implementation is at least in Orange3-Associate package. $\endgroup$
    – K3---rnc
    Aug 7, 2016 at 10:49
  • $\begingroup$ @K3---rnc Yeah, FP-growth is pretty good. But, as the OP asked for a rough overview, I gave the simpler one as an example. You're free to add an answer with the FP-growth algo. though :) $\endgroup$
    – Dawny33
    Aug 7, 2016 at 14:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.