# Learning and Mining Player Motion Profiles in Physically Interactive Robogames
## Mathematical Preliminaries
### Autoencoder  
In many problems, we may have to deal with highly dimensional data that represent the situation of the world as captured by the sensors. Given that the raw data dimensionality could be practically intractable, the common procedure in these cases is to reduce the dimensionality possibly keeping only the important features of the input data. In image processing, for instance, understanding which pieces of an image represent a significant aspect for the task ahead is not a trivial issue. Significance may be related to specific parts of the image and may depend on many aspects. A common technique to face this issue is autoencoder. Autoencoder is an unsupervised learning technique that learns a representation of the input data, usually derived by means of non-linear transformations of the input [18]. A typical implementation of autoencoder consists of a feedforward neural network that first encodes the input into a code, the representation and then reconstructs the input from it by means of a decoder (see Figure 3). Figure 2: Latent Dirichlet Allocation (LDA) model diagram [19]. Each word \(w_{d,n}\) corresponds to a GASF encoding obtained from an accelerometer attached to the player during game play. In turn, a game play is interpreted as a document \(d\) (set of player-generated words, i.e., action patterns). \(z_{d,n}\) represents the type (topic) assignment for a given word \(w_{d,n}\), and \(\theta_{d}\) is the mixture proportions representing the game session. In this work, we are interested in representing the player game session by \(\theta_{d}\). In general, autoencoders are good at capturing the structure of the input and tend to represent it well [18]. We can represent an autoencoder as a neural network that tries to copy its input to its output. We can represent its general architecture with the following terminology:  
* the input \(x\),
* the encoder function, \(f(x)\), composed of some hidden layers,
* the code, or internal representation, of the input \(h\),
* the decoder function, \(g(x)\), composed of other hidden layers,
* the reconstruction obtained from the decoder, \(r\). A loss function, \(L(x,r)\), should also be defined to evaluate how close the reconstruction is with respect to the input. A simple loss function is shown as Equation (5). \[L(x,r)=\sum_{i}(x_{i}-r_{i})^{2} \tag{5}\]  
However, if we do not impose any restriction, the transformation it learns would be an identity, since this would perfectly reconstruct the input. To prevent this transformation, two approaches have been devised [18]. The first, called undercomplete autoencoder, adopts a representation smaller than the input (see Figure 4a), while the latter, overcomplete autoencoder, uses a representation with a dimension larger than the input (see Figure 4b). Although increasing the representation size is counterintuitive in order to sparsely represent the input, this technique has proven its effectiveness. The undercomplete autoencoder is the oldest and best known architecture for the autoencoder and also the one we use in our work. The code the autoencoder derives is smaller than the input: it learns how to combine the input so that the relevant information is retained in a lower dimensional space. The combination is often non-linear due to a non-linear activation function of the neurons. Figure 4: (a) Representation of an undercomplete autoencoder, where the representation has a lower dimension with respect to the input. (b) Representation of an overcomplete autoencoder, which uses a larger space to represent the input. Figure 3: General architecture of an autoencoder; the input layer is processed by an encoder that transforms it. The derived representation is then decoded by a decoder that yields a reconstruction. On the other hand, the decoder function learns how to unroll such compressed code in order to obtain an extended representation. This architecture could be trained using the classic back-propagation approach, although different methods are available [18].