An Artificial Behavioral Immune System for cognitive robotics

The paper proposes the implementation of an artificial behavioral immune system (ABIS) that could be integrated on a robotic platform. The ultimate goal is to have a form of perceptual processing to create the sensation of disgust (on more in general of discomfort) that may influence the behavior that is determined by the cognitive modules. The present work, being oriented to human-robot interaction, is focused on perceptual processing of facial expression, and speech recognition. As regards the first aspect, the human face closer to the robot is detected, then facial features are extracted, and finally a vector of data which has an emotional valence linked to expression is determined. The speech is processed to recognize the individual words and the moods using a ”sentiment analysis” technique. An artificial immune system is used to recognize positive and negative ”feelings” that cames from interactions and generate the signal of discomfort. For training and validation we used a few human subjects and sequences of a fairy tale.


Introduction
The complex human immune system does not act only when it is attacked by pathogens, but it enables behavioral mechanisms aimed at preventing potentially dangerous situations.Some psychological processes are activated by the so-called behavioral immune system (Schaller, 2011;Schaller and Park, 2011), with the aim to anticipate and avoid risky situations.This system is essentially based on processing of perceptual cues (Stewart, 1993) and provides answers that influence emotions, behavioral impulses, and other cognitive mechanisms.The behavioral immune system has a direct influence on the social interactions of humans, and in particular can have a significant impact on: social gregariousness (or the opposite extraversion); prejudices, discriminatory or unsociable behaviors; mate preferences and mating behaviors; normative and counter-normative behavior.Regardless of the mechanisms of high-level cognition, binding between the behavioral immune system and the feeling of disgust and discomfort seems to be quite shared and accepted.Such mechanism, it is suitable for a possible experimentation "in silico", in an artificial agent such as a robot to carry out behaviors more similar to humans (Hutchison, 2012).
Among other bio-inspired computational models, the endocrine system (Timmis et al., 2009;Guorui, 2013;Pérez et al., 2012) and swarm computing (Timmis et al., 2010) have some similarities and common aspects with the model of the immune system, although for the moment lacking extensive experiments that will enable to compare them.
The functioning of the human immune system is the subject of study and research, not only in the biomedical field, but also in the field of computer science since it shows capacity of adaptation, learning and memory, and represents a model that produces cognitive functions like the neurons (Stewart, 1993).
Artificial immune system models used in data processing are rough simplifications of the immune network theory proposed by Jerne (1974).All these model are based on the binding between antigen (input data) and antibody of different kinds (potential solutions).Other aspects of the mechanism of the immune system, captured by the majority of the models, are clonal expansion, affinity maturation, apoptosis and clonal suppression (Castiglione et al., 1999;Cutello and Nicosia, 2006;Pavone et al., 2012).
One of the most used Artificial Immune Systems (AIS) model in data processing is aiNet, proposed in de Castro and Zuben (2000).This model can be considered as a modified evolutionary algorithm (Stibor and Timmis, 2007) and was adapted to many applications, for example in Ciesielski et al. (2006) the aiNet was used for text document classification.A similar problem was also faced in Stibor and Timmis (2007), were the aiNet algorithm was used to "compress" a set of input pattern distributions, in order to understand if it is possible to use the developed aiNet in place if the original input pattern distribution.
The aiNet was also using for biclustering in de Castro and de Franc ¸a (2007), and in optimization problems as reported in Tsang and Lau (2012).
The paper proposes the implementation of an artificial behavioral immune system (ABIS) that could be integrated on a robotic platform.The ultimate goal is to have a form of perceptual processing to create the sensation of discomfort that may influence the behavior that is determined by the cognitive modules.In a previous work we have addressed the problem of creating a sort of artificial proprioceptive system and suitable for a humanoid robot, and we have achieved a cognitive capacity for introspection (Infantino et al., 2013).In the present work, being oriented human-robot interaction (Prado et al., 2012), we focus our perceptual processing on two important aspects: the detection of facial expression, and the speech recognition.As regards the first aspect, the human face closer to the robot is detected, then facial features are extracted , and finally a vector of data which has emotional valence linked to expression is determined (Breazeal, 2003).We evaluate the dynamic evolution of this signal for few seconds.The speech instead is processed to recognize the individual words, then it follows a "sentiment analysis" (Pang and Lee, 2008;Cambria et al., 2013) attaching a mood.As previous, some numerical parameters are mediated over a given time interval.
The artificial immune system is used to distinguish between pleasant and not-pleasant situations.Such discrimination arises from the distinction between self and not-self cells that is typical of the biological immune system, and it comes out from a training phase during the first stage of the life.

The Artificial Immune System
The aiNet algorithm is one of most used and effective models (de Castro and de Franc ¸a, 2007).The most important part of the aiNet algorithm is a list of simulated antibody cells (Ab-Cells) that interact with the simulated antigens (Ag-Cells) in an R n space: both have a pattern vector  w Ab and  w Ag .The Euclidean distance between  w Ab and  w Ab is used to represent the binding or the affinity among cells.

The Simulated Antibody Cell
The antibody cell properties can explain a lot about the working of the whole immune system.In a simulated artificial immune system the antibody cell could be an object constituted by a vector and some behaviours.The template that characterize the antibody is called paratope, and it can match a specific part of the antigen called epitope.In the aiNet model these parts of the antibody are simulated using real vectors  w Ab and  w Ag and this match is measured using the euclidean distance: this distance is a factor that modulates the mutation of the cell and the amount of generated clones.Like the biological model, the mutation of the Ab-Cell is aimed to increase the match with the Ag-Cell so that the amount of mutation is lower if the match is high.The mutation is obtained by randomly change the value of components of the real vector that represents the paratope.
A cell that has an high match with the Ag-Cell generates a lot of clones in order to increase the response of the immune system to the antigens so that the distance in eq. 1 modulates also the number of clones produced from an Ab-Cell.

The aiNet algorithm
The aiNet algorithm, as discussed in Stibor and Timmis (2007), is reported in algorithm 1 By mean of this algorithm, we identify the antibody cells with its weight set  w Ab , called  b for sake of simplicity.
In the aiNet model when an Ag-Cell is presented to the AIS the nearest Ab-Cells activates and are subject to duplication and mutation (clonal expansion).The mutated cells more similar to the input Ag-Cell are maintained, while the other generated cells are killed (during a process that is called affinity maturation).The selected Ab-Cells have a chance to be part of the "memory" of the system: a set of conserved cells that are used in the case of a new infection.This long term memory is represented by the cell set B in algorithm 1, while the sets C and M are a working memory, i.e. the set of cells created during antigenic presentation.

AIS and self-not-self recognition
One of the interesting characteristics of the immune systems is that the antibodies are capable to distinguish the antigen cells from the cells of the host organism.This feature is called self-not-self recognition.According to Farmer et al. (1986) antibody cells that attack the organism are produced during clonal expansion but they are killed, by other antibodies, during the clonal suppression phase.
This mechanism requires a training phase aimed to recognize possible dangerous antibodies and how to eliminate them.Like antigens all the antibodies have an epitope that can be recognized by other antibodies, these epitopes are used during clonal suppression.Dangerous antibodies are recognized by using their epitopes and removed by other antibodies (Farmer et al., 1986).The training phase that allows to recognize the dangerous antibodies take place during the development of the embryo of the organism.
This model can be implemented in the artificial immune system by preceding the training session with a initial learning that involved only self cells: these cells are presented to the artificial immune system so that it can develop the antibodies that recognize these self cells.In fig. 1 clonal expansion: clone the cells in C according with their distance dist( c i ,  g) mutate the cells where training session.
The AIS reacts creating a set of antibodies, in the following called self antibodies, that recognize the self cells.These antibodies are placed in the set B, the long term memory of the system.During the normal operation of the AIS antibody cells are produced: if these cells are near self antibodies they should be destroyed and a signal is generated.This mechanism is shown in fig. 3. Using this schema it is possible to recognize a threat to the system because it is the one that generate antibodies of the type non-self, while any other organism cell will generate antibodies of the self kind, that will be immediately destroyed.
Figure 3: The structure of the system for self-not-self recognition.A signal is generated when antibodies self are activated.

The Artificial Behavioral Immune System
The implemented system has been tested on the robotic platform NAO, and is an integral part of the behavioral system in the context of human-humanoid robot.The behavior comes from a cognitive architecture based on the model PSI (Cai et al., 2011), which in the past we have enriched with introspective capabilities (Infantino et al., 2013), with links between visual perceptions and emotions (Gaglio et al., 2011;Infantino et al., 2012;Infantino, 2012), and developing some creative capabilities (Augello et al., 2013b) by binding different perceptual representations.We have chosen two important sensorial stimuli that involve both high-level cognitive functions, and behavioral reactions influenced by the artificial immune system.Speech and facial expressions are two basic channels of communication in social interactions ( see for example Prado et al. (2012), andBreazeal (2003)) both on a subconscious and rational level.The proposed system focuses on the detection and recognition of specific patterns from such perceptual stimuli that have a significant emotional impact (see fig. 4) The detection of words, the prosody, the tone of voice, and so on are all factors that influence social interaction (Pennebaker et al., 2003).The target robotic platform used for our experiments has a speech recognizer with detection of individual words and phrases.We have drawn upon an approach that mixes sentiment analysis and opinion mining (Cambria et al., 2013): to define the emotional content of a text, it is established a correspondence between word and five parameters: pleasantness, attention, sensitivity, aptitude, and polarity.The values taken by these parameters constitute the first part of the input of the immune system, and we consider it stored in long term memory by affective system.(see fig. 5).In a similar manner, we use some parameters extracted from facial expressions that typically allow you to classify it, and that are linked to patterns stored in the visual long term memory.Putting to-Figure 4: ABIS-schema Figure 5: Perceptual processing gether these two (processed) sensorial inputs, the immune system is trained to recognize risk situations.When a pattern is recognized potentially dangerous generates an alert that signals to activate typical behaviors of a uncomfortable situation.Of course, the cognitive behavioral system will be affected by this alert, but this could be ignored or hidden by the high-level planning and reasoning (see fig. 4).

Speech sentiment analysis
The experimental setup is constituted by a human subject that directly speaks to the robot.The robot reacts emotionally based on the content of the speech and facial expressions detected in sync.As previously mentioned, the emotional content of speech is characterized by five numerical parameters resulting from publicly available semantic and affective database (MIT-Media-Laboratory, 2013).The database used contains 14244 concepts, and it is possible queried it by web.For example, the page http://sentic.net/api/en/concept/smile/corresponds to a xml file that contains the related concepts (sneer, start-laugh, hear-joke, smile-laugh, giggle), and numerical values of the parameters (pleasantness = 0.997, attention = 0.0, sensitiv-ity = 0.0, aptitude = 0.0, polarity = 0.332).

Face expression analysis
To characterize facial expression we used the six coefficients of Animation Units (AU) by using an API widely used in the context of face tracking (Microsoft, 2013).They are a subset coefficients defined in the Candide3 model (Ahlberg, 2001) that uses 87 2D points on the face to track a human head.From these six values it is possible to classify the facial expression considering seven basic expressions: neutral face, upper lip raised, jaw lowered, lip stretched, brow lowered, lip corner depressed and outer brow raised.The range of these coefficients is between -1.0 and 1.0.For example, the first coefficient indicate the lips movement, the value +1 indicates the lips completely opened and -1 completely closed.The afore-mentioned six coefficients can be used to classify an emotional state through a series of IF-THEN rules and a set of threshold values.

Experiments
To validate the proposed approach we have designed an experiment that seems simple: the robot listens to a fairy tale and observes the facial expressions of the narrator.The data collected in this phase are used to train the immune system by means of a semi-manual labeling.A fairy tale being aimed at children, typically uses simple words and facial expression in the narrative is essential to strengthen the emotional content of the story (Alm et al., 2005).As with children, the robot can learn from a fairy tale a behavioral and emotional model on which to base its cognitive development.The learned model, tin our case via the artificial immune behavioral system, can be employed to deal with normal interactions with humans.In the testing phase in fact a human speaks of a farm, a vegetable garden, animals, arousing emotions to the robot derived from having listened to the famous The Tale of Peter Rabbit by Beatrix Potter.The robot watched a video of this tale available on the web (Socratica, 2013).The narrative is divided in 35 sequences, each corresponding to a part of speech and a sequence of facial features detected (see fig. 6).
Figure 7 shows the maximum, minimum, and average (blue dashed line) of the parameters of sentiment for the 35 sequences.
For the learning phase of the six AU parameters derived from facial features are grouped by similarity (using a simple k-means), and clusters are labeled manually as negative or positive inputs.Figure 8 shows the average values of the Animation Units derived from facial features detected for the 35 sequences.
Preliminary experiments show a rate of correct recognition of discomfort situations of about 70%.

Conclusions and future work
The robot as a child could learn how to recognize positive and negative situations by visual and voice interaction with a tutor.In the article we proposed a low level mechanism that activates the alarm signals relating to the discomfort.It is inspired by the human immune system, and is based on the influences that such a system has on behavior.
We are conducting more extensive experimentation that allow us to understand how to improve the artificial immune system, integrating other perceptual signals, and optimizing the learning phase.Ciesielski, K., Wierzcho Å, S., and K Åopotek, M. ( 2006).An immune network for contextual text data clustering.Artificial Immune Systems, pages 432-445.Cutello, V. and Nicosia, G. (2002).Multiple learning using immune algorithms.In Proceedings of 4th International Conference on Recent Advances in Soft Computing, RASC, pages 102-107.
and fig. 2 a toy example better explains self-not-self recognition: the input data are in fig. 1 and the self data, the blob on the topleft, are submitted to the system during the first part of the Algorithm 1 The aiNet algorithm 1: Random initialize a set of Ab-Cells with the vector templates B = {b 1 , b 2 , ..., b N } 2: while t < t max do 3: for each antigen ag ∈ G with the vector template  g do 4: split B in two parts, C and T , |C| = n, (C ∪ T = B, C ∩ T = ∅) by putting in C the n antibodies with minimum distance from  g

Figure 1 :Figure 2 :
Figure 1: A toy self-not-self problem.The pattern distribution top-left represent the self pattern; these patterns are presented to the AIS during the first step of the learning phase.

Figure 6 :
Figure 6: Perception example of sequence 5 of 35

Figure 7 :
Figure 7: Sentic values of the 35 sequences of video used in the experiments