Example
For readability, episodes like are written as .
Yesterday, you monitored 4 activities that you have done for 7 hours.
The 4 events are the following:
- “M” : Listening to music
- “E” : Eating
- “S” : Sleeping
- “C” : Coding
Your day looked like the following:

With the MINEPI algorithm, try to identify the different episodes with the following constraints:
- means that the maximum duration of an episode is 3 hours (3 hours means potentially 4 events).
- means that 2 events must be separated by at least 1 hour. Simultaneous events are not allowed.
- means that an episode must be present at least 2 times in the dataset.
Solution
Episodes of size 1
The first step is to identify frequent episodes of size 1. In our example, we have 4 events, so we have 4 episodes of size 1.
The candidate episodes of size 1 are:
- is present 3 times:
- is present 2 times:
- is present 1 time:
- is present 3 times:
Therefore, the frequent episodes of size 1 are:
Episodes of size 2
Starting here, we don’t have to look anymore at the sequence, we can just compute each frequency by looking at the size 1 results.
The candidates are, all the combinations of , and .
- is present 2 times:
- is present 2 times: (not because )
- is present 3 times:
- is present 1 time:
- is present 1 time:
- is present 1 time:
- is present 2 times:
- is present 2 times:
The frequent episodes of size 2 are:
Episodes of size 3
The candidate episodes of size 3 are:
Note that if was not in , having and would not have been sufficient to have in .
- is present 1 time:
- is present 1 time:
- is present 2 times:
- is present 1 time:
- is present 1 time:
The last frequent episode of size 3 is:
Episodes of size 4
They are no candidates for episodes of size 4.
Conclusion
The frequent episodes are:
Source:
Mannila, Heikki et al. “Discovery of Frequent Episodes in Event Sequences.” Data Mining and Knowledge Discovery 1 (2004): 259-289.