1
$\begingroup$

I am looking for suggestions on how I might construct features that would encapsulate the timings/order of events (ultimately, to be used to predict a future event)

Background

I have timestamped interactions between customers and a business:

Customer  Date    Code   Interaction
------------------------------------------------
Donald    1 Jan   A      letter sent: change of T&Cs
Donald    2 Jan   B      letter sent: notification of fine
Donald    3 Jan   C      customer pays fine
Donald    4 Jan  *Y     *customer files complaint (about fine)
------------------------------------------------
Theresa   1 Jan   D      customer applies for product
Theresa   2 Jan   E      application rejected
Theresa   3 Jan   F      customer files complaint (about rejection)
------------------------------------------------
Angela    1 Jan   B      letter sent: notification of fine
Angela    2 Jan   D      customer applies for product
Angela    3 Jan   E      application rejected
Angela    4 Jan  *Y     *customer files complaint (about fine)

I would like to use this data to predict how likely Y will occur within some timeframe, given what has occured up until now.

If I use the shopping basket analogy, the logistic regression model can be used to predict if item Y will be in the basket given that item A is present, or if item B is present, etc. In my context, it can be used to predict if a complaint (about fine) will happen in a customer jounrey given that interaction A has occured, or if interaction B has occured, etc.

However, with a customer journey, the combination of events (and even the order in which they happen) are likely more important than the individual events themselves.

Question

What new features can I generate that would encapsulate the chronological order of customer-business interactions?

Current solution

My convoluted solution is to one-hot encode each customer journey:

  • Does A occur? A
  • Does B occur? B
  • Does A happen at any point after B? A>B
  • Does B happen at any point after A? B>A
  • etc.

and then use logistic regression.

Customer | A   B   C   A>B  B>A  A>C  C>A  B>C  C>B  A>B>C | Y
---------+-------------------------------------------------+----
Donald   | x   x   x   x         x         x         x     | 1
Theresa  |                                                 | 0
Angela   |     x                                           | 1

Does my solution sound sensible? Are there any better suggestions?

Bonus points if there's a suggestion that encapsulates the time elapsed between subsequent events.

$\endgroup$
  • $\begingroup$ +1 for the question. Can it be assumed that you have relatively low number of possible events and rather big dataset? $\endgroup$ – Tim Mar 6 '18 at 14:52
  • $\begingroup$ @Tim - with the data in its current form, the number of possible events is very large. I aim to group/categorise events to reduce the total number while not making it too generic (but this would be a separate exercise). Given that there are a large number of events, the event of interest itself (complaint) is rare, and so this is quite an imbalanced data set. $\endgroup$ – Ben Mar 6 '18 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.