# CvAMoS--Event Abstraction Using Contextual Information
## 4 Approach
### Step 1: Construction of the Set of Motifs  
The first step of the approach consists of the construction of the set of motifs that will be then verified. In this paper, a motif is not only a sequence of events, but also considers the context. In the event log, we can distinguish between events referring to the execution of an activity, and events that are referring to the state of the environment, usually in the form of continuous measurement (e.g., temperature, noise level). The former is part of the motif, while the latter belongs to the set of attributes of the given motif (i.e., the context). The information regarding which attributes should be considered as environment and which refer to the execution of activities should be provided by the user in the form of an \"attribute map\". Additionally, the attribute map should contain aggregation operators (which indicate how environment attributes are aggregated) as well as the maximum tolerance from the aggregated value. **Definition 5** (Attribute map). : _An attribute map is a triplet \(\mathcal{R}:\mathcal{N}\rightarrow(\mathcal{O},\sigma)\), where \(\mathcal{N}\) is the set of all attribute names (cf. Definition 1), \(\mathcal{O}\in\{\mathit{mean},\mathit{min},\mathit{max},\mathit{equal}\}\) is an aggregation operator, and \(\sigma\) is the maximum approximation tolerance (which is a scalar value). We indicate with \(\mathcal{R}_{\mathcal{N}}\) the set of all attribute names of \(\mathcal{R}\), with \(\mathcal{R}_{\mathcal{O}}^{n}\) the aggregation operator associated with attribute name \(n\), and with \(\mathcal{R}_{\sigma}^{n}\) the \(\sigma\) tolerance associated with attribute name \(n\)._  
For example, given an activity \(\mathit{temp}\in\mathcal{N}\), the attribute map could be \(\mathcal{R}=\{(\mathit{temp},(\mathit{mean},2))\}\) which means that the attribute label \(\mathit{temp}\) should be aggregated using the mean, and values with distance 2 from such a mean should be considered as equal. Therefore, a candidate motif can be defined as follows:  
**Definition 6** (Candidate Motif). : _Given a trace \(t=\langle(a_{1},X_{1}),(a_{2},X_{2}),\ldots,(a_{n},X_{n})\rangle\), a starting index \(i\), a target motif length \(l_{m}\) such that \(1\leq l_{m}\leq n-i\), and an attribute map \(\mathcal{R}\), a candidate motif \(c\) is defined as a tuple \((\tau[i,l_{m}],\mathcal{AT})\) where \(t[i,l_{m}]\) is the sub-trace, and \(\mathcal{AT}\) is the relation  
Figure 1: Overview of the CvAMoS approach. mapping all attribute names contained in \(\mathcal{R}\) to the corresponding aggregated values (according to the respective aggregation function in \(\mathcal{R}\)) computed over \(t[i,l_{m}]\)._  
Considering again the example from the previous definition, the \(\mathcal{AT}\) component of a candidate motif would contain the mean value of all the _temp_ attribute values computed on all events in the sub-trace. **Definition 7**. : _Given an event log \(E_{L}\), a motif length \(l_{m}\), and an attribute map \(\mathcal{R}\), we call \(C(E_{L},l_{m},\mathcal{R})\) the set of all candidate motifs that can be seen on all traces part of \(E_{L}\). To compute all motifs an iterative approach can be adopted, by iterating all traces and extracting all possible motifs for each trace (i.e., all possible sub-traces of length \(l_{m}\))._  
During the construction of a candidate motif, several attributes sharing the same attribute name are identified. However, the following verification task requires a single value for each attribute name. The aggregation operator, defined in the attribute map (see Definition 5), serves this purpose. Hence, these attribute values are aggregated according to the attribute map. A candidate motif, therefore, includes the attribute values already aggregated. The candidate motifs now need to be verified. The verification establishes whether a candidate motif can be considered an actual motif, by checking the requirements of _distance_, _activity cost_, _attribute cost_, and _quorum_.