I have purchasing history data for grocery shopping. I am trying to get abnormally frequently purchased items under certain conditions. For instance, I am trying to find frequently purchased items, when customers shop online and are willing to pay an extra shipping fee.

In order to find items that are particularly (or abnormally) frequently purchased under that situation (through online stores by paying shipping fee), how and what Machine Learning Algorithm should I apply and identify those items?

I found arules R package which is using the association rules with purchasing history and tried to apply it. But it seems the package might be based on different principle from my idea.

Anyone has an idea about my problem? If there is an R package related to the problem, it would be perfect.

  • $\begingroup$ This is quite a complex problems requiring very thorough data if you want to predict a new customers behavior..No satisfactory algorithm exists and it is a very hot research field. There are a few approaches but most of them I think you have to manually write the code. $\endgroup$
    – user9947
    Feb 13, 2018 at 16:56
  • $\begingroup$ @DuttaA: the concrete question "find items that are particularly frequently purchased through online stores by paying shipping fee" doesn't seem complex, eve doesn't seems to need applied AI. About prediction of customer preferences, all big online shops has it. See by example Amazon's "customer who buy this item frequently ..." $\endgroup$ Feb 13, 2018 at 17:01
  • $\begingroup$ Your could use clustering techniques such as DBSCAN to identify tendencies (clusters) in buying frequency. I'm not familiar with R, but there's a package for that. $\endgroup$
    – lamontap
    Feb 14, 2018 at 13:48
  • $\begingroup$ @pasabaporaqui i think OP did not frame the question correctly and he is talking basically of a recommend-er system. Statistical approach for prediction will not extend to new users easily. $\endgroup$
    – user9947
    Feb 15, 2018 at 11:40

1 Answer 1


Let start by the concrete question, and follow talking about the general problem.


The concrete question "find items that are particularly frequently purchased through online stores by paying shipping fee" needs few or none usage of applied AI, just a few of statistics.

The question talks about "item purchased" and "buy method", thus, we have an information database with entries like:






(note records can be repeated)

the percentage of online sales of item "X" is defined as the fraction of sales online of this item, sale(online,X), over the total sales of this item, sale(_,X):

enter image description here

In the previous data examples, p(item1)=1/1, p(item2)=2/3.

High p(X) means items that are preferred for online shopping.

Other probabilities can be defined for similar cases.


About the general case, we are talking about data mining. The are very good packages (open source, ...) for them: weka, IBM DWE, ... . By example, using Weka J48 over a database defined as:

sale( purchase_identifier, buy method, item )

where "purchase_identifier" must group item that has been purchased in a single buyout (cash ticket). J48 will then provide as answer rules as: item "foo" is usually purchased in online shop when also item "bar" is purchased.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .