## 3 Materials and Methods
### The Mobile Interactive Coaching Agent
The adopted cumulative function of the frequency of distraction ensures that feedback is provided only after a significant amount of distraction has been detected, avoiding the risk that warnings that are too frequent may cause a distraction. The second approach is to provide feedback only at well-defined milestones for the activity, such as at the end of each chapter or lesson. This requires some information regarding the structure of the document being administered, which can be automatically extracted from the metadata when available. At each milestone, the user is provided with feedback on the attention paid to the content, and if a DW was raised, he or she receives the suggestion to revise some parts of the content, together with the specification of the parts needing revision. Figure 5 shows a very simple case of reading an e-book that takes advantage of the MICA to motivate the user and help focus their attention. The image on the left shows the MICA character while looking at the user. The expression of the character is neutral, although some occasional small movements of the head and eyes contribute to the \"liveliness\" of the character. On the right, the character uses speech synthesis and facial expressions to provide feedback to the user about his or her level of attention while reading. In specific cases, such as when the user is very young or has some cognitive impairments, it has been shown [51] that giving positive feedback (such as smiling and uttering encouraging sentences) to the user may improve his or her engagement and motivation. However, such feedback can be provided only at specific stages of the activity (e.g., at the end of a chapter or a lesson) when the metadata regarding the content are available. Moreover, there are cases (e.g., adult users) in which positive feedback should be avoided, as it may be a source of distraction or disturbance. As a consequence, although the MICA can provide positive feedback, this feedback is not emitted frequently. The choice of the graphical character of the interactive agent was found to be critical for at least some categories of users [53; 54]. As a consequence, the MICA has been designed to take on the appearance of different graphical characters according to the user's preference, and a set of default characters was individuated following the preliminary investigations. Figure 6 shows some of the characters performing different facial expressions. Figure 5: A simple reading application featuring MICA. (**Left**) The agent is observing the user. (**Right**) The agent is providing the user with a feedback about his or her level of attention while reading. Figure 6: The three MICA tested characters. In the MICA, the character animations are synchronized with the uttered speech, either synthetic or sampled, and show human-like facial expressions. Compared with previous work, deictic cues were added to the set of facial animations to facilitate interaction with the user during the coaching process, as shown in Figure 7.  
The first requirement for the MICA refers to its ability to effectively capture the dynamics of the user's attentive state. In other words, the MICA needs to run fast enough to track the changes in the user's attitude that might reveal significant changes in their attention. We chose the frame-processing rate in frames per second (f/s) to measure the processing speed. According to the literature (e.g., [55]), we decided that for the purpose of monitoring the user's attention while reading, 10 FPS could be assumed as the lowest acceptable sampling speed. To assess the ability of the presented approach to meet the first requirement, we ran the MICA on three different hardware architectures that represent a wide range of target devices, namely two different tablet PCs and a Raspberry PI 3B+ board equipped with different ARM processors, different RAM capacities and different cameras. For the sake of comparability, we set the acquired video resolution to 1280 \(\times\) 720 pixels.