About ElecMart

ElecMart, as the name suggests is a supermarket for Electronics. They serve the needs of both, retail clients and various corporate clients. Customers not only get to see and feel a wide range of products, they also receive exciting discounts and excellent customer service. ElecMart started in 1999 and launched a customer loyalty program in 2003. ElecMart aims to be largest Electronic superstore across the nation, but they have a big hurdle ahead!

The problem - Where are the recurring buyers?

The loyalty program is meant for customers who want to take benefit from repeat purchases and register at the time of purchase. They need to present the loyalty card at Point of Sale at time of purchase and the benefits are non-transferrable. Also corporate sales automatically get the benefits of the loyalty program. In a recent benchmarking activity and market survey which ElecMart sponsored, it was found that the "Repeat purchase rate" i.e. customer who come again for purchases from these customers is very low compared to other competitors. Increasing sales to these customers is the only way to run a successful loyalty program.


Transaction_ID Unique ID of the transaction. Can not be used for modeling

Transaction_Date Date on which the transaction took place

Store_ID ID of the store in which the purchase was made

Number_of_EMI Number of EMI opted by the customer

Purchased_in_Sale Whether the transacted item was under offer

Var1 - Var3 Masked categorical variable

Client_ID Unique ID of the customer making the purchase.

Gender Gender of the customer

DOB Date of Birth of the customer

Referred_Friend Whether the customer referred a friend at time of purchase

Sales_Executive_ID ID of the Sales executive who helped the customer with

the purchase

SALES_Executive_Category Category of the sales executive who helped the

customer with the purchase

Lead_Source_Category Channel from which the customer came to know about

the store and made the purchase (last source attribution)

Payment_Mode Mode of the payment for the transaction

Product_Category Category of the product purchased

Transaction_Amount Amount of the transaction

**If You are expected to identify the probabilty of the each customer (in the

loyalty program) making a purchase in next 12 months.**

Kindly Guide Me which model will be suitable here and what dependent variable i

should use?


2 Answers 2


If all you're trying to do is identify the most frequent/recurring buyers, then the answer should be as simple as putting the data in a relational database (or if it's a lot of data, then Hadoop for Spark) and doing a simple SQL query to get the top ranked customers:

select Client_ID, count(*) as count from
    (select distinct Client_ID, Transaction_Date from table) as table2
group by Client_ID order by count desc

However, I suspect that what you're really asking is how to get more recurring customers, which is a much more difficult and open ended question to answer. One thing you could do is build an explanatory linear regression model to see which types of product categories are most associated with your frequent customers and then focus your efforts on optimizing customers' experience with those products.

In any case, I don't think a predictive model will help you here. From the raw data it should be clear who your most frequent/recurring customers are.

Edit: Your comment below clarified your question.

Split your data into two parts: a training dataset and a validation data set. Create a binary dependent variable that corresponds to whether someone has made a transaction 12 months after some pre-specified date. Feed multiple combinations of predictor variables into a gradient boosting model (GBM). Gradient boosting will capture interactions between your variables and will enable you to get a quick proof of concept working because most gradient boosting implementations can handle missing variables, so minimal data cleaning will be necessary. I noticed in your profile that you use R. R has a great predictive modeling package called "caret": http://topepo.github.io/caret/index.html.

  • $\begingroup$ You are expected to identify the probabilty of the each customer (in the loyalty program) making a purchase in next 12 months? $\endgroup$ Apr 30, 2016 at 4:41
  • $\begingroup$ Your comment makes the question clearer. I've edited my answer accordingly (see the bottom) $\endgroup$
    – Ryan Zotti
    May 2, 2016 at 13:16

Please correct me, but from what I see in your data you do not have (yet) a dependent variable. To create a supervised learning dataset, you will need to construct a dependent variable yourself, considering, for instance, the timespan between dates that a customer made purchases. You can identify same customers by using their loyalty id.

Thus, for each customer, if their (date sorted) purchase history contains intervals shorter than 12 months, then you can use them to create some positive training examples. All the rest are your negative examples. Cleanup some of the data that are non pertinent, e.g. ID of Client and Transaction, and you can use the rest to build your first classifier.

You might also want to transform some of your independent variables into more useful representations, such as date of birth to age groups etc.

As for models: well, you have a plethora of choice here. Start from linear classifiers, and check performance in cross-validation. If not satisfactory, you may try tree-based classifiers, support vector machines and neural nets.


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