## 3 Actions, Activities and Behaviours
### Semantic Embeddings for Action Representation  
Traditionally in activity recognition or behaviour modelling tasks, the inputs (when using actions) have been represented as IDs, strings or one-hot vectors. The problem with this type of representation is that it does not contain any information about the action meaning. Using a one-hot vector alone, it is not possible to compute how similar two actions are, and this information is not available for the model that will use the actions. A similar problem occurs in the area of natural language processing (NLP) with the representation of words. The solution to this is to use embeddings [34] to represent the words, and we have used the same approach for the actions.  
While one-hot vectors are sparse and the features of the model increase with the action dictionary size, embeddings are dense and more computationally efficient, with the number of features being constant, regardless of the number of action types. Most significantly for our model, embeddings provide semantic meaning to the representation of the actions. Each action is represented as a point in a multidimensional plane, which place them at a distance of the other actions, thus providing relations of similitude and significance between them. It is important to note that the system proposed in this paper does not compute explicitly the distances between the actions as an input for the model. Figure 2 shows an example of action embeddings. Given a sequence of actions \(S_{act}=[a_{1},a_{2},...,a_{l_{a}}]\), where \(l_{a}\) is the sequence length and \(a_{i}\in\Re^{d_{a}}\) indicates the action vector of the \(i\)th action in the sequence, we let \(Context(a_{i})=[a_{i-n},\ldots,a_{i-1},a_{1+1},\ldots,a_{i+n}]\) be the context of \(a_{i}\), where \(2n\) is the length of the context window. We let \(p(a_{i}|Context(a_{i}))\) be the probability of the \(i\)th action in the sequence for action \(a_{i}\). The target of the model used to create the embeddings is to optimize the log maximum likelihood estimation (logMLE):  
\[L_{a}(MLE)=\sum_{a_{i}\in S}\log p(a_{i}|Context(a_{i})) \tag{1}\]  
In our model, we use the Word2 Vec algorithm proposed by [PERSON] et al. [34] to calculate the embeddings, a widely used embedding model inspired originally by the neural network language model developed by [PERSON] et al. [35]. Word2 Vec has been used successfully in recent years in very varied tasks, such as knowledge path extraction [36], sentiment analysis [37] or sentence classification [38]. This combination of positive results and an easy to perform unsupervised learning process are the reason why we have decided to use the Word2 Vec algorithm. In our model, we use the Word2 Vec implementation in Gensim to calculate the embedding values for each action in the dataset. Gensim is one of the most popular Python vector-space modelling libraries. We represent each action with a vector of 50 float values, because of the small number of action inst  
Figure 2: Representation of actions as embeddings.  
number of words that are usually used in NLP tasks. Instead of providing the values directly to our model, we have included an embedding layer as the input to the model. In this layer, we store the procedural information on how to transform an action ID to its embedding. Adding this layer allows us to train it with the rest of the model and, in this way, fine-tune the embedding values to the current task, improving the general accuracy of the model.