# Using Keystroke Dynamics in a Multi-Agent System for User Guiding in Online Social Networks
## 3 System Description  
In this section, the new analyzers capable of performing sentiment and stress analysis on keystroke dynamics data will be presented, and also their implementation and evaluation will be shown. Moreover, we show the final architecture of our enhanced MAS after the integration of the new agents and explain the process of user guiding, which employs the advisor agent. We designed agents that can perform sentiment analysis and stress analysis on keystroke dynamics data, and we implemented and integrated them into a MAS that contains agents capable of performing sentiment and stress analysis on text data, initially presented in [7]. This MAS guides users by analyzing their data when they post a message in a SNS and generating feedback when necessary to prevent potential negative outcomes. The MAS was built using the SPADE Multi-Agent platform [17], and every agent performs a different role in the system. There are agents that retrieve data from users in a SNS and also give back the feedback of the MAS to the users, other agents are in charge of the analyses and feedback generation. Finally, there is an agent in charge of data storage and retrieval in the MAS. A general view of the proposed extended MAS architecture can be seen in Figure 1.  
There are four analyzer agents in the MAS, which are the text sentiment analyzer agent, the text stress analyzer agent, the keystroke dynamics sentiment analyzer agent, and finally, the keystroke dynamics stress analyzer agent. The four agents have similarities and differences, but they all take either text messages or keystroke dynamics data as input and give a sentiment polarity or stress level class label as output. The classes for sentiment polarity are \"positive\" and 'negative\", and those for stress levels are \"stressed\" or \"no stressed\". We built the different analyzers using a feed-forward ANN trained with Tensorflow ([[https://www.tensorflow.org](https://www.tensorflow.org)]([https://www.tensorflow.org](https://www.tensorflow.org))) version 1.8.0 and Keras ([[https://keras.io](https://keras.io)]([https://keras.io](https://keras.io))) version 2.2.0 in the language Python, in its version 3.5.2. For training the ANNs for the analyzers, two datasets were constructed, made with short text messages and with keystroke dynamics samples of users typing messages, respectively. The samples in the datasets were labeled with an emotion label from a set of five emotions inspired in the PAD temperament model [18] (happy, bored, relaxed,  
Figure 1: Architecture of the multi-agent system (MAS). anxious, and angry), and also labeled with a label of \"stress\" or \"no stress\". The dataset was built by users of our SNS Pesedia, who as stated before were both male and female, and had ages compressed in the 12-15 years old range. It was made using self-reporting of the users that wrote text messages in the SNS. This labeling process was not mandatory; thus, only the messages that were labeled were inserted into the dataset. Moreover, for being able to train ANNs that consider only two sentiment classes, a mapping was made from five emotions with \"negative sentiments\" and \"positive sentiments\", based on the values of pleasure, arousal, and dominance of these five emotions in the PAD temperament model. The mapping is the following:  
1. Happy: Mapped as positive sentiment. 2. Bored: Mapped as negative sentiment. 3. Relaxed: Mapped as positive sentiment. 4. Anxious: Mapped as negative sentiment. 5. Angry: Mapped as negative sentiment. The functionality of the individual agents in the MAS is the following:  
* Presentation agent: This agent receives data from users navigating in a SNS through certain widgets that are used by users to interact with the system. Then the agent sends this data of text and keystroke dynamics to the analyzer agents. It also receives the feedback generated by the advisor agent and sends it back to users navigating the SNS. * Sentiment analyzer (text data): This agent computes a sentiment polarity (positive or negative), using text data.