# Using Keystroke Dynamics in a Multi-Agent System for User Guiding in Online Social Networks
## 3 System Description
#### Keystroke Dynamics Analyzer Agents
Four commonly used keys are also used as frequency of pulsation features, completing the set of frequency features, which are enter, space bar, shift, and caps lock. Since they are commonly used keys, the differences in the frequency of pulsation might be informative for the machine learning model for predicting sentiment polarities and stress levels, since these states of the user could affect the frequency in which they are used. The feature vectors, which are fed to the ANN shown in Figure 2, are vectors of floating-point numbers, corresponding to the presented text typing speed features, followed by the key frequency features, in the order in which they are shown in Table 1.  
These data were collected in our SNS Pesedia during a period of one month, and the users were able to self-report on their emotional states and stress levels, adding finally to the dataset only the samples in which the reports of the user states were actually done. These data were later processed with a Python script to generate a file that could be used to conveniently feed the ANNs with arrays with the data on the different characteristics, and for eliminating any potential missing data to ensure correctness before starting the training and validation process of the models. The file contains a total of 12,313 data samples. For training the models used in the final system, 10% of the data samples were used for training and 90% for the validation of the models. In the architecture of this ANN, the array containing the keystroke dynamics data in the form of floating-point numbers is fed directly to the first dense layer. In Figure 2 we can see that there are three dense layers in the architecture of the ANN, with two dropout layers placed between the dense layers acting as a regularization mechanism. The dropout rate of 0.25 in both dropout layers and the architecture of the network were both adjusted experimentally aiming for better accuracy, and for a confusion matrix that showed an equilibrated distribution between the two classes. Several other parameters of the ANN were also adjusted experimentally, which were the sigmoid activation function being used in the dense layers, the inputs, outputs, and neurons of each layer, using binary crossentropy as the loss function for training, and using an Adam optimizer [19]. The inputs in the dense layers are in order: 25, 64, and 64--with outputs and neurons 64 in all three except in the final dense layer, which is 2. The input vector is the array with the selected features explained in this section; the output \begin{table}
\begin{tabular}{c c} \hline \hline
**Text Typing Speed Features** & **Key Frequency Features** \\ \hline key press & enter \\ key release and press interval & space bar \\ key press and second press interval & back space \\ key release and second release interval & delete \\ key press related to digraphs & key up \\ key release and press interval related to digraphs & key down \\ key press related to trigraphs & key left \\ key release and press interval related to trigraphs & key right \\ digraph typing & shift \\ trigraph typing & home \\ general typing speed & end \\  & page up \\  & page down \\  & caps lock \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Text typing speed and key frequency features used to train the models. Figure 2: Architecture of the ANN for the sentiment analyzer agent with keystroke dynamic data. 2 in the final dense layer represents the two possible classes (negative and positive sentiment polarity); and finally, the rest were adjusted experimentally as explained before. The dropout layers have the same input, output, and neurons of 64 since they are connected between dense layers, acting as a regularization mechanism.