1. A computer-implemented method of controlling an apparatus comprising: monitoring a stream of events occurring at the apparatus and, for each event, detecting a plurality of features describing the event, at least some of which are related in a hierarchical manner; creating and storing in memory a graphical data structure comprising a plurality of variable nodes connected by edges, wherein the features describing the event are represented by variable nodes and the variable nodes are connected such that sequences of connected variable nodes represent the hierarchical relations between features; storing at each variable node of the graphical data structure, statistics describing a probability distribution representing a latent event score; arranging a training engine to update the statistics on the basis of the monitored event by using a Bayesian machine learning process and also such that latent event score information is propagated along the sequences of variable nodes which represent the hierarchical relations; predicting an event using the graphical data structure and using the predicted event to control the apparatus.