Apriori: new or well forgotten old

    Recommended (they are also recommended) systems have been used in e-commerce for about 20 years. We can see the most successful examples among giants Amazon and Taobao. But what about offline retail? Are these existing recommendation systems applicable to it? And is there an alternative?

    The task of the Datawiz team was to create a similar recommendation system for offline retail. All that we had - customer data held by retailers - various loyalty programs.

    A non-standard solution was found right away - the old, good and proven Apriori algorithm . Want to learn how to use pair analysis in a new way? Welcome to cat.

    Let's look at one examplepair analysis according to the loyalty program of an electronics store.

    The example is sketchy, do not blame me.

    So, Igor and Sasha are regular customers of the same chain supermarket, they are participants in the loyalty program and they have discount cards for this store.

    These are their purchases:

    Standard solution : If we apply the classic pair analysis to these receipts, then the Apriori algorithm will analyze each individual shopping basket (each individual receipt). The algorithm will calculate all possible pairs in each check; the likelihood and frequency of purchasing these products together.

    In our example, Apriori will detect one obvious pair“TV - Adapter”, with a high probability and frequency of purchase. But is it? Just one pair?

    Our solution : the algorithm is the same - the approach is different. Interesting?

    STEP 1

    We combine all Igor’s checks into one check. We also act with the checks of Sasha and other customers from the loyalty program. We get the number of checks equal to the number of customers participating in the loyalty program.

    STEP 2

    After we combined the checks for each client, we apply the Apriori algorithm to them. The algorithm still highlights the pair “TV-Adapter”, as often bought. But at the same time, he gives out other pairs with a high probability of purchase that were previously invisible: “TV-Audio System”, “Adapter-Audio System”, etc.

    STEP 3

    We determine the time distance between events, that is, the interval between purchases of the pairs we found. This value will be averaged. For pairs “TV-Audio System” and “Adapter-Audio System” this interval will be 1 year 4 months ((1 year + 1 year 8 months) / 2).

    So, we found pairs that are “scattered” in time (well or so - distributed over a long period of time).

    Why do we need this and “what do we have from this goose”? :)

    By applying the Apriori algorithm to the data on the loyalty program and finding these “scattered” pairs, we can create a recommendation system.

    For example, for each new customer who purchases a TV or Adapter, after about 1 year 4 months. You can make an advantageous offer to purchase an audio system.

    At the output, we will have a table with recommendations: when and with which client to contact, and what to offer him.

    Further, the choice is the direct marketing tool: e-mail, sms, phone call - all means are good.

    The use of pair analysis of data on loyalty programs for different types of retail:

    In electronics retailers, pair analysis according to the loyalty program is best done not by product, but by product category. Since there is a constant replenishment of the assortment, a change and expansion of the model series.

    For clothing retail, a new pair analysis method should also be carried out by product categories. This is due to the short life cycle of the product (change of collections, brands and other specifics of this industry).

    In food retail, pair analysis based on a loyalty program is also applicable.
    Here, the frequency of purchases is very high, but the easier it is to identify patterns (customer patterns) of customers. Although the steam will be much more.

    Example: a client thoroughly “charges” once a week - on Saturday, but in the middle of the week (Tuesday-Wednesday) constantly comes for yogurt, buns and other “goodies”. If the retailer offers this customer a good discount on yogurt muffins on Saturday, the customer is unlikely to resist this offer because he would have bought them anyway. And by Wednesday, the yogurt will end safely and the customer will come to the store again, because this is a habit :).

    Why is this all?

    The discovery of typical shopping patterns and those pairs that cannot be detected using classical pair analysis is a source of additional profit for the company.

    Well, the better you know your customers, and the more personalized your communication with them is, the higher your loyalty. After all, it is for this that loyalty programs exist, aren't they?

    PS About the paired analysis for retail we have an article on Habré. (How, using the Apriori algorithm, we analyze shopping baskets and identify paired goods (key and related), and what is the practical application of such analysis when placing goods on the trading floor).

    Be sure to also read our next article, “Clustering: Tell Me What You Buy, and I'll Tell You Who You Are”.

    Good to all!

    Also popular now: