Discovering patterns in sequences of events