I'm interested in identifying events (patterns) that occur before an event of interest.

For example, a customer calls in to complain or a customer checks their balance online then the customer closes the account (event of interest). Data is in a form of a sequence of events with a time stamp.

I would like to know what methodologies (and software) people are using for such a task.

I'm open to exact patterns (sequence of events), frequency of events (calls in multiple times to complain), and timing of events (80% of event A leads directly to event of interest within X days). Basically, open to any approach people are using to identify patterns leading up to an event.

Thus far I found the CSPADE algorithm as available in the arulesSequences package in R. It seems to be able to identify sequence of patterns and which items co-occur. However, I don't think one can set a target event for it to find a pattern.

I'm open to algorithms available in R, Python, or SAS.

Thanks so much!

  • 1
    $\begingroup$ All of the models you list are possible, but please specify whether the "timing of events" is important or not. If timing doesn't matter, your problem is one of supervised learning (classification); if timing does matter, you need to use survival analysis. Both are perfectly do-able, but they will lead to entirely different answers (survival will be messier in this case). Unless timing information is critically important to your application, I would recommend using classification models. Please update with this information and you will receive better answers suitably tailored to your problem. $\endgroup$ – ahfoss Jan 27 '14 at 16:41
  • $\begingroup$ As you discovered, Spade and other data mining algorithms won't help you, they aren't made for what you're after. $\endgroup$ – iliasfl Jan 29 '14 at 10:08
  • $\begingroup$ @ahfoss Time component can be incorporated in a classification scheme. In the question's setup you can measure time between events (any event or specific ones); number of events per some unit of time; time from first occurrence of event X from start of customer history; time until first complain in customer life-time, etc. $\endgroup$ – iliasfl Jan 29 '14 at 10:12
  • $\begingroup$ @iliasfl I should have been more specific. My question refers to the outcome variable, not features. Predicting which or whether an event of interest happens requires a classification scheme, whereas predicting time to an event of interest is survival analysis; two substantially different tasks. $\endgroup$ – ahfoss Jan 30 '14 at 13:52

I suppose you have some large training set available.

This problem can be tackled with many different approaches and usually there is a trade-off between how well you can interpret findings/model and how good predictions you can make. I made something similar recently and after having a complex non-linear classifier that worked pretty well, I was asked to identify the exact moments/events that trigger when we should interfere with customers, that was practically too difficult, so I ended up remodelling using trees in order to allow managers understand what's happening in their data. More details follow:

I start with approaches you can use to interpret what's going on: You will need to make a script to extract from the full dataset the sequences of length $n$ that lead to the event you are interested in. If $n$ is low and you have enough data you can measure frequencies of all combinations of events that lead to the event of interest. If situation is a bit more complex and there are no clear winners, you could try visualise these series of events using a tree as a form of a Markov chain. Using some ad-hoc cleaning, like removing edges with $p<0.1$, you could end-up with something actionable.

If interpreting the results is not so important, but the critical thing is to predict if event of interest is gonna happen, then I would go for classic classification. You have series of events that lead to the event of interest (this is your positive class). You make some series of events that didn't lead to the event of interest (that's the negative class). You could have a critirion like "if no event of interest happens after 50 normal events then I consider series a negative". Now features could be the frequencies of events, the frequencies of pairs of events, times between events (speed). You can consider the series of events as series of words and use standard approaches for text classification. Having classes, and features pick a classifier and do some modelling.


Your Answer

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

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