The business problem: We have two different vendors that offer personalized recommender engines and want to do A/B testing with them. The recommendation will give the user a personalized offer via a push message on the phone. During the testing period, we should give each provider a dataset with different details regarding the customers (purchase history, in-app events, etc). Each vendor will receive a dataset with identical info but from different clients.

What is the best method to choose the two datasets so that they would be similar in terms of client behaviour?

I assume that giving them random data from our database wouldn't be a rigorous method so one idea that I have in mind is applying dbScan clustering on our database and further randomly picking clients from each cluster - I don't know if this is the best approach. The full database has 200k clients and each dataset should contain 5k clients.

Example: After dbScan clustering there are k=10 clusters so I randomly pick elements from each cluster and split them into Dataset01 and Dataset02.

Any suggestions?


1 Answer 1


Welcome @Remus Raphael :) - Your approach is a sound option.

More specifically, if a density-based algorithm was already working for you, I'd recommend the HDBSCAN clustering algo, which should have a better performance and has a unique built-in cluster validation (based on the DBCV algorithm).

Then your general pipe line could be:

  1. An optional pre-processing
  2. An optional NLP / TFIDF for meaningful text features
  3. An optional dimensionality reduction (I found TSNE and TruncatedSVD to work nicely with HDBSCAN with textual processing)
  4. HDBSCAN tuning for different params and distance metrics
  5. Finally, when you're satisfied with the clustering quality - you can simply start with the 2 largest clusters for your AB testing

I'd love to hear you feedback on your actual data :)

  • $\begingroup$ Thank you for your answer! Very detailed explanation! Do you think it would be best to 1) choose sample data from the 2 largest clusters OR 2) include data from each cluster to have diversity and equally put it in the 2 testing Groups? $\endgroup$ Commented Jan 21, 2019 at 8:11
  • $\begingroup$ Assuming your measure of success is client actual purchases or PPC/PPV. I assume the whole purpose of clustering is to try and make sure each vendor gets a different client segment (so you can measure their success?) - If so then stick with original plan. If not, and you have another way of tracking back a success to a vendor, then why not send them both the top N clusters and let them compete? (like kaggle.com does). BTW, why sampling? is there a limitation of dataset size from the vendors' side? $\endgroup$
    – mork
    Commented Jan 21, 2019 at 8:27
  • $\begingroup$ We have a limitation on the dataset size from our side. We will send personalized push notifications. The goal is to have 2 different client groups that are similar in terms of profile, past transactions but also covers client diversity (low income, high income, high-frequent, low-frequent etc.) -> Maybe weighted clustering would be a solution. $\endgroup$ Commented Jan 21, 2019 at 9:07
  • $\begingroup$ I see, in that case then sample all N clusters and randomly split it between the 2 vendors. Then, track measure of success on your side (which provider's ad was pushed and was successful). You can set the min_cluster_size threshold to the size of those diverse groups your interested with, and then sampling all clusters should do the job for you (auto weighted for you). min_cluster_size $\endgroup$
    – mork
    Commented Jan 21, 2019 at 9:32
  • $\begingroup$ Your'e welcome and good-luck :) If you find this answer helpful please consider accepting it later $\endgroup$
    – mork
    Commented Jan 21, 2019 at 10: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.