Guillaume Attuel

Hussein Yahia

fibrillation Synapses Modulation

Complexity of facts

The noisy aspect of data recorded by electrodes, on the inner surface of human atria during episodes of atrial fibrillation, exhibit intriguing features for excitable media. Instead of phase chaos as typically expected, it shares many common traits of non-equilibrium fluctuations in disordered systems or strong turbulence. To assess those peculiar observations we investigate a synaptic plasticity that affects conduction properties. Electrical synapses comprise many different kinds of connexins, which may be affected by diverse factors, so we use a generic approach. Slight detuning of their linear response leads to an instability of the modulating agents, here an excess charge. Acting on slow time scales of repolarisation, it is understood as collective modes propagating through and retroacting on each synapse: The medium is desynchronised. It is not a syncytium. Transient states are here associated with a phenomenon called electrical remodelling, which has not received any accepted description thus far. Moreover, from the properties of the model it is possible to start exploring phase space. Transitions between different regimes could help decipher stages in the evolution of the disease from acute to chronic, one main goal of cardiovascular research.

AT AF

Trigger Theoretically, a myocardium is an excitable tissue acting under normal circumstances as a functional syncytium of myocardial cells. Models of excitability for the heart are reactiondiffusion systems describing the propagation of electric pulses called action potentials similarly to models for axons. Reaction results from ionic exchange cycles between the cytoplasm of excitable cells and their extra-cellular medium, when initiated by a stimulus above some threshold. Pulses are robust topological structures.

There are features of SOCs in large regions of phase space. Pulses have a phase and propagate on a random medium. For instance one paradigm would be:

Randomness reactualises non-linearly, which tells that the noise is quenched and reseted. For instance in 1 + 1D, spatio-temporal maps look very much like optimal directed paths along diagonals. In 1 + 2D, we are guessing that pulses do propagate in the (q)KPZ universality class, just as the remodelling front does. We will need refined numerical computations to confirm this. This is consistent with a multiplicative process. Physiologically, one interesting bonus is the interpretation of non-reentrant Tachycardia as dislocation patterns slowly evolving.

Excess charge in cells like of Ca may perturb the dynamics of synapses. We consider a physiologically plausible linear response of synapses to the electro-chemical potential. This response is unknown as of today. The new dynamics may interact with excitability. It has the specific form of a Rayleigh instability here. Cycles become retarded or advanced. Hopf bifurcation and chaos are allowed creating EADs. Regarding propagation, pulses are pinned and released on a chaotic background. Cycle modulations create defects via facilitation through the third dimension. Defects proliferate creating a glassy phase, which back-scatter fronts in 1D and roughens them in 2D. Further effective inhibitor diffusion splits them. All the above properties for pseudo-recordings are retrieved. Electrical remodelling is the time by which the background has pervaded the tissue.

Packed in brief I

∂ t U m ∂ t J m ∂ t g ∂ t ρ = = = = µU m -βU m 3 -J m γ U m αρ -g∇ U m ( ) + - - DΔ m ( ) -∇ gρ ( ) J m νg νρ ⎧ ⎨ ⎪ ⎪ ⎩ ⎪ ⎪ ⎫ ⎬ ⎪ ⎪ ⎭ ⎪ ⎪ a = α J 0 Dν gρ U m J m

Chaos

Considering the stable fixed point as a phase resetting state, even under periodic forcing, no return map be drawn, therefore no chaos. Chaos may arise in temporal sequences.

propagation becomes further involved in arrhythmia, spatio-temporal chaos amounts to the breakup of spirals from direct and collisions within the pulse train. This is the paradigm for cardiac fibrillation.

ν ∂ t θ + sinθ = Ω + ∂ xx θ
Numerous facts are not described at all within the paradigm. Here is a short list: At the tissue level, recorded signals have wildly fluctuating amplitudes, with specific properties. Recorded patterns of activation form various defects and domains in relation to the substrate. Each pulse forms a « complex » that looks scattered and fragmented. At the cellular level, early after depolarisations are observed. Common wisdom for EADs tells that inward currents must overwhelm outward currents, specifically Ca over K. This is like a Hopf bifurcation dynamically. It suggests that chaotic pulses are possible. Finally, at the organic level, Ca overload being cytotoxic, cells respond by trying to lower Ca concentrations, which response in turn is arrhythmogenic. This vicious circle is called remodelling. It starts immediately after a first episode and evolves slowly through the years.

Uncoupled synapses αGA: chaotic pulses.

Human data

The distributions of amplitudes all collapse on a scaling function G. We map exponents on 5 patients showing non-universal properties. Singular exponents are observed with consistent Hausdorff dimension of sets D(h). Negative contribution is high, suggesting an underlying multiplicative process.

Computational model

Discussion

Packed in brief II

P A, A c ( ) = A -τ G A A c ⎛ ⎝ ⎜ ⎞ ⎠ ⎟ τ = max h<0 D(h) -1 ( ) h + + + + + + + + + + + + _ _ _ _ _ _ _ Membrane Cytoplasm Extra-cellular medium Excess charge Membrane channel Gap junction channel Ionic current ν ∂ t θ + sin θ + ! ϕ ( ) = Ω + ∂ xx θ
We have addressed specific properties observed in human data with a model of electrical synapse dynamic plasticity. The model reproduces the data well, which suggests that fibrillation is a phenomenon in the directed paths universality class or KPZ. Measuring signals and extracting proper exponents might help to decipher between diseased and healthy substrates as well as structurally from functionally remodelled hearts.

Structural remodelling


Jérémie Saives

Clément Pianon

Gregory Faraut

Lurpa

Activity Discovery and Detection of Behavioural Deviations of an Inhabitant from Binary Sensors

come

Activity Discovery and Detection of Behavioural Deviations of an

Inhabitant from Binary Sensors Jérémie Saives, Clément Pianon, and Gregory Faraut, Member, IEEE * Abstract-The aim of this paper is to improve the autonomy of medically monitored patients in a smart home instrumented only with binary sensors; overwatching the disease evolution, that can be characterized by behaviour changes, is helped by detecting the activities the inhabitant performs. Two contributions are presented. On one hand, using sequence mining methods in the flow of sensor events, the most frequent patterns mirroring activities of the inhabitant are discovered; these activities are then modeled by an extended finite automaton, which can then be used for activity recognition and generate activity events. On the other hand, given the set of activities that can be recognized, another automaton is built to model requirements from the medical staff supervising the inhabitant; it accepts activity events, and residuals are defined to detect any behaviour deviation. The whole method is applied to the dataset of Domus, an instrumented smart home.

Note to Practitioners-This paper was motivated by the will of providing a model of the behaviour of the inhabitant at home, from which formal methods can be applied to verify some properties, namely detect behaviour deviations. The input of the framework is a log file of binary sensor events (rising and falling edges); a pre-filtering of the log might be required to get rid of repetitive, noisy events (namely spurious events generated by motion sensors, for which only the first rising edge and last falling edges are relevant). This recorded log is assumed to be recorded without sensor faults, and to be characteristic of a typical routine of the inhabitant. In order to build this model, based on the Extended Finite Automata (EFA) formalism, sequence mining techniques (first contribution of the article) are adapted: the more frequent the sequence is, the more important for the inhabitant the habit is. The second contribution of the paper is the ability to detect behaviour deviations, which is criticial for healthcare at home and disease management. The technique of "residuals", mainly used in manufacturing, has been adapted to EFAs. It requires medical requirements, defined by the medical staff, based on the activities it wants to keep an eye on. A suiting log of sensors events and medical requirements are the only prerequisite to the application of the method.

Index Terms-Primary Topics: Home Automation, Discrete Event Systems, Automata, Activities of Daily Living.

I. INTRODUCTION

S MARTNESS in daily living has become a major topic in research for a few years; large-scale applications deal with smart cities or grids, whereas small-scale applications include smart homes and buildings. The objective of smart homes is to improve the life of the inhabitant with human-centered applications. These applications can be divided into three categories [START_REF] Kleinberger | Ambient intelligence in assisted living: Enable elderly people to handle future interfaces[END_REF]: Emergency assistance, Autonomy Enhancement and Comfort. Autonomy Enhancement is of importance in most industrial countries; indeed, life expectancy has continuously increased over the last decades. Moreover, according to Eurostat [START_REF] Eurostat | Eurostat population projections 2010-based[END_REF] and World Health Organization [START_REF] Organization | Good health adds life to years[END_REF], the percentage of people aged 60 or more will reach 30% in many countries in 2050. These considerations about ageing lead to new issues regarding the autonomy and the independence of elderly or disabled people. Furthermore, when these people need medical assistance, the resources in hospital are limited. Houses are therefore considered as a continuum of the hospital to healthcare, and are a solution to improve the management of elderly people diseases.

In order to 'smarten' a home, numerous varieties of sensors are available. The choice of technology mainly depends on a compromise between the level of information and privacy. For instance, some studies based on cameras [START_REF] Poppe | A survey on vision-based human action recognition[END_REF] can recognize activities, but cameras are intrusive and often refused by the inhabitant. Some other devices like wearable sensors [START_REF] Lara | A survey on human activity recognition using wearable sensors[END_REF] require the inhabitant to be equipped and move, whereas others have very low level information like binary sensors [START_REF] Ordónez | Activity recognition using hybrid generative/discriminative models on home environments using binary sensors[END_REF], [START_REF] Berenguer | Automatic detection of activities of daily living from detecting and classifying electrical events on the residential power line[END_REF], [START_REF] Danancher | Online Location Tracking of a Single Inhabitant based on a State Estimator[END_REF], [START_REF]A Discrete Event Model for Multiple Inhabitants Location Tracking[END_REF], [START_REF] Danancher | A DES Simulator for Location Tracking of Inhabitants in Smart Home[END_REF], but are the less intrusive. The choice of technology directly impacts the methods used to discover or recognize activities, and binary sensors are chosen in this work. Activity Recognition (AR) is mainly a classification task [START_REF] Cook | Activity Learning: Discovering, Recognizing, and Predicting Human Behavior from Sensor Data[END_REF]. Most of studies need an expert knowledge at the beginning to label the input data. To reduce the need for expert knowledge, we use Activity Discovery (AD) techniques [START_REF] Cook | Activity discovery and activity recognition: A new partnership[END_REF]. However, activity discovery techniques, like activity recognition techniques, still depend on the technology of the sensors. Regarding deviations, medical staff often uses questionnaires [START_REF] Roenneberg | Life between clocks: daily temporal patterns of human chronotypes[END_REF] or informal techniques, requiring the participation of the monitored person. Some works using formal techniques do not detect deviations of behaviour but are focused on the detection of inactivity [START_REF] Floeck | Inactivity patterns and alarm generation in senior citizens' houses[END_REF]. Our long term objective is to help the formalization of the deviation detection, namely using informations issued of AD, AR, and its automation to improve disease management.

The approach proposed in this paper is divided in two contributions. The first one, based on previous work [START_REF] Saives | Automated Generation of Models of Activities of Daily Living[END_REF], is oriented towards providing a formal model of habits and activities discovered in a dataset of sequences, without a priori knowledge, hence in an unsupervised way [START_REF] Dimitrov | Unsupervised recognition of ADLs[END_REF]. It provides an automated method of building a map of the habits and activities of a monitored inhabitant. Such a model can be devoted to online real-time recognition of activities. The second part proposes a method to build a model representing recommendations from the medical staff, so that the recognized activities from the first part can be compared to the recommendations, and behaviour deviations of the inhabitant can be detected. This model, based on the recommendations only, is independent of the behaviour of the inhabitant, and it handles all activities detected in the first part of the approach.

A more general discussion about related work is stated in section II. The problem statement, and assumptions made, are given in section III. Section IV shortly presents the proposed approaches. Section V and section VI respectively detail the two contributions: the first one focuses on the identified model of habits allowing then to recognize activities of the inhabitant, and the second one focuses on the detection of behaviour deviations. Finally, a case study based on the DOMUS dataset is proposed in section VII. Conclusions and future works are detailed in the last section.

II. RELATED WORK

The goal of our approach is to detect behaviour deviations of an inhabitant in a smart home. The first problematic concerns the kind of sensors that equip the smart home.

A. Sensors technology

Amongst the equipments not dealt with in this work are cameras, wearable devices or RFID sensors. For instance, in [START_REF] Yu | Fall detection and alert for ageing-at-home of elderly[END_REF], cameras are used to detect whether the monitored inhabitant has fallen. In [START_REF] Chernbumroong | Elderly activities recognition and classification for applications in assisted living[END_REF], wearable sensors are used to determine the posture and movement of the equipped inhabitant using accelerometers. In [START_REF] Patterson | Fine-grained activity recognition by aggregating abstract object usage[END_REF], RFID sensors are used in order to detect which objects are being used by the inhabitant wearing an RFID reader. However, all those approaches are either intrusive or require the inhabitant to wear a special device. In the latter case, the inhabitant must be willingly participating; should he suffer from Alzheimer disease for instance, or simply forget to equip the devices, and the approaches would be inefficient.

Therefore, a solution would be to use a Wireless Sensor Network, using a collection of various sensors with a binary output, such as the universal switch sensors defined in [START_REF] Intille | Tools for studying behavior and technology in natural settings[END_REF]. The network provides a flow of sensor events, each event containing very little information, but activities can be recognized from a sequence issued of the flow ( [6][21]).

Regardless of sensors technology, the main problematic is to detect behaviour deviations. Before that, it is required to be able to recognize the current behaviour (Activity Recognition) and have the knowledge of a 'normal' behaviour (Activity Discovery).

B. Activity Recognition

Recognizing current behaviour is the area of Activity Recognition (AR) which is considered as a classification task [START_REF] Kim | Human activity recognition and pattern discovery[END_REF], [START_REF] Cook | Activity Learning: Discovering, Recognizing, and Predicting Human Behavior from Sensor Data[END_REF]. Supervised classification approaches share the same strategy: a learning phase on a set that has been studied by an expert, then the recognition phase, during which new sets of data are classified and parameters. The most widespread classification models would be the Hidden Markov Model (HMM) or Support Vector Machines (SVM) ( [START_REF] Cheng | HMM machine learning and inference for activities of daily living recognition[END_REF], [START_REF] Krishnan | Activity recognition on streaming sensor data[END_REF], [START_REF] Aggarwal | Human activity recognition from 3d data: A review[END_REF], [START_REF] Fang | Recognizing human activity in smart home using deep learning algorithm[END_REF], [START_REF] Zhu | Motion-and location-based online human daily activity recognition[END_REF]). Different models have also been designed in the literature. For instance, expert-designed boolean functions on the statuses of the sensors are used in [START_REF] Botia | Ambient assisted living system for inhome monitoring of healthy independent elders[END_REF], with an emphasis on the adaptation part. Expert models of activities are also designed in [START_REF] Ros | Online recognition of human activities and adaptation to habit changes by means of learning automata and fuzzy temporal windows[END_REF], each activity being described by an ordered set of action sequences, and the adaptation being achieved by learning automata.

However, these techniques need, at the beginning, expert knowledge to define a list of activities or relations between activities and sensors data. This task is not an easy one and it is not always possible to have access to this information. To obtain these relations, an activity discovery step can be conducted.

C. Activity Discovery

Activity Discovery aims at getting the knowledge of the normal behaviour of an inhabitant, represented by patterns. Some unsupervised approaches, coming from activity recognition, discover these patterns to build the activity recognition model without expert knowledge. These approaches have mainly been developed for wearable devices ( [START_REF] Wyatt | Unsupervised activity recognition using automatically mined common sense[END_REF], [START_REF] Gu | An unsupervised approach to activity recognition and segmentation based on object-use fingerprints[END_REF], [START_REF] Trabelsi | An unsupervised approach for automatic activity recognition based on hidden markov model regression[END_REF]) because determining relations becomes easy with high-level information. In the case of binary sensors technology, sequence mining approaches are more adapted to discover patterns ( [START_REF] Agrawal | Fast algorithms for mining association rules[END_REF], [START_REF] Cook | Activity Learning: Discovering, Recognizing, and Predicting Human Behavior from Sensor Data[END_REF]). For instance, data mining techniques are exploited in [START_REF] Tapia | Activity recognition in the home using simple and ubiquitous sensors[END_REF], [START_REF] Chikhaoui | A frequent pattern mining approach for ADLs recognition in smart environments[END_REF] to find frequent patterns in a sequence of events and compare them to expert models. Nevertheless, all those works require expert knowledge; we propose to discover habits and leave the task of defining activities to the very end.

Once the normal behaviour has been observed and defined, we can proceed to the detection of deviations.

D. Behaviour deviation detection

Most of the works previously cited are efficient in activity recognition, but provide no indication on behaviour deviations. Indeed, in disease management, the medical staff does not focus on which activities are performed but rather on deviations of some particular activities, symptomatic of improvements or deteriorations of the health of the inhabitant. Behaviour deviations have been studied in some works like [START_REF] Navarrete | Modeling a risk detection system for elderly's home-care with a network of timed automata[END_REF], [START_REF] Floeck | Inactivity patterns and alarm generation in senior citizens' houses[END_REF] or [START_REF] Planinc | Detecting unusual inactivity by introducing activity histogram comparisons[END_REF], where the authors use the localization of the inhabitant to estimate a potential risk if he stays too long in a room. The authors of [START_REF] Duong | Activity recognition and abnormality detection with the switching hidden semi-markov model[END_REF], [START_REF] Yin | Sensor-based abnormal human-activity detection[END_REF], [START_REF] Forkan | A context-aware approach for long-term behavioural change detection and abnormality prediction in ambient assisted living[END_REF] can detect behaviour deviations but use mainly multi-context information. Finally, very few studies based on only binary sensors focus on the detection of deviations of complex habits or activities [START_REF] Wen | Activity recognition with weighted frequent patterns mining in smart environments[END_REF], but they still need expert knowledge at the beginning.

Much of the works do not focus on binary sensors, despite their advantages of cheap cost and low instrusiveness. The global goal of this paper is to achieve behaviour deviations from binary sensors, with no initial expert knowledge on the activities. To get such a result, it proposes firstly a new Activity Discovery method based on data mining techniques, leading to the construction of original finite-state models of the discovered habits. With such a model of habits, online Activity Recognition could be performed. Then, a residual method proven in the field of automation, but seldom used outside of it, has been applied to such models to detect deviations. The whole method of this paper, from the binary sensors to the behaviour detection requires only two expert interventions, which are not a prerequisite at the beginning: once the map of discovered habits has been built, to cluster it into activities (which is eased by the readability of the model), and to design the medical requirements from which the deviations are defined. Two perspectives of this work are to limit or even remove the need for these interventions.

III. ASSUMPTIONS AND PROBLEM STATEMENT

In this paper, the following assumptions are made. In order to help the users to accept the observation of their every movement, to guarantee the respect of their privacy and to reduce the costs, the instrumentation consists of non-wearable, non-intrusive and low-cost sensors. Such sensors are mostly binary sensors (door barrier sensors, motion detectors...) or sensors delivering a signal that can be interpreted as binary using a threshold (electricity consumption, water flow or pressure sensors for instance). Furthermore, we assume that the sensors are fault-free.

It is also assumed that there is always at most one inhabitant in the home. Moreover, its behaviour is considered totally free. Indeed, even in the learning phase, the inhabitant is not compelled to repeat a specific action to enable the learning of his behaviour. Using a Discrete Event System (DES) point of view, the inhabitant living in an instrumented environment is seen as a spontaneous event generator. These events are the rising and falling edges of the signals emitted by each binary sensor of the house. Furthermore, we assume events do not occur simultaneously. Even if two events are generated at the same time, they are sequentially recorded.

We also consider that an habit is always done in the same way, independently of time, i.e. the sequence of event is the same. The approach is expected to be even more efficient when time information is included. Due to the technology of the sensors chosen, there might be spurious information. For instance, while solicited, an infrared motion sensor keeps sending rising and falling edges. The data provided has to be filtered, and therefore an assumption is made that a same event can not occur twice in an habit.

To improve the interpretation and the understandability of the behaviour of the inhabitant, we consider that a graphic representation of the habits is helpful, such as an automaton. This is particularly important to help the expert to determine relations between habits and activities.

For the deviation detection phase, it is assumed that the medical staff has provided a list of textual requirements that should be satisfied for the monitored inhabitant to be considered in good health. For instance, have three meals a day. Depending on the patient, missing one meal can be considered critical (local deviation), or instead only the repetition of missed meals on a larger timescale becomes worrisome (global deviation). The result of the method should take into account both types of deviations, depending on what the requirements of the medical staff are.

Based on these considerations, the problem of activity discovery, recognition and behaviour deviations detection can be reformulated in terms of a DES problem: from observed sequences of sensor events and requirements from a medical staff, discover habit models that can recognize activities from the spontaneous event generator that is the inhabitant, with a minimal learning phase, and that can be used to detect behaviour deviations.

IV. GLOBAL OVERVIEW OF THE PROPOSED APPROACH

The global structure of our approach is illustrated on Fig. 1. A smart home equipped with a binary sensor network generates a sequence of events representing the inhabitant doing an activity. The behaviour of a human being is however arbitrary, hence multiple sequences of events can be images of the same activity, hardening the difficulty of building an expert model. The first contribution focuses on activity discovery, and aims at building a map representing a model of all habits of inhabitant. From this map, an expert will identify corresponding activities by clustering and defining boundaries for each activity. This contribution is detailed in section V.

Sequences S of events

Map

-Model of habits

Behavior Deviation detections

Medical staff recommandation

Patterns P

Activity Discovery

Smart Home

Activity Daily Living

Inhabitant Performs Smart Home

Activity recognition

Requirement flower

Deviation detected -Alert to medical staff The second part of our contribution, based on the sequence generated by the inhabitant and by the activities previously recognized, focuses on the inhabitant's behaviour deviation detection. A model, called "requirement flower", is built, representing the deviations that the medical staff wants to focus on. Residuals techniques are used on it to detect deviations. When a deviation is detected, it provides precise information on the deviation. This contribution is detailed in section VI.

V. MAP HABITS GENERATION AND RECOGNITION

In this first part, a possibility is to use a training set (a few sequences that have already been observed), within which the sequences are still very different. Numerous observations would be required to depict all the possible sequences that depict the activity. Nevertheless, the sequences share subsequences, which are the fundamental basis of the activities, because they are very often played. Those frequent sequences would thus represent fundamental habits of the inhabitant.

The first part revolves around the discovery of these habits, which can be achieved by data mining methods (Mining Step of Figure 2). The dataset can stand in two forms. On one hand, it might be a unique sequence of events, within which frequent episodes can be found [START_REF] Mannila | Discovering frequent episodes in sequences[END_REF], [START_REF] Magnusson | Discovering hidden time patterns in behavior: Tpatterns and their detection[END_REF]. A few days worth of observation could lead to a single sequence of events. On the other hand, one could use distinct sequences of events, as long as they represent the same temporal window, and compare each other in order to extract the habits. This last solution has been chosen. For the remainder of this work, it is also supposed that a single inhabitant is being monitored. Once the patterns have been found, habits can be identified within the set of patterns (Identification Step of Figure 2).

Then, the second part consists in the automated modeling of the discovered habits, which then leads to the building of a map of the habits of the inhabitant (Automated Building Step of Figure 2). This map allows for online recognition: when an event e occurs, the active states of the map change, leading to a set of habits that might be currently ongoing. The accuracy of the recognition remains out of the scope of this work.

Map of Habits Smart Home

Activity Daily Living

Inhabitant Sequences S of events It is worth noting that until the map is built, no expert knowledge has been injected in the model. The goal is to recognize frequent habits (that have already been observed and not expertly designed), instead of trying to split and classify every sequence observed into activities. Nevertheless, once the map is obtained, an expert can study it and determine which parts and which habits correspond to which activities. That part could also be helped by coupling the habit model with a location tracking model, thus getting information on both the location and the activity of the monitored inhabitant.

Identification

A. Discovering patterns

Sequence mining is a specific field of data mining that deals with the search for relevant patterns in sequences and strings. Most of the methods used in sequence mining look for frequent itemsets in databases, in order to discover association rules between items frequently found together. Such techniques would be the Apriori algorithm found in [START_REF] Agrawal | Fast algorithms for mining association rules[END_REF], or the use of FPTrees found in [START_REF] Han | Mining frequent patterns without candidate generation[END_REF]. Since the ordering of the items is irrelevant, those methods consider only databases that have been previously lexicographically ordered. However, in the case of a sequence of events, since we want to discover succession of events which would be images of habits, the order is of great importance and an adaptation is required. Based on the Apriori algorithm, the proposed algorithm is thus designed to find continuous ordered patterns.

1) Definitions: Definition 1. Sequence and events

Let D = {S i } i=1..n be a database containing n sequences. A sequence S i is an ordered list of events such as

S i =[e i
1 , e i 2 , e i 3 . . . , e i l(Si) ], where l(S i ) ≥ 2 is the length of the sequence, and e i k is the k-th event of the sequence. If Σ is the set of all the events that can be generated by the sensor network, then ∀i ∈ 1, n , ∀k ∈ 1, l(S i ) , e i k ∈ Σ.

Definition 2. Pattern A pattern P is a sequence of events P = [e P

1 , e P 2 , . . . , e P l(P ) ], where l(P ) ≥ 2 is the length of the pattern. An event is not enough to define a pattern. Hence, a pattern is said of elementary length when l(P ) = 2, which is the minimum length.

A pattern P is contained in a sequence S i if, and only if ∃s ∈ 1, l(S i ) -l(P ) + 1 ,[e i s , e i s+1 , . . . , e i s+l(P )-1 ] = [e P 1 , e P 2 , . . . , e P l(P ) ], i.e. P is a continuous subsequence of S i , written P ⊂ S i . A pattern can also be contained in another one.

Definition 3. Support

The support Supp(P ) of a pattern P is the number of sequences S i ∈ D in which P is contained, i.e. it mirrors the frequency of the pattern in the database. Thus, ∀P, Supp(P ) ∈ 0, |D| , with Supp(P ) = 0 meaning that the pattern is not present in the database, and Supp(P ) = |D| that the pattern is present in each sequence.

Let Supp min ∈ 0, |D| be a minimum support. Then, a pattern P is said to satisfy the minimum support iff Supp(P ) ≥ Supp min . The minimum support defines the minimum presence for a pattern to be considered relevant.

2) Algorithm of sequence mining:

The global goal of the algorithm of sequence mining is to discover every pattern contained in the database, and evaluate their support. Given a minimum support, it returns every pattern whose support is equal or higher. Running it multiple times for various values of minimum support is required in order to obtain a complete overview of the dataset.

Algorithm 1 consists of three steps, the last two being repeated until no new pattern is discovered:

Init An initialization step, to discover the patterns of elementary length, described in algorithm 2

• All patterns of elementary length that satisfy the minimum support are stocked in a list of elementary patterns CandGen A candidate generation step, described in algorithm 3. The objective of this step is to make the patterns grow in length, in order to find the patterns of maximum length.

• If two already discovered patterns partially recover themselves, then a bigger pattern including both patterns is a potential candidate for being a pattern satisfying the minimum support itself. Count A counting step, to evaluate the support of the candidates (function EvalSupp in the algorithms).

• Only the patterns satisfying the minimum support are kept and added to the list of discovered patterns. ). Since it is of polynomial complexity, it can be used to handle large databases, the main limiting parameter being the maximum length of the sequences |S| max . To improve the understanding, an example is given in Appendix A. Now that all patterns and their supports have been found, each pattern could be treated individually, and independent models for recognition could be built. However, they are strongly dependent, since the shortest patterns are often included in longer pattern of lowest support. In order to build model of activities, or study the links between the habits, those inclusions have to be considered.

3) Structuring discovered patterns and building habits:

Generally speaking, the discovered patterns follow a tendency: the longer the pattern, the lower the support. Hence, short patterns with high support depict a fundamental habit of the observed inhabitant. Those habits are often contained in longer patterns of lower support. Hence, these latter patterns are an image of activities, built out of habits. Multiple fundamental habits form an activity, and there are multiple long patterns that can represent the same activity.

As a pattern can be contained in a sequence, it can also be contained in another discovered pattern. Should a pattern not contain any other discovered pattern, it will be called elementary. Patterns of elementary length cannot contain another one, and are thus natively elementary. A pattern can only be contained in a pattern of lower support. A pattern containing at least another one will be called complex. A complex pattern might contain more than one other pattern, and thus the decomposition into smaller patterns is not unique. Nevertheless, Algorithm 4 can be used in order to find one of those possible decompositions for each complex pattern.

Algorithm 4 handles every pattern one after another, following a decreasing order of support. The first patterns handled are those of highest support. For the following patterns, the algorithm checks whether one of the already structured patterns, hence of a higher support, is contained within. When no more already structured patterns can be found in the handled pattern, it is added in its structured form to the list of structured

B. Automated building of a model

The objective of this section is to propose a model that will be able to identify when a pattern has been reproduced in an online real-time flow of sensors events. Hence, when a new event is generated, the model must react accordingly, by identifying which patterns could currently be at stake, which ones might have just begun, and which ones have just ended. For that purpose, each pattern could, in its elementary form, be modeled by a Finite-State Automaton.

Furthermore, the structure discovered between the patterns needs therefore to be exploited, leading to the choice of an extended class of automata in order to keep that structure. Moreover, the model should also provide events representing the recognized activity to be able to detect deviation for second part of the proposition. This leads to the choice of an extended class of automata in order to keep that structure, which is presented in the following. The formalism of the Extended Finite-state Automata (EFA), as defined in [START_REF] Sköldstam | Modeling of discrete event systems using finite automata with variables[END_REF] is recalled here:

Definition 4. A (Deterministic) Extended Finite-state Automa- ton is a 7-tuple: ((Q × V ), Σ, G, A, δ, (q 0 × v 0 ), (Q m × V m )), with:
• Q x V is an extended set of states, where Q is a finite set of locations and V the finite domain of definition of the variables • Σ the set of sensors events • G a set of guard predicates over 2 V • A a set of actions over V

• δ : Q × Σ × G × A → Q a transition function • (q 0 , v 0 ) the initial state • (Q m , V m ) ⊂ (Q × V ) a set of marked states
Σ is the alphabet that contains every event that can be generated by the binary sensor network. Let q ∈ Q be the current state, q ∈ Q be another state such that ∃(e, g, a) ∈ Σ × G × A, δ(q, e, g, a) = q . Then, if event e occurs, the transition will be fired if and only if the guard g is satisfied. The current state of the automaton will then be q , and the action a will be executed, changing the values of the variables.

1) Modeling elementary patterns:

Let P=[e 1 , e 2 , , . . . , e n ] be an elementary pattern of length n. In order for the automaton to identify in real-time if that pattern has been played, it should satisfy a few properties:

• As long as the pattern has not started (e 1 has not occurred yet), the automaton should stay in its initial state • If the pattern has been completed, the current state of the automaton should be marked • If the pattern is interrupted by an unexpected event, the automaton should react accordingly: if e 1 occurs, the pattern might have started again before having been completed ; if another unexpected event occurred, the pattern has stopped, and the automaton should be in its initial state again. Figure 3 proposes such an automaton for n = 4. Let us say that the current state is P 1 .2, i.e. the last events that occurred have been [START_REF] Kleinberger | Ambient intelligence in assisted living: Enable elderly people to handle future interfaces[END_REF][START_REF] Eurostat | Eurostat population projections 2010-based[END_REF]. The transition function states: δ(P 1 .2, 3, ., .) = P 1 .3, δ(P 1 .2, 1, ., .) = P 1 .1 and, ∀e ∈ Σ -{1, 3}, δ(P 1 .2, e, ., .) = P 1 .0. If 3 occurs, the current state of the automaton becomes P 1 .3 and the pattern keeps being identified. If 1 occurs, the pattern starts again, and if any other event happens, the pattern halts, and the automaton reaches its initial state. Elementary patterns can be modeled by simple Finite State Automata, because no variables are required. However, when complex patterns are concerned, the need for variables arises.

2) Modeling complex patterns:

The construction process of an automaton in order to model a complex pattern is also more complex. The patterns must be distinguishable, and there must be no false detection. Three cases have to be considered: Case 1. The contained pattern shares the first event with the complex pattern. It is impossible to distinguish the two patterns at the beginning, hence they share the first states and transitions. The complex pattern becomes a prolongation of the contained one. No variables are required in this specific case. See Figure 4 for an example with P 1 =[1,2] being an elementary pattern contained in P 2 =[P 1 ,3,4].

This complex model is no longer deterministic, because more than one transition can be activated on the occurrence of one single event. It is however easily transformable into a deterministic automaton by classical methods. For the sake of visibility, the automata will nevertheless be shown in their non-deterministic form. One must consider that a set of states are current at any time instead of a single one. Case 2. The contained pattern shares the last event with the complex pattern. In order to distinguish the patterns, the last state, which is a marked state, is duplicated. However, should only the contained pattern be played, the containing pattern must not be recognized, thus requiring the creation of a variable and a guard on this specific transition. The variable should be proper to the complex pattern, and indicate whether it has actually started and is currently being recognized. It is set to 1 when the patterns starts, and reset to 0 when the pattern is interrupted or ended.

See Figure 5 for an example with P 1 = [START_REF] Organization | Good health adds life to years[END_REF][START_REF] Poppe | A survey on vision-based human action recognition[END_REF] Case 3. The complex pattern contains two patterns. The previous cases apply their rules if the first and/or the last event is shared. Supplementary transitions have to be created between the two patterns. If exactly one event is expected between these patterns, a transition labeled with this event should be created from the last state of the automaton modeling the first pattern to the first state of the automaton modeling the second pattern. If more than one events are expected, additional states have to be added. If no events are expected, a transition labeled with the first event of the second pattern should be created from the last state of the first automaton to the second state of the second automaton.

See Figure 6 for an example of that latter case, with [START_REF] Organization | Good health adds life to years[END_REF][START_REF] Poppe | A survey on vision-based human action recognition[END_REF] and Fig. 6. EFA modelling the complex pattern P 3 =[P 1 ,P 2 ], with Σ the set of all events that can be generated by the sensor network.

P 1 =[1,2], P 2 =
P 3 =[P 1 ,P 2 ]. A transition is created such that δ(P 1 .2, 3, ., .) = P 2 .1.
3) Building a map of habits: A complex pattern, whatever its form, contains shorter patterns, and can be modeled by a complex EFA containing the EFAs of the shorter patterns. Since the operations presented in this section can be repeated, it is possible to build one single automaton representing all the links between the patterns discovered by the data mining step. Such a map can be used by the expert to characterize activities performed by the inhabitant a posteriori, instead of a priori.

4) Activity Recognition:

When using the map of habits while observing the events generated by the inhabitant at home, we are able to detect activities. Indeed, every time a marked state is reached, an event representing the activity is generated. Thus, a set of activities Σ act is defined by the expert; the events of this alphabet are generated by the recognition module of this approach. These activities events are used to detect deviations, as presented in the next section.

VI. DETECTION OF BEHAVIOUR DEVIATIONS

This part, based on the work presented in previous section, aims at detecting behaviour deviations, according to requirements defined by the medical staff. The framework is illustrated on Fig. 7.

The data used are the map of habits and the list of admissible or undesired behaviours defined by the medical staff. Furthermore, the recognition function of the previous section generates events according to the detected activities that the inhabitant is currently performing.

A deviation of behaviour could be the consequence of a particular pathology. For instance, an inhabitant suffering from Alzheimer may forget his lunch, or take multiple lunches instead of only one. Then, the expertise of the medical staff is required to determine which is an admissible behaviour, and which is not. From a list of activities and the map of habits, it should provide requirements for a behaviour to be considered admissible. With these rules, a single EFA is proposed, called requirement flower, that represents all these rules. The resulting model does not depend on the inhabitant and is applicable as long as the recommendations do not change, it can therefore be applied to multiple smart homes. It is conceived to be as permissive as possible, while providing a way of detecting deviations.

Indeed, in the last step of the framework, the observation of current activity performed by the inhabitant leads to the generation of events of Σ act . If events accepted by the requirement flower violate a given condition, information on the activity that does not respect the recommendations is provided. The approach is based on the residual method used in manufacturing system to diagnose this kind of fault [START_REF] Roth | The concept of residuals for fault localization in discrete event systems[END_REF].

Activity Daily Living

Inhabitant

Recognition of activity

Performs

Smart Home

Map of Habits

A. Generation of the requirement flower

The model must be as permissive as possible, represent the desired or undesired behaviours and not be dependent on the inhabitant, but on medical recommendations only.

These recommendations are often expressed textually, but can be translated into mathematical expressions, therefore the requirements can be modeled by conditions on variables. Furthermore, these requirements should not lead the model to a blocking state, but only allow the detection of deviations. The model must therefore accept any activity any number of times, even if the undesired behaviour is a maximal number of instances for a given activity.

The Extended Finite Automata (EFA) (see Definition 4) are kept to express these requirements with guards and variables. However, two considerations are made to be as permissive as possible:

• the EFA has a single state [START_REF] Bergagard | Modeling and analysis of restart, transport, and resource allocation in manufacturing systems using sequences of operations[END_REF], and there is one transition by event, leading to a flower model. • the guard is not considered in the transition function δ, i.e δ : Q × Σ × A → Q to ensure that any event is accepted by the model in any condition.

Furthermore, a time window is always associated to an observation of the behaviour of an inhabitants. For instance, it could be decided to check for deviations each day, or each week, or even more. Even if time is not taken into account in this paper -though it remains an important perspective -an event representing the end of the observation window is nevertheless required. So, in each requirement model, a specific event is created, called End obs. When this event is observed, the observation period is over, the respect of requirements is verified, and the variables are initialized.

In the following, the steps that lead to the requirement flower are detailed. This procedure is generic and only needs the set of activities and requirements desired by the medical team.

Procedure 1. From Σ act representing the list of activities that may be performed by the inhabitant: 1) Generate Σ S act ⊆ Σ act , the set of activities considered by the requirement 2) Generate the set of variables V . Each variable is a counter for each activity (i.e. there exists a bijection Φ : V → Σ act ) 3) Generate the set of actions A (over V ) which increments the counters. Given an activity a ∈ Σ S act , if a is performed, then A(Φ -1 (a)) = Φ -1 (a) + 1 4) Generate the requirements G with medical expertise, for every activity a ∈ Σ S act . 5) Build the requirement flower G c = (({q} × V ), Σ S act , G, A, δ, ({q} × v 0 ), ({q} × V )), with:

• q: the only state of this automaton. It is both initial and marked. • δ : {q} × Σ S act × A → {q} the transition function. Given any a ∈ Σ S act , δ(q, a, A) = q and A(Φ -1 (a)) = Φ -1 (a) + 1 • v 0 the initial values of the variables, all set to 0. 6) Add the transition δ(q, End obs , A end ) = q with:

• End obs the event representing the end of the observation window.

• A end an action that resets all variables to 0, in order to start a new observation.

A short example is given to illustrate the generation of the requirements. For simplification, the transitions will be called by their associated activities from now on: Example 1. Let Σ act = {Eat, W ake up, Shower, T oilet, P ills, Sport, Smoke} be a set of activities to be monitored, according to the following requirements:

• At least one meal a day: a guard eat > 0 is associated to End obs • Use the toilet at least once a day but less than 6 times: a guard toilet > 0 is associated to End obs ; another guard toilet ≤ 5 is associated to T oilet • Take three pills (one in the morning, one during lunch and one in the evening): a guard pills > 2 is associated to End obs ; another guard pills ≤ 3 is associated to P ills • Don't smoke: a guard smoke! = 0 is associated to Smoke • Shower at least once a day: a guard shower > 0 is associated to End obs ) With these informations, Procedure 1 builds the requirement flower illustrated in Fig. 8

B. Detection of deviations

Based on disease evolutions, two kinds of behaviour deviations are to be supervised. On one hand, sudden deviations represent a change of behaviour in a short span of time and might be critical. On the other hand, smooth evolutions of the behaviour in a long period of time could represent a new pathology or an evolution of disease. Two strategies are proposed to detect them.

1) Local deviations:

Local deviations are deviations detectable in only one sequence of events (one observation period). The method used to detect deviations is inspired by the residual technique [START_REF] Roth | The concept of residuals for fault localization in discrete event systems[END_REF]. A residual is a fault indicator based on the gap between a faultfree model and the reality. In this context, it represents the difference between the desired behaviour of the inhabitant (the requirement flower is the fault-free model expertly designed) and its actual behaviour observed (the reality). Then, two kinds of residuals are defined:

• Res1: a behaviour is observed but was not expected • Res2: an expected behaviour is not observed In this work, all events of Σ S act are always expected, because there exists a transition for each event, hence the residuals defined as above cannot be used. However, given the requirement flower, it is assumed that the guards are satisfied when a transition is fired. Therefore, an unexpected behaviour would be the firing of a transition without satisfaction of the guard. A new residual is therefore designed on guards as being the requirement(s) unsatisfied when firing the transition labeled by the observed event:

Definition 5. Let e obs be the observed event. The residual on guards is defined by: Res = {g v ∈ G | δ(q, e obs , a v ) = q ∧ g v is false} where a v and g v are the actions and guards associated to the transition labelled by e obs

The following example is given to illustrate the purpose of residuals:

Example 2. Fig. 9 represents the extended automaton with a single state; Let Σ = {A, B, C, D} be the set of activities, where D is the event representing the end of observation.

g v a < 3 a ≥ 1 a < 3 a ≥ 1 a > 0 c < 2 c < 2 b > 0 c > 0 Res ∅ ∅ ∅ ∅ {c > 0} v
(1000) (1100) (2100) (2200) (0000) Let 'ABABD' be the observed sequence. Let V = {a, b, c, d} be the set of variables, and v be the vector of the values of the variable. In the initial state, v = (0000). The table of Fig. 9 shows the evolution of Res after each event of the sequence observed. In this table, g v represents the requirement(s) in relation to the occurred event and v the vector of variables after the occurrence of the event.

In this example, no residual is computed during the activities. However, at the end of the observation, when D occurs, the guard is not satisfied, hence a local deviation is found. Moreover, the residuals provide a set of activities which are potentially deviant. In this example, the deviation is located in activity C: it should have been performed at least once during the observation window.

This example illustrates that a local deviation can easily be detected with the residual method; it is detected as soon as possible and provides a list of activities that can be causes of the deviation.

2) Global deviations:

Global deviations are deviations that cannot be detected with one observed sequence only. Some pathologies like Alzheimer imply indeed a smooth deviation of behaviour of the inhabitant (forgetting more and more often to shower for instance). If a requirement is not fulfilled just once, it might be irrelevant; missing a meal once is bad behaviour but not necessary dangerous. However, missing four meals in a week becomes an issue; the repetition of the unfulfillment surely is relevant. In this case, the frequency of unsatisfied guards on multiple observation windows are studied.

For that purpose, the previous set of guards G is split into two subsets: G l represents the requirements for local deviations while G g represents requirements for global deviations. The latter, extended requirements are defined as following: Definition 6. A requirement for a global deviation is defined as a couple (g, τ ) such that:

• g ∈ G g represents predicates on variables V , • τ represents a requirement on the frequency f of local deviations.

Given n observations, the frequency f of a local deviation is defined by:

f = 1 n n i=1
x i , where

x i = 1 if g ∈ Res i x i = 0 otherwise
Based on the previous definition, we can define the residual in order to detect global deviations: Definition 7. Let n be the number of observed sequences, C g be a set of requirements for global deviations. Then, the residual in order to detect global deviations is defined by: Res global = {(g, τ ) ∈ C g |τ is false} Example 3. Let n = 10 be the number of observed sequences, and let the requirement flower of Example 4 be extended with two global requirements. In order to satisfy for instance for instance (g 1 , τ 1 ) = (a < 1, f 1 > 8 10 ), the residual {a < 1} must not appear more than 7 times in the 10 observed sequences. This is illustrated by Fig. 10 The Domus Smarthome ( [START_REF] Kadouche | Support vector machines for inhabitant identification in smart houses[END_REF], [START_REF] Chikhaoui | A new algorithm based on sequential pattern mining for person identification in ubiquitous environments[END_REF]) is a living lab of the University of Sherbrooke (domus.usherbrooke.ca). This apartment, illustrated on Fig. 11, is equipped by 36 binary sensors (IR, Pressure detector, Lamps, door contacts, switch contacts, flow meter). Different users have been asked to perform the morning routine in the apartment (ie from waking up to leaving the apartment), while registering the evolution of the sensors values. The Trace generated by sensors is under this form: Sensor ID / Sensor Name / Sensor Location / Value

Although the algorithms presented in this paper have been tested on all users, only the results obtained for the first one are presented in this paper, for the sake of understandability. Different maps are constructed for each user, according to their own habits, whereas the requirement flower remains the same. Each user performed the routine ten times, thus ten sequences of events can be compared in order to find frequent patterns. The events generated by the infra-red sensors have not been taken into account, because of their intrusiveness (a lot of irrelevant events generated), and they are mainly concerned by the localization of the inhabitant.

B. Data mining result

Using only SensorID/Value of the trace generated by the Domus Smarthome, the application of the method of section V.B led to the discovery of 36 patterns, summarized in Table I It can be noted that more and more complex patterns are discovered when the support gets lower. A few elementary The sensors used in this experiment are described in the following section.

Sensors description

The Domus smart home is equipped with the following sensors categories:

1-Infrared (IR) movement detectors: they provide the users' location in a zone.

They cover a zone or a part of a zone. For example there is only one IR detector that covers the entire zone in the dining room and living room (salon), whereas three are installed in the kitchen covering oven, sink and toaster.

2-Pressure detector: in form of tactile carpets placed on entrance hall, it detects the user moving between the bedroom and living room. The users can use two paths to move around these two zones are through the kitchen or through the entrance hall. patterns can still be found, but might be of little relevance in the behaviour of the inhabitant (for instance, an elementary pattern of length 2 and support 2 depicts a succession of two events that happened only twice, and can merely be considered as an habit).

C. Mapping the habits of a person

The application of the method presented in section III.C led to the construction of the automaton presented in Figure 12. For a visibility purpose, only the main transitions, i.e. not the interruptions, have been represented. The automata representing low support elementary patterns not contained in complex patterns have as well not been represented.

1) Identifying activities:

In order to identify activities, it is possible to expertly analyse the map, and delimit areas. Five activities are expected in the Domus dataset: Waking up, Use Toilet, Preparing Breakfast, Having Breakfast, Washing Dishes. The first two can be associated to areas of the map. The third and the fifth are associated to the kitchen activities area. The fourth would need the information on the location to be distinguished, thus requiring a location tracking model to be coupled.

2) Real-time identification: When the real-time observation of the inhabitant begins, the set of active states is the set containing all the initial states. When an event occurs, the set of active sets is updated according to the transition function. When one or more marked states become active, one or more habits have been recognized, and an event of Σ act is generated accordingly.

3) Adaptation of the map: After the observation is over, the observed sequence of events can be used to recompute the map. The patterns that have been recognized will see their support strengthened, confirming which are the fundamental habits of the inhabitant.

D. Detecting deviations

From the set of activities discovery in previous step, we have Σ act = {Waking-up, Use Toilet, Preparing Breakfast, Having Breakfast, Washing-Dishes}.

1) Requirements from medical team: The observation window is set to one day (the morning routine is done only once a day), and the following requirements are considered:

• g 1 : have exactly one breakfast (divided into two subguards: g 1a represents at least one breakfast, and g 1b represents no more than two.) • g 2 : do not use the toilet more than 4 times.

• g 3 : wash dishes each day.

The following global requirements are also considered for each week (n=7):

• (g 2 , τ 4 ): do not use the toilet more than 4 times a day, 5 days out of 7 • (g 1a , τ 5 ): do not forget to eat breakfast more than twice a week • (g 3 , τ 6 ): do not forget to clean the dishes more than once in 4 days These requirements may seem simple, but actually represent the kind of requirements the medical staff may have difficulty to supervise. Indeed, elderly people may wake-up many times in the night to use the toilet, go back to sleep and do not remember. Autonomous people suffering from Alzheimer may forget whether they took a meal or not, and if not, how frequently ?

Based on these requirements, Σ S act = {Use Toilet, Having Breakfast, Washing Dishes}, to which the event End Obs is added.

2) Building the requirement flower: Procedure 1 is applied, and the requirement model is shown on Fig. 13.

3) Deviations detection with residuals: With the previously built model, behaviour detection is possible. In order to test the ability to detect some deviations, some sequences of the Domus database have been modified or added, each sequence representing one day:

• a cycle "Waking-up, Use Toilet" is reproduced at the beginning of some sequences in order to simulate an inhabitant that wakes up in the middle of the night. • in some sequences, the events representing breakfast are removed; • in other sequences, the events representing shower are removed; • in a few sequences, the events representing dish washing are removed;

Table II shows the results of deviations detection for each day, and its interpretation. Until Day 9, no global deviations are detected, whereas some local deviations occur. The medical staff can consider that these local deviations are part of the irregularity of the human behaviour (eating a bit too much, using the toilet, forgetting the dishes), or that they are more critical (forgetting to eat) and require an intervention. Then, in the last days, multiple alerts from global deviations are generated: the toilet has really been used too much compared to what the medical staff expected, the dishes are forgotten too often,... There could be a medical trouble (urinary deficiency, Ahlzeimer's disease, a fall ?), and the staff can contact the inhabitant to check for trouble, and monitor him into taking the breakfast he forgot. Local deviations become important if we consider their repetition in a larger timescale, and both kind of alerts can be relevant for the medical staff.

CONCLUSION AND FUTURE WORK

In this paper, we propose a model-based framework, composed of two approaches, based only on binary sensors (like motion or pressure sensors), to detect behaviour deviations of a monitored inhabitant. Firstly, from a log of binary sensor events (rising and falling edges), the habits of the inhabitant are extracted by sequence mining techniques and modelled by Extended Finite Automata (EFA). Such a model is then used for online recognition of the activities of daily living. Then, we propose an approach, based on residuals techniques, to detect two kinds of deviations of the behaviour of the inhabitant. Local deviations are detected on a short timescale whereas global deviations consist in repetitions of local deviations, and are detected on a longer timescale. They represent unfulfilled medical requirements, and the medical staff monitoring the inhabitant can react accordingly.

Future work focuses on the next major improvements. The first one is the inclusion of time in the patterns, in order to detect inherent temporal deviations of the execution of the habits (slower or faster than usual). The second improvement concerns the assumption that a sequence of habits does not hold repetitions of the same event in the sequence. This assumption was holding for the morning routine presented in this paper, but should be removed to develop a more robust method, applicable to larger timescales. A third improvement would be the development of clustering techniques to automatically build activities from the map of habits. Finally, formal expressions could be used for a better use of the medical textual requirements.

APPENDIX A EXAMPLE OF ALGORITHM OF SEQUENCE MINING

Let D be the following dataset, over the set of events Σ ={1,2,3,4,5,6,7,8}:

• S 1 =[1,2,3,4,5,6]
On one hand, habits H 1 and H 2 can be considered as fundamental, with high support. On the other hand, H 5 , which consists of the succession of two habits, can be considered as a way to perform an activity. H 5 also provides information on the observed behaviour: it states that sometimes, H 3 is followed by H 2 . Hence, should H 3 be observed, there is a chance for H 2 to start next.

Fig. 1 .

 1 Fig. 1. Overview of the proposed approach

Fig. 2 .

 2 Fig. 2. Building a model from sequences of events issued of a Smart-Home

1 Σ\{1}Fig. 3 .

 13 Fig.3. EFA modelling the elementary pattern[START_REF] Kleinberger | Ambient intelligence in assisted living: Enable elderly people to handle future interfaces[END_REF][START_REF] Eurostat | Eurostat population projections 2010-based[END_REF][START_REF] Organization | Good health adds life to years[END_REF][START_REF] Poppe | A survey on vision-based human action recognition[END_REF], with Σ the set of all events that can be generated by the sensor network

Fig. 4 .

 4 Fig.[START_REF] Poppe | A survey on vision-based human action recognition[END_REF]. EFA modelling the complex pattern P 2 =[P 1 ,3,4], with Σ the set of all events that can be generated by the sensor network.

Fig. 5 .

 5 Fig.[START_REF] Lara | A survey on human activity recognition using wearable sensors[END_REF]. EFA modelling the complex pattern P 2 =[1,2,P 1 ], with Σ the set of all events that can be generated by the sensor network.

Fig. 7 .

 7 Fig. 7. Framework of behaviour deviations detection

Fig. 8 .

 8 Fig. 8. Requirement flower for Example 3

Fig. 9 .

 9 Fig. 9. Requirement flower for Example 4 and study of the residuals for the sequence 'ABABD'

Fig. 10 .

 10 Fig. 10. Requirement flower extended with global requirements

Fig 1 :

 1 Fig 1: Domus smart home plan

3 -

 3 Lamps Light switches: these sensors send an event every time the occupant turns the lights on or off. 4-Door contacts: these sensors are placed on the doors. They send an event related to the door state (open or close).5-Switches contacts: the same as door contact, they are placed on the lockers and fridge. They provide an event when their state is changed either opened or closed.

Fig. 11 .

 11 Fig. 11. Domus smart home plan

Fig. 12 .

 12 Fig. 12. Map of the habits of User 1 of the Domus Database. Selfloops and labels are not represented to improve the lisibility; the emphasis is put on the support to show sequences of habits that are very representative of activities.

Fig. 13 .

 13 Fig. 13. Requirement flower for the Domus dataset

  Database D of n sequences, minimum support Supp min , set of events Σ List disc =Init(D, Supp min , Σ) List cand =CandGen(List disc ) while List cand = ∅ do for pattern cand in List cand do EvalSupp(pattern cand ) if Supp(pattern cand )≥ Supp min then Add pattern cand to List disc for pattern disc in List disc do if pattern disc ⊂ pattern cand then List elem , List of patterns of elementary length Remark 1. Let |Σ| be the size of the set of events, |D| the size of the database, and |S| max the length of the longest sequence in the database. Evalsupp handles the problem of finding subsequences in the whole database, thus is of complexity O(|D||S| 2 CandGen-Candidate Generation Function Require: List of previously discovered patterns List disc List cand =[] for Pattern 1 =[e 1 1 , e 1 2 , . . . , e 1 n ] in List disc do for Pattern 2 =[e 2 1 , e 2 2 . . . , e 2 m ] in List disc do if [e 1 2 , . . . , e 1 List cand , list of possible patterns length 2, so Algorithm 2 is of complexity O(|Σ| 2 |D||S| 2 max ). Then, Algorithm 3 being of complexity O(|List disc | 2 |S| max ), and List cand being necessary empty after |S| max candidate generations, Algorithm 1 is of complexity O(|Σ| 4 |D||S| 3 max

	• The shorter patterns that helped generate the newly discovered pattern are deleted, because no longer relevant. Algorithm 1 Continuous Pattern Discovery Require: Delete pattern disc end if end for end if end for List cand =CandGen(List disc ) end while return List disc , List of discovered patterns satisfying minimum support Algorithm 2 Init-Initialization function Require: Database D of n sequences, minimum support Supp min , set of events Σ List elem =[] for Event1 in Σ do for Event2 in Σ do pattern test = [Event1,Event2] EvalSupp(pattern test ) if Supp(pattern test )≥ Supp min then Add pattern test to List elem end if end for end for return n ]=[e 2 1 , . . . , e 2 m-1 ] then Add [e 1 1 , e 1 2 =e 2 1 , . . . , e 1 n =e 2 m-1 , e 2 m ] to List cand end if end for end for return

max ). There are at most |List disc | = |Σ|(|Σ| -1)/2 patterns of Algorithm 3

  Algorithm 4 Building the hierarchy of patterns Require: List of patterns and their supports List patterns List str =[ ] for support=Support max to 2 (decreasing) do for pattern ∈ {List patterns } such that Supp(pattern)=support do while ∃ pattern str ∈ List str such that pattern str ⊂ pattern do Substitute pattern str in pattern end while Add pattern to List str end for end for return List str , List of structured patterns patterns. An example is presented in Appendix B. Remark 2. Let n be the number of discovered patterns, and L the length of the longest discovered pattern. Algorithm 4 is of complexity O(n 2 L 2 ), hence polynomial as well as Algorithm 1.

  being an elementary pattern contained in P 2 =[1,2,P 1 ]. 1) Suppose that the sequence [1,2,3] has already been played. The set of current states of the automaton is {P 1 .1}, and H2=1. Since δ(P 1 .1, 4, ., .) = P 1 .2 and δ(P 1 .1, 4, H2 == 1, .) = P 2 .4, if 4 occurs, the set of current states becomes {P 2 .4,P 1 .2} and both patterns are recognized, which is the expected outcome. 2) Suppose now that the sequence [2,3] has been played. The set of current states of the automaton is {P 1 .1, P 2 .0}, and H2=0. If 4 occurs, the new set of current states becomes {P 2 .0,P 1 .2}, and only P 1 is recognized, which is the expected outcome.

TABLE I PATTERNS

 I DISCOVERED FOR USER 1

	Support	Elementary	Complex	Min Length	Max Length
	10	5	-	2	2
	9	1	3	2	6
	8	1	1	3	11
	7	-	2	3	6
	6	-	1	7	7
	5	1	3	2	12
	4	1	2	2	4
	3	2	2	2	9
	2	3	8	2	15

By repeating for supports 3 and 4:

APPENDIX B EXAMPLE OF BUILDING THE HIERARCHY OF PATTERNS

Let List patterns be the following: Finally, and after the conversion of patterns into habits, List str is: