Consider the following data set: The above table shows the quantity of each item used in the orders SO1 SO2 etc. I need to club the orders in such a way that maximum number of items are common amongst them. For example:


SO1 SO3 SO5 can be clubbed for 8 items ( Item 1,2,3,5,6,8,9,11) and SO2 and SO4 can clubbed together because 9 items are common ( Item 1,3,4,5,6,8,9,10,11).

The approach I followed was: I found out the number of combinations possible as in (SO1 SO2), (SO1 SO3), (SO1 SO4)……(SO1 SO2 SO3), (SO1 SO2 SO4),….(SO1 SO2 SO3 SO4),…(SO1 SO2 SO3 SO4 SO5). For n number of SOs I would be getting around 2^n -n -1 combinations. Later I compared the data in each combination for equality.

Based on the number of matches, I thought I would be able to select the combinations. But this process would become cumbersome for 300 shop orders with around 2000 items. And it is taking a lot of time to compute as well.


1 Answer 1


Have you tried using frequent itemset mining?

It finds the most frequent item combinations.

The key idea is that when item A is not frequent, you don't need to further explore any combinations including A.

  • $\begingroup$ In frequent itemset mining it only cares about whether the item is present or not in the order.It does not consider the quantitiy of the item needed. $\endgroup$
    – learner_78
    May 29, 2019 at 9:20
  • $\begingroup$ Not have you explained if it matters, and how it should be taken into account. There are ways to enhance FIM with quantity information - it's usually just so expensive that you'd rather analyze this in postprocessing. $\endgroup$ May 29, 2019 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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