{'fraction_non_alphanumeric': 0.030354827301662148, 'fraction_numerical': 0.004361664505481551, 'mean_word_length': 4.974295774647888, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Hierarchical Emotion Regulated Sensorimotor Model: Case Studies

Inspired by the hierarchical cognitive architecture and the perception-action model (PAM), we propose that the internal status acts as a kind of common-coding representation which affects, mediates and even regulates the sensorimotor behaviours. These regulation can be depicted in the Bayesian framework, that is why cognitive agents are able to generate behaviours with subtle differences according to their emotion or recognize the emotion by perception. A novel recurrent neural network called recurrent neural network with parametric bias units (RNNPB) runs in three modes, constructing a two-level emotion regulated learning model, was further applied to testify this theory in two different cases.


Introduction
It is widely agreed that the internal state interacts with, modulates and mediates various cognitive processes including sensorimotor process, in the sense that the sensorimotor expression, for instance, the physical expression as motor primitives, are partially caused by, or co-occur with, emotions. For instance, [1,3,5,7] found that body languages have been found to constitute a signal of affective information. certain subtle general motor behaviours of the human body can be thought of as expressing emotional states. For instance, the tilt angle of head can be linked inferiority-and superiorityrelated emotions [12]. Since such behaviour can be accounted for part of the cortical neural responses from neurotransmitter dopamine modulation (such as arousal), these bodily states tend to be relatively slow to arise and slow to dissipate. This facilitates people to differentiate emotions from observing these subtle behaviours. Conversely, similar as we do in our daily social communication, people are able to recognize others' emotions by their either static postures [23] or dynamic motions [22]. Studies suggested that there exist a hierarchical coding system [2,7,6] or 'critical features' [17] for emotion recognition. From a technical perspective, to obtain a learning model about the relation between sensorimotor behaviours and emotions are also useful to endow an artificial agent (e.g. social robotic platform) 1) to obtain a natural non-verbal emotion expression, and 2) to recognize its counterpart's emotion. Thus, extended by the hierarchical sensorimotor architecture [25], we propose an emotion regulation model based on the perception-action model(PAM) theory [15]. A twolevel neural learning model will be used to realize such an architecture. This neural model will show its feasibility in two different cases about motor action generation and personalized emotion recognition. from perception or the perceptual events that actions produce. Specifically, the representation does not explicitly represent actions; instead, there is an encoding of the possible future percept which is learnt from prior sensorimotor knowledge. Therefore, this perception-action framework is derived from the ideomotor principle [9], which advocates that actions are represented with prediction of their perceptual consequences, i.e. it encodes the forthcoming perception that is going to happen when an action is executed (i.e. motor imagery) [4]. Due to the modulation role of emotion state, we propose that there is an intermediate level of internal state between the cognitive processes and the perception-action cycle. As we stated, this level of internal state, such as emotion, regulates the expressions of sensorimotor behaviours. To some extents, we can also regard this level of internal state as a level of common coding. As such, the representation of the internal state reflects the perception input and the motor imagination, forming an imagination of affective understanding such as empathy. Instead of the linkage between action and perception (e.g. sensorimotor contingency), the common coding theory proposes that perception and action may modulate each other directly via the shared coding by a similarity-based matching of common codes, even regulated by the internal state in our model. Therefore, the pairing of perception and action, i.e. the acquisition of 'common coding', emerges from prior experience of the agent. For instance, assume we have the hierarchical PAM model as a two-level architecture, it is degenerated as the model stated in [14]. If the agent (called 'observer') observes that one person (called 'presenter') is hurt by a knife, the model may trigger involuntary and subtle movement when the agent is doing a certain kind of hand movement (e.g. moving a bit of the arm). Even the observer feels sympathy about the incident. In this example, both of the current afferent information (referring to the perceived event) and predictive efferent information (referring to intended events from actions) have the same format and structure of the internal state representation. From the aforementioned sensorimotor functions, we propose a hierarchical cognitive architecture as shown in Fig. 1 focusing on the emotion regulated functions to the sensorimotor behaviours. From the common coding framework of perception and action, the information of the feedback pathways are formed through various levels, regulated by internal states of the cognitive agent in the hierarchical architecture. Between the cognitive processes and the hierarchical motor controls, internal state (such as emotion) regulates perception-action cycle functions such as perception, motor imagery, and action planning. To establish the links between movements (a), the sensory effects (e) and the internal state (s), one may need one or more processes of latent learning [21], reinforcement learning [24] or evolutionarily hard-wired acquisition [10]. This link, once establish, can be described in the following operations: • First, these associations allow to estimate the internal state, given the perceived behaviours performed by the others by means of the forward models (e.g. Bayesian Model) (e → s). In the formulation of Bayesian inference, it can be written as Eq. 1: where S estimates the internal state evidence given an executed action A (e.g. motor imagination by the observer itself), the perception E. The term P (A|S) suggests a pre-learnt internal model representing the possibility of a motor action A will be executed given a certain internal state (S). Since this model is solely by the observer itself, it may differ from various cultures, ages, personalities. Therefore, learning of such an internal model is crucial. Here another assumption is held that one's own action (or imagined action) A is the same as its perceived action (E).
• Second, these associations allow the agent to move with a certain voluntary or involuntary behaviour given an internal state. From the backward computations introduced in Eq. 2 (s → a), a predictive/generative sensorimotor integration occurs: where A indicates a motor action given the internal state S. In the equation we omit the factor of goal, but it is also the main target of any voluntary actions. Here we assume that one's internal state is determined by the current sensory input and a lot more factors (P (S|·)).
• In terms of its hierarchical organization, it also allows this operation: with bidirectional information pathways, a low level perception representation can be expressed on a higher level, with a more complex receptive field, and vice versa (e low ↔ e high ). These operations can be achieved by extracting statistical regularity, which may be expressed as deep learning architectures.
Thus, this Bayesian framework proposes that an internal state as one of the prior for feedback pathways represents a linkage between perception and motor actions. We will propose a simple learning model addressing the first two operations at the next section. After that we will demonstrate two case studies about its feasibility.

Parametric Bias
Recurrent Neural Network with Parametric Bias Units [19,20,28,27,26] (Fig. 2) is a family of recurrent neural networks that consist of an additional bias unit acting as bifurcation parameters for the nonlinear dynamics. In other words, the adjustable values in such a small number of units can determine different dynamics in the network with large dimension. Being different from ordinary biases, these units are Due to the above features, an RNNPB network can be regarded as a two-layer hierarchical structure for cognitive systems. Based on this feature, this network has also been further adopted to mimic the cognitive processes such as language acquisition [27], language generalisation [18] and other cognitive processes.

Three Modes
The RNNPB three running modes in an RNNPB network, namely learning, recognition and generation modes. They functionally simulate different stages between sensorimotor sequences and high-level internal states of these sequences. The neural dynamics and algorithms of these modes are as following: • Learning mode (Fig. 3a): • Recognition mode (Fig. 3b): In this mode, the network recognises which type of sequences by updating the internal values of PB units. The information flow in this mode is mostly the same as in the learning mode, i.e. the error is back-propagated from output neurons to the hidden neurons, but the synaptic weights are not updated; rather, the back-propagated error only contributes to the updating of the PB units. By this mean, if a trained sequence is presented to the network, the values of the PB units will converge to the ones that were previously shown in the learning mode in order to restore the PB values trained before.
• Prediction mode (Fig. 3c): After learning and after the synaptic weights are determined, the RNNPB can act in a closed-loop way: the output prediction can be used as an input for the next time step. In principle, the network can generate a trained sequence by providing initial value of the input and externally setting the PB values.

Learning Mode
During learning mode, if the training progress is basically determined by this cost function C; following gradient descent, each weight update in the network is proportional to the negative gradient of the cost with respect to the specific weight w that will be updated: where η ij is the adaptive learning rate of the weights between neuron i and j, which is adjusted in every epoch. To determine whether the learning rate has to be increased or de- creased, we compute the changes of the weight w i,j in consecutive epochs: The update of the learning rate is where ξ + > 1 and ξ − < 1 represent the increasing/decreasing rate of the adaptive learning rates, with η min and η max as lower and upper bounds, respectively. Thus, the learning rate of a particular weight increases by ξ + to speed up the learning when the changes of that weight from two consecutive epochs have the same sign, and vice versa. As mentioned before, besides the usual weight update according to back-propagation through time, the accumulated error over the whole time-series also contributes to the update of the PB units. The update for the i-th unit in the PB vector for a time-series of length T is defined as: where δ P B is the error back-propagated to the PB units, e is e-th time-step in the whole time-series (e.g. epoch), γ i is PB units' adaptive updating rate which is proportional to the absolute mean value of the back-propagation error at the i-th PB node over the complete time-series of length T : The reason for applying the adaptive technique is that it is hard for the PB units to converge in a stable way. Usually a smaller learning rate is used in the generic version of RN-NPB to ensure the convergence of the network. This results in a trade-off in convergence speed. However, the adaptive learning rate we used is an efficient technique to overcome this trade-off.

Recognition Mode
The recognition mode is executed with a similar information flow as the learning mode: given a set of spatio-temporal sequences, the error between the target and the real output is back-propagated through the network to the PB units. However, the synaptic weights remain constant and only the PB units will be updated, so that the PB units are self-organized as the pre-trained values after certain epochs. Assuming the length of the observed sequence is a, the update rule is defined as: where δ P B is the error back-propagated from a certain sensory information sequence to the PB units and γ is the updating rate of PB units in recognition mode, which should be larger than the adaptive rate γ i at the learning mode.

Generation Mode
The values of the PB units can also be manually set or obtained from recognition, so that the network can generate the upcoming sequence with one-step prediction. Furthermore, according to [8], a trained RNNPB not only can retrieve and recognise different types of pre-learnt, non-linear oscillation dynamics, as an expansion of the storage capability of working-memory within the sensory system, but also adds the generalisation ability to recognise and generate untrained non-linear dynamics and compositions.

Case 1: Generation of Non-verbal Emotion Expression by Avatar Simulation
In this demonstration, we used a simulation based on RN-NPB with the parameters shown in Tab. 1 to generate specialised non-verbal robot behaviours. We separated two kinds of training data based on two different behaviours in order to eliminate the subtle differences in different behaviours generation, corresponding we omit the goal G in Eq. 2.
The training data was taken from an inertial motion capture system by Xsens, while the actor was performing two sets of basic behaviours (standing and walking) expressing five kinds of emotions (joy, sadness, fear, anger, pride). This three-dimensional skeleton motion capture was used instead camera-based systems such as Microsoft Kinect, because it would be easier to map the generated motion into humanoid robots for further project developments. Also motions from various body parts could be well-isolated in a quantitative way for network training. Such quantitative data can be reviewed and utilised in external editors and programs (Fig. 4).
The sampling frequency of this system was 120Hz.

Figure 4: Three Dimensional Skeleton
After training, as depicted in Eq. 2, given that the PB values we obtained from training, we can generate the pre-trained or un-trained temporal sequences in the network's generation mode. These behaviours were represented in a 78dimensional data-set by reconstructing the network output. These simulations were done by adjusting the PB units into the pre-trained values and the novel values as the midpoints between either two pre-trained values in the PB space. In the avatar demonstrations, only the body skeleton were shown by means of the lines connecting to skeleton points. Part of the demonstrations can be viewed online. Apart from the trained emotions, some 'interval' emotions from the behaviours can be also perceived when the novel points in the PB spaces were selected.

Case 2: Personalised Emotion Recognition
In the second demonstration, the recognition mode of the network was investigated (Eq. 1) using the parameters shown in Tab. 1. Here we will also testify the real-time recognition ability of this method. Although during the experiments we could not guarantee the training and recognition data-sets were identical, we can still observe that behaviours from the same emotion drove the PB values closer to each other. Furthermore, we can also notice the behaviours from 'joy' and 'pride', 'fear' and 'anger' were also quite close which may indicate some connections between these two pairs of emotions.

Summary
In this paper, we proposed a cognitive framework focusing on the regulation role of emotions to sensorimotor behaviours. This hierarchical architecture is based on the perceptionaction model, in which the internal state (emotion) acts as a prior in the feedback pathways to further modulate perception and actions. Following the proposed two Bayesian inferences between internal state and the sensorimotor behaviours, we propose to use a recurrent neural network with parametric bias units (RNNPB) to contruct a two-layer architecture in which the parametric bias represents an internal state. The non-verbal expression generation and emotion recognition demonstrations witness the feasibility of this hierarchical architecture. In the next steps, a few possibilities can be made to further extend this architecture: 1) more factors, such as goal, perception from previous states and prior knowledge, can be considered in the Bayesian inferences; 2) a more sophisticated hierarchical learning method can be used to extract and generate more statistical regularities; 3) we will further extend this hierarchical PAM model with ASMO architecture [13] to allow a flexible attention between various conditions as well as modulated by internal status such as emotion.