Next Product to Buy – NPTB

Next Product to Buy (NPTB) / Product affinity analysis has transformed the retail businesses by suddenly throwing open new insights from data that were not captured by them. This knowledge has empowered the retailers with an ability to understand their business better and use these insights for accurate decision-making. Instead of sending spams to consumers mail box, they can send relevant mail or start new promotions which are relevant according to the purchaser shopping habit.

Various tools are available to analyze the consumer behavior and even you can write your own code to do the analysis. Before proceeding, we should understand the problem well. With all these tools, we arrived at a pattern where we can understand the patterns through which a retailer can increase its profit.

Understand the Pattern

We should understand that their is some purchasing pattern or structure which mean if consumer who buy one product are likely to buy one or more related products. For example, with the shopping of bread, it is more likely that he should buy butter or egg with them. Retailers got to know some rare pattern with this analysis. Large US supermarket chain which discovered a strong association for many customers between a brand of babies nappies (diapers) and a brand of beer. Most customers who bought the nappies also bought the beer. The best hypothesisers in the world would find it difficult to propose this combination but this analysis showed it existed, and the retail outlet was able to exploit it by moving the products closer together on the shelves.

The items a customer brought during one shopping trip makes up the market basket. The various items in a market basket are correlated with each other with varying frequencies, presenting a picture of what may have driven the shopping trip. It also calculates the probability of purchasing one or more items along with a item. More the probability, more likely the chance customer would buy that one or more items.

Terminology – Basics

Basket – Number of items a customer brought during one shopping trip. Every basket has unique number, which we called Order Number.In an basket, an item can exist in multiple numbers.

Item – A single entity which customer brought.

Transaction – An instance of buying group of items occurring together.

t = {i_2, j_1, k_5, ……, z_1)

In above example, in transaction t, a consumer brought item i 2 times, item k 5 times and so on. This complete set of item makes an basket.

Rules – are in the statement for like

{i, j} => {k}
{a} => {b, c, d}

Above example illustrate on purchase of item on LHS i and j it is more likely that a customer would buy item (RHS) k or on purchase of item a (LHS), a customer would buy item b ,c and d (RHS).

Base – Base is the count of distinct customer who bought the same item. This will later help us to calculate the probability of purchasing one or more items along with the already purchased item.

Support – Support of an item or item set is the fraction of transactions in our data set that contain that item or item set. In general, it is nice to identify rules that have a high support, as these will be applicable to a large number of transactions. For super market retailers, this is likely to involve basic products that are popular across an entire user base (e.g. bread, milk). A printer cartridge retailer, for example, may not have products with a high support, because each customer only buys cartridges that are specific to his / her own printer.

Confidence – The probability that a transaction that contains the items on the left hand side of the rule (in our example, pencil and paper) also contains the item on the right hand side (a rubber). The higher the confidence, the greater the likelihood that the item on the right hand side will be purchased or, in other words, the greater the return rate you can expect for a given rule.

Lift – The probability of all of the items in a rule occurring together divided by the product of the probabilities of the items on the left and right hand side occurring as if there was no association between them. For example, if pencil, paper and rubber occurred together in 2.5% of all transactions, pencil and paper in 10% of transactions and rubber in 8% of transactions, then the lift would be: 0.025/(0.1*0.08) = 3.125. A lift of more than 1 suggests that the presence of pencil and paper increases the probability that a rubber will also occur in the transaction. Overall, lift summarises the strength of association between the products on the left and right hand side of the rule; the larger the lift the greater the link between the two products.