← All data exercises

Segment merchants by payment behaviour and predict which will churn

1 table · 1.5M rowsUnlock with Pass

Ledgerly is a payments processor: businesses use it to accept payments from their customers. The data covers merchants that started processing with Ledgerly over a two-year period, 2033–2034, and runs from January 1, 2033 through December 31, 2034. The data is made up (the years are deliberately in the future), but you can treat it as a random sample of merchants using Ledgerly. If a merchant stops processing with Ledgerly, it no longer appears in the data.

Ledgerly knows little about these merchants beyond their transactions, but it wants to understand their payment activity: what kinds of businesses they are, and which of them are leaving.

The data

  • transactions — one row per transaction: merchant (the merchant id), time (when the transaction happened) and amount_usd_in_cents (the transaction amount, in U.S. cents).

Your task

Part 1: kinds of businesses

  1. Using only this data, how would you identify different kinds of businesses in the sample? Describe the features of payment behaviour you build, the method you use to group merchants, and how you chose the number of groups. Assign every merchant to a group.
  2. Give each group a name a business reader would recognise, and explain what in the data supports it. With no ground truth, how did you check that the groups are real and stable, and not an artefact of your features or method? How would you handle merchants with only a few transactions?

Part 2: churn

  1. Come up with a concrete definition of churn. Merchants differ a lot in how often they transact, so explain how your definition copes with that, and how you handle merchants whose last transaction is close to the end of the data. Then identify the merchants that have already churned, and show how sensitive that count is to your definition.
  2. Build a model that predicts which active merchants are most likely to churn in the near future. Define “near future”, explain how you built training labels and features from data that ends on December 31, 2034 without leaking the outcome, how you validated the model, and which signals drive its predictions.
  3. How should Ledgerly use the model? Say who would act on the scores and how, how you would pick a threshold given the cost of contacting a merchant who wasn’t leaving versus missing one who was, and how you would measure whether acting on the scores actually reduces churn. Does churn differ across the groups from Part 1?

What to deliver

A concise report for Ledgerly’s head of merchant success, covering both parts, with an appendix showing the queries or code behind each number. Also provide a table keyed by merchant with each merchant’s group, whether it has churned and, for active merchants, its predicted churn risk.

All company names in this question are fictional.

Data preview

transactionsfirst 5 rows
merchanttimeamount_usd_in_cents
faa029c6b02034-06-17 23:34:146349
ed7a7d91aa2034-12-27 00:40:383854
5608f200cf2034-04-30 01:29:42789
15b1a0d61e2034-09-16 01:06:234452
47700517902034-07-22 16:21:4220203