U NIVERSITY OF C OIMBRAFACULTY OF S CIENCES AND T ECHNOLOGY
D EPARTMENT OF P HYSICSS ENSOR -BASED D ETECTION OF
A LZHEIMER ’ S D ISEASE -R ELATEDB EHAVIOURSS AMUEL DO NASCIMENTO L AGO P EDROC OIMBRA
2013

Esta cópia de tese é fornecida na condição de que quem a consulta reconhece que os direitos
de autor são pertença do autor da tese e que nenhuma citação ou informação obtida a partir delapode ser publicada sem a referência apropriada.

This copy of the thesis has been supplied on condition that anyone who consults it is understood to recognize that its copyright rests with its author and that no quotation from the thesis
and no information derived from it may be published without proper acknowledgement.

U NIVERSITY OF C OIMBRAFACULTY OF S CIENCES AND T ECHNOLOGY
D EPARTMENT OF P HYSICSS ENSOR -BASED D ETECTION OF
A LZHEIMER ’ S D ISEASE -R ELATEDB EHAVIOURS

Dissertation presented to the University of Coimbra to complete the necessary requirements for
obtaining the degree of Master in Biomedical Engineering, held under scientific orientation of Paulo
Jorge Carvalho Menezes, PhD, João Manuel Leitão Quintas, MsC.

S AMUEL DO NASCIMENTO L AGO P EDRO
samuelnlpedro@gmail.com
C OIMBRA
2013

AOS MEUS PAIS , AOS MEUS IRMÃOS E À D IANA

Acknowledgements

I would like to express my gratitude to my advisers Professor Paulo Jorge Carvalho Menezes andJoão Manuel Leitão Quintas for their permanent support and guidance, teaching and scientificrigour.
Thanks to the Institute of Systems and Robotics (ISR) and Pedro Nunes Institute (IPN) for
providing all the necessary conditions to complete this work.
I would like to thank all the colleagues I met in ISR, mainly Bruno Patrão, for his advices
and availability.
I am grateful to all the people in the Républica dos Fantasmas, for their fellowship andfriendship throughout these five years.
Thanks to all my friends and colleagues I met in Coimbra, for their companionship andfriendship.
Last, but certainly not least, my deepest gratitude to my parents, my sister and brother, to my
girlfriend and best friend Diana and my friends Miguel and Paulo for their permanent support
during this phase.

Abstract
The Alzheimer’s Disease, which is the main cause of Dementia, is a neurodegenerative disease
with no cure. According to the World Health Organization, in 2010 it was estimated Dementia
affected 35.5 million people worldwide and this number is expected to rise to around 65.7
million in the next 20 years. As the symptoms get worse, patients lose their independence,
becoming completely dependent on others.
In this work, which was developed in collaboration with TICE.Healthy project, we propose
a novel method for detecting one of the disease manifestations that has large impact on patients
daily life, the psychomotor agitation.
The motivation is that having a system capable of detecting these situations may alert caregivers about the crisis, freeing them from constant surveillance of the patients. This has anatural impact on the life quality of both caregivers and patients. The method consists in theanalysis and classification of a set of biosignals captured using wearable sensors that enables
the detection of the critical periods.
A Linux software application was developed which uses a Bluetooth connection to capture data from the wearable sensors. This enables the acquisition of different biosignals of anindividual during his normal house activities.
Using this application, a set of biosignals were acquired for 20 people that represent both
periods of normal behaviour and agitation, for the purpose of training a classifier.
The acquired data was divided in two classes, non-stress (normal state) and stress (agitation
state). Five different classifiers were trained and tested. The performance assessment of theseclassifiers was conducted having into account their accuracy times sensibility (to minimize false
negatives) and run time.
The choice of the final classifier fell on the Support Vector Machines (SVM), as it was theone that provides the best results.

Keywords: Alzheimer’s Disease, behaviour detection, psychomotor agitation, wearable
sensor, classification.

Resumo
A doença de Alzheimer, principal causa de Demência, é uma doença neuro-degenerativa sem
cura. De acordo com a Organização Mundial de Saúde, em 2010 foi estimado que a Demência
afetava 35,5 milhões de pessoas em todo o mundo, sendo que este número tenderá a subirpara perto de 65,7 milhões só nos próximos vinte anos. À medida que os sintomas pioram, os
pacientes perdem a sua independência, ficando completamente dependentes de outrem.
Neste trabalho, desenvolvido em colaboração com o projeto TICE.Healthy, propomos um
método único para deteção de um dos comportamentos relacionados com a doença de Alzheimer
que mais impacto tem no dia a dia dos pacientes, a agitação psicomotora.
A motivação é a criação de um sistema capaz de detetar estas situações e avisar os cuidadores
sobre o alerta, libertando-os de uma constante vigilância dos pacientes. Isto tem naturalmente
impacto tanto na vida do paciente como na do cuidador. O método consiste na análise e classificação de um conjunto de biosinais adquiridos usando um conjunto de sensores de um sistema
vestível que permite a deteção de períodos críticos.
Foi desenvolvida uma plataforma baseada em Linux que usa conexão Bluetooth para adquirir
os sinais do sistema vestivel. Isto permite a aquisição de diferentes biosinais de um indivíduo
durante o seu dia a dia.
Usando esta aplicação, um conjunto de biosinais foi adquirido de 20 pessoas que representam tanto os períodos de comportamento normal como períodos de agitação, com o objetivo detreinar o classificador.
Esta informação foi dividida em duas classes, não-stress (estado normal) e stress (estado agitado). Cinco diferentes classificadores foram treinados e testados. A avaliação do desempenho
dos mesmos foi conduzida tendo em conta a sua exatidão multiplicada pela sensibilidade (paraminimizar falsos negativos) e o tempo de execução.
A escolha do classificador final foi a Máquina de vetores de suporte , já que foi o que
ofereceu melhores resultados.

Palavras-chave: doença de Alzheimer, deteção de comportamentos, agitação psicomotora,
sensor vestível, classificação.

Contents
Contentsi

List of Figuresv

List of Tablesix

Acronyms and Abbreviationsxi

1

Introduction1

1.1

Motivation and Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

1.2

Thesis Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2

1.3

Alzheimer’s Disease . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

1.3.1

Causes and Risk Factors . . . . . . . . . . . . . . . . . . . . . . . . .

4

1.3.2

Symptoms and Progression . . . . . . . . . . . . . . . . . . . . . . . .

5

1.3.3

Diagnosis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

1.3.4

Early Diagnose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

1.3.5

Treatment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

1.3.6

Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

1.4

Symptoms and their Impact on Life Quality of Patients . . . . . . . . . . . . .

10

1.5

State of Art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

122Integration of a Wearable Biosignals Acquisition System

15

2.1

Description of Used Wearable Sensors . . . . . . . . . . . . . . . . . . . . . .

16

2.1.1

bioPLUX device . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16Bluetooth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

22

2.2

i

2.3

2.4

2.5
3

4

2.2.1

Choice of the device to communicate with . . . . . . . . . . . . . . . .

22

2.2.2

Choosing a transport protocol . . . . . . . . . . . . . . . . . . . . . .

23

2.2.3

Communication using sockets . . . . . . . . . . . . . . . . . . . . . .

24

Integration Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

24

2.3.1

Acquisition Application . . . . . . . . . . . . . . . . . . . . . . . . .

25

2.3.2

Player Application . . . . . . . . . . . . . . . . . . . . . . . . . . . .

46

Used wearable sensors analysis . . . . . . . . . . . . . . . . . . . . . . . . . .

52

2.4.1

bioPLUX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

52

Recommendations to bioPLUX Manufacturer . . . . . . . . . . . . . . . . . .

54

Data Acquisition Procedure

57

3.1

Theoretical Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

57

3.1.1

Electrocardiography . . . . . . . . . . . . . . . . . . . . . . . . . . .

57

3.1.2

Electrodermal Activity . . . . . . . . . . . . . . . . . . . . . . . . . .

60

3.2

Rules to Consider a subject apt to the experiment . . . . . . . . . . . . . . . .

61

3.3

Placement and procedure using the wearable sensors . . . . . . . . . . . . . .

62

3.3.1

Accelerometers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

62

3.3.2

Electrodermal Activity . . . . . . . . . . . . . . . . . . . . . . . . . .

63

3.3.3

Channel Configuration . . . . . . . . . . . . . . . . . . . . . . . . . .

64

3.3.4

bioPLUX Chest Strap . . . . . . . . . . . . . . . . . . . . . . . . . .

65

3.3.5

Experimental Procedure . . . . . . . . . . . . . . . . . . . . . . . . .

66

Detection of Alzheimer’s Disease-Related Behaviours

69

4.1

Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

69

4.1.1

Classifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

70

4.1.2

Feature Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . .

77

4.1.3

Outlier Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

83

4.1.4

Significant Feature Selection . . . . . . . . . . . . . . . . . . . . . . .

85

4.1.5

Model Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

89

Implementation and Results . . . . . . . . . . . . . . . . . . . . . . . . . . .

90

4.2.1

Feature Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . .

90

4.2.2

Outlier Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

96

4.2

ii

5

4.2.3

Significant Feature Selection . . . . . . . . . . . . . . . . . . . . . . .

4.2.4Classification Results . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

Conclusion and Future Work
5.1

96

105

Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

Bibliography

109

Appendix

115

iii

List of Figures
1.1

Alzheimer’s Disease (AD) Progression Stages, [5] . . . . . . . . . . . . . . . .

5

1.2

Estimation prevalence of dementia for people in 60s and over [2]. . . . . . . .

9

1.3

Estimation of the evolution of people with dementia in different levels of income [2]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10

2.1

bioPLUX device [15]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

2.2

Connection of the sensor to the main device [15]. . . . . . . . . . . . . . . . .

18

2.3

xyzPlux Triaxial Accelerometer, [17]. . . . . . . . . . . . . . . . . . . . . . .

18

2.4

Accelerometer axes reference, adapted from [17]. . . . . . . . . . . . . . . . .

19

2.5

Roll movement, adjusted from [17] . . . . . . . . . . . . . . . . . . . . . . . .

19

2.6

Pitch movement, adapted from [17]. . . . . . . . . . . . . . . . . . . . . . . .

19

2.7

Excerpt of the acquisition file. . . . . . . . . . . . . . . . . . . . . . . . . . .

20

2.8

EcgPlux triode sensor, adapted from [18] . . . . . . . . . . . . . . . . . . . .

20

2.9

EdaPlux sensor, adjusted from [19]. . . . . . . . . . . . . . . . . . . . . . . .

21

2.10 bioPLUX Chest Strap, front (a) and back (b) . . . . . . . . . . . . . . . . . . .

21

2.11 Starting window of the acquisition software. . . . . . . . . . . . . . . . . . . .

26

2.12 Default mode in advanced channels selection. . . . . . . . . . . . . . . . . . .

27

2.13 Custom mode in advanced channels selection. . . . . . . . . . . . . . . . . . .

28

2.14 Settings group in acquisition mode. . . . . . . . . . . . . . . . . . . . . . . . .

29

2.15 Mode cycle of the application. . . . . . . . . . . . . . . . . . . . . . . . . . .

30

2.16 Global flowchart of the application. . . . . . . . . . . . . . . . . . . . . . . .

30

2.17 Previous settings, the first phase of the application. . . . . . . . . . . . . . . .

31

2.18 Flowchart illustrating the work flow between the start of the program and the
beginning of the acquisition process. . . . . . . . . . . . . . . . . . . . . . . .

v

32

2.19 Error dialog windows in case no channel is selected, once a bioPLUX device
is connected. There are three different cases, one in basic mode (a), one inadvanced default mode (b) and eventually in advanced custom mode (c). . . . .

34

2.20 Pop up window once a new device is discovered. . . . . . . . . . . . . . . . .

34

2.21 Pop up window informing the device found is already indexed. . . . . . . . . .

34

2.22 Preparation of the acquisition environment. . . . . . . . . . . . . . . . . . . .

35

2.23 Work flow during the sampling process. . . . . . . . . . . . . . . . . . . . . .

37

2.24 Acquisition cycle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

38

2.25 Example of error in y axis. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

39

2.26 Selective choice of channels display. . . . . . . . . . . . . . . . . . . . . . . .

39

2.27 Electrocardiography (ECG) signal from its individual tab. . . . . . . . . . . . .

40

2.28 Acquisition example in advanced custom mode, using an accelerometer, anElectrodermal Activity (EDA) sensor and a bioPLUX Chest Strap to acquire
ECG signal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

40

2.29 EDA signal from its individual tab. . . . . . . . . . . . . . . . . . . . . . . . .

41

2.30 Last part of the application . . . . . . . . . . . . . . . . . . . . . . . . . . . .

42

2.31 Options in non-sampling mode. . . . . . . . . . . . . . . . . . . . . . . . . . .

42

2.32 Success saving the file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

43

2.33 Error saving file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

43

2.34 Example of save files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

44

2.35 Initial window of the display application. . . . . . . . . . . . . . . . . . . . .

47

2.36 Global flowchart of the display program. . . . . . . . . . . . . . . . . . . . . .

48

2.37 Example of error window, opening saved data file. . . . . . . . . . . . . . . . .

49

2.38 Display application window after a successful loading. . . . . . . . . . . . . .

50

2.39 Data loaded into the corresponding plots. . . . . . . . . . . . . . . . . . . . .

51

2.40 Example of Chest Strap band in a thin female subject. . . . . . . . . . . . . . .

55

3.1

Representation of the heart conduction systems, also known as the His-Pukinje
conduction system [21]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

vi

58

3.2

Influence of disorders in amplitude of ECG waveform. Low amplitude belongs
to an obese woman, while the high amplitude waveform is from a hypertensive
man [21]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

59

3.3

Normal waveform of ECG, [22]. . . . . . . . . . . . . . . . . . . . . . . . . .

59

3.4

Arrangement of the six chest electrodes for the 12 lead electrocardiography [23]. 60

3.5

Accelerometers used to track body movements. . . . . . . . . . . . . . . . . .

62

3.6

Position of centre of mass accelerometer. . . . . . . . . . . . . . . . . . . . . .

63

3.7

Position of knee accelerometer. . . . . . . . . . . . . . . . . . . . . . . . . . .

63

3.8

Position of the EDA sensor. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

64

3.9

Arrangement of sensor through the channels, adapted from [15]. . . . . . . . .

64

3.10 System prepared to be used in acquisition. . . . . . . . . . . . . . . . . . . . .

65

3.11 Pinning the device. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

65

3.12 Placing conductive gel in the band electrodes surface . . . . . . . . . . . . . .

66

3.13 Chest Strap Band correct position. . . . . . . . . . . . . . . . . . . . . . . . .

66

4.1

Example of two classes of data described by two-dimensional feature vectors [27]. 70

4.2

Sliding-window process. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

71

4.3

Example of data distributed in a 2-dimensional space, [31]. . . . . . . . . . . .

71

4.4

Representation of the new point to be classified. . . . . . . . . . . . . . . . . .

72

4.5

Representation of the new point to be classified using K Nearest-Neighbors(KNN) classification method, [32]. . . . . . . . . . . . . . . . . . . . . . . . .

4.6

73

Representation of the function that separates the two classes represented in the
figure (green and red), [35]. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

75

4.7

result of the SVM classifier separation of the classes, [35]. . . . . . . . . . . .

76

4.8

Orientation of the axes, adapted from [38]. . . . . . . . . . . . . . . . . . . . .

79

4.9

Illustration of the movement planes. . . . . . . . . . . . . . . . . . . . . . . .

80

4.10 Illustration of the angles. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

80

4.11 Flowchart Showing the implementation of the method. . . . . . . . . . . . . .

91

4.12 Acquisition before and after gravitational acceleration removal. . . . . . . . . .

91

4.13 Angle variation from the signal in illustrations 4.12. . . . . . . . . . . . . . . .

92

4.14 Fast Fourier Transform of the variations of the angles . . . . . . . . . . . . . .

93

vii

4.15 Original signal of ECG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

94

4.16 Filtered signal of ECG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

94

4.17 R-peaks detection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

94

4.18 Original signal of EDA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

95

4.19 Processed signal of EDA. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

95

4.20 P-values for each feature. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

97

4.21 Three different features represented by the ROC cruve. . . . . . . . . . . . . .

98

4.22 Individual feature evaluation results. . . . . . . . . . . . . . . . . . . . . . . .

99

viii

List of Tables
1.1

Statistic values of dementia epidemiology over the world. . . . . . . . . . . . .

1.2

Observable behavioural changes in an Early stage of AD, by decreasing observation frequency [4]. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.3

9

11

Behavioural changes with most impact in AD patients and caregivers life quality, by decreasing observation frequency [4]. . . . . . . . . . . . . . . . . . . .

11

4.1

Example of feature names to α angle variation. . . . . . . . . . . . . . . . . .

92

4.2

Number of features below the threshold chosen. . . . . . . . . . . . . . . . . .

96

4.3

Complete results for filter methods, sorted by descending AUC. Note the correspondence between higher scores and lower p-values. . . . . . . . . . . . . . . 100

4.4

Final results of the Genetic Algorithm (GA)/KNN method, being the significance how many times each features is in the final one thousand subsets. . . . . 101

4.5

Final average results of control testing. . . . . . . . . . . . . . . . . . . . . . . 102

4.6

Final average results for different selection method, using the five classifiers. . . 103

4.7

Run-time of feature selection methods. . . . . . . . . . . . . . . . . . . . . . . 104

ix

Acronyms and Abbreviations
ACC

AccuracyAD

Alzheimer’s Disease

ADC

Analog to Digital Converter

ApoE

Apolipoprotein E

AUC

Area Under the ROC Curvebpm

beats per minute

CRC

Cyclic Redundancy CheckCT

Computed Tomography

DA

Discriminant Analysis

EDA

Electrodermal Activity

ECG

Electrocardiography

FFT

Fast Fourier Transform

FN

False Negatives

FP

False Positives

FS

Fisher’s Scoreg

G-force

GA

Genetic Algorithm
xi

GSR

Galvanic Skin Response

HR

Heart Rate

Hz

Hertz

ISR

Institute of Systems and Robotics

KNN

K Nearest-Neighbors

LSB

Least Significant Bit

MATLAB

Matrix Laboratory

MCI

Mild Cognitive Imparment

MRI

Magnet Resonance Imaging

MSB

Most Significant Bit

PET

Positron Emission Tomographysseconds

SP

Specificity

SPET

Single Positron Emission TomographySS

Sensibility

TN

True Negatives

TP

True Positives

SVM

Support Vector Machines

V

Volts

Wilcoxon

Wilcoxon Rank Sum

xii

Chapter 1
Introduction
1.1

Motivation and Objectives

Alzheimer’s Disease (AD) is the main cause of Dementia (∼ 55% cases [1]), known as a neurodegenerative disease which is of progressive nature. The symptoms worsen over time, leading
to the deterioration of the patient’s quality of life as well as their caregivers. Being diagnosed
with AD means losing our own independence. There is no cure for such disease and its degreeof progressiveness is variable. It is usual that after the first diagnostic, some people may yet live
for several years, nonetheless completely dependent from others.
According to the World Health Organization, in 2010 it was estimated Dementia affected
35.5 million people worldwide and this number is expected to rise to around 65.7 million in thenext 20 years. This means an increase of around 85% [2]. This numbers show how important
this matter is and will increasingly become in the future. There is indeed a great interest inproviding tools to help caring centres and caregivers in monitoring these patients. It is wellknown the first efforts are toward discovering an early diagnose method, however one cannot
forget those who are already diagnosed, most of the times on a late phase, and suffering fromthe symptoms.
We may cite one example of how those symptoms affect the person’s life. Elena Cabelata
de Garcia, from Dominican Republic was diagnosed with AD. Her husband stated: "Elena
first went to the doctor with the complaint that something was wrong because she felt lost andstrange. She became disoriented on several occasions while taking the bus she had been taking
for years." [3]. From this time on, this person became completely dependent on a caregiver that1

CHAPTER 1. INTRODUCTION

accompanied her all the time.
This is an example quite representative of what happens with AD patients. From a certain
point on they need the presence of somebody that watch for their actions and needs. Nevertheless, in the early phases of the disease, this need for third person support is not permanent.
Therefore the existence of monitoring systems that can alert caregivers for these needs, would
give much more freedom both for the patients and caregivers.
In fact for daily monitoring of people the alternatives are limited to sensors installed on theenvironment like cameras that may only observe macroscopic behaviours of people in limitedareas, or body mounted sensors that may register different types of information like body temperatures, body/limb acceleration, heart rate, among others. The disadvantages of the latter are
related with autonomy and restriction of usage in the area permitted by the communications.
There are indeed devices for medical use like 24h Electrocardiography (ECG) which records
the signals for offline analysis, but we are interested in more flexible systems. The increasing computing and communication capabilities of modern smartphones open the possibilitiesof having online monitoring not only registering the signals for offline use but also for periodic evaluation of physical condition by a specialist or triggering alarms upon the detection ofcritical situations.
In this work, developed in collaboration with TICE.Healthy project, we propose a novel
method for detecting AD-related behaviours, employing a set of sensors. Among these behaviours, one can select psychomotor agitation, which corresponds to the manifestation withthe highest impact in the patient and caregiver welfare [4]. Being able to recognize it, we hope
to restore some of the life quality AD patients and caregivers lose, as the caregiver will not haveto be always present, being the system aware of writing and reporting detected events to them.

1.2

Thesis Outline

This thesis is composed by five chapters and it is organized as follows.
The Chapter 1 presents the motivation of this work with a brief exploration of the contents. There is also reference to the implemented work in a short summary. Here, the AD is
explored and among with its risk factors, its symptoms and progression. The diagnose andtreatment is also assessed, exploring its different approaches. Finally, an evaluation of statistics

2

1.3. ALZHEIMER’S DISEASE

is performed. An evaluation of observable symptoms and their impact on the life quality of AD
patients is performed. With this evaluation we intend to understand what AD-related behaviours
can be detected through available wearable sensors instrumentation.
The material assessment with its capabilities and the hardware integration necessary forsignal acquisition from the chosen set of sensor is explained in Chapter 2. Here, every step andfunctionality of the application package is explored with examples and diagrams.
The data acquisition procedure is presented in Chapter 3, with the necessary theoreticalbackground needed. The principle behind ECG exam is described as for Electrodermal Activity(EDA) also known as Galvanic Skin Response (GSR) measuring system to elucidate the use of
the correspondent sensors. Finally, the operation of an accelerometer is refereed.
The Chapter 4 presents the implemented method to detect Psychomotor agitation in AD
patients. The chapter is divided in sequential steps to achieve the detection model. The processincludes data pre-processing, feature extraction, outlier removal, feature selection, algorithm
training, classification and finally results analysis.
Finally, the Chapter 5 presents the conclusion of this work. In this chapter, it is also presented the possible future work.

1.3

Alzheimer’s Disease

Understanding AD is crucial in the development of a monitoring system for patients sufferingfrom this disease. In this section, AD is assessed exploring its risk factors, symptoms andprogression, diagnose, treatment, evaluating the pros and cons of various approaches. Global
worldwide statistics are also mentioned.
AD is an progressive neurodegenerative brain disorder which slowly degrades cognitive
functions of its carrier, like memory and thinking skills and, in latter cases, even the flexibility
to perform the simplest tasks of the person’s daily routine. With the progression of the sickness
symptoms tend to get worse, spreading to language for example.
AD is the most common cause behind dementia among elderly people, counting around
55% cases [1]. It is named after Dr. Alois Alzheimer, which in 1906 noticed strange loss ofbrain tissue of a woman who had died of an uncommon mental illness. During her lifetime,
symptoms like memory loss, language problems and unpredicted behaviour were frequently

3CHAPTER 1. INTRODUCTION

present. Examining her brain, he noticed amyloid plaques and neurofibrillary tangles. These
are now considered two of the foremost relevant features of AD along with lost of connection
between nerve cells in brain [5].

1.3.1

Causes and Risk Factors

Although scientists do not yet completely understand what causes AD, they are certain it derives from a series of events developing within the person’s brain, for a long time before any
symptoms are reported. At birth, a person’s brain can have over 100 billion nerve cells. By
death time, the brain might have lost near half its weight.
Through the most likely causes of AD, we can count genetic, environmental and lifestylefactors.

Genetics
Studies suggest genetics inheritance is responsible for around 80% of the likelihood of developing AD. Normally, those who develop AD in their early 30s to 50s have a mutation in oneof three genes. They inherited those from their parents. Nevertheless, not all early cases arecaused by those mutations.
Late-onset AD, often developed after age of 60, is related with a gene called Apolipoprotein
E (ApoE), which is present in around 25% of world’s population. Having one number of forms,
when the ApoE ε4 is present, triples the probability of developing AD. Having two copies ofthis gene multiplies the risk by six to fifteen times. Around 40% of subjects who are diagnosed
with late-onset AD’s are carriers of this gene. Still, carrying this gene does not actually mean
the person will suffer from the disease. Additional genes are believed to influence a late-onset
advance. Researchers have identified variants of the SORL1, CLU, PICALM, and CR1 genes
which may influence the risk of developing late-onset AD [1, 5].

4

1.3. ALZHEIMER’S DISEASE

Environmental and Lifestyle
Practising mentally stimulating activities, along with a nutritious diet, physical activities and an
active social life plays an important role in staying healthy over the ageing years. New studies
also suggest these might help reducing the risk of developing AD.
Currently, scientists are working to figure out connections between cognitive degradationand for example such as heart conditions, diabetes, diet, vascular diseases, obesity and low
educational attainment. Unveiling these connections can, in the future, tell if we can reduce therisk of developing AD by preventing the incidence of these diseases and factor lifestyles [1, 5].

1.3.2

Symptoms and Progression

AD symptoms and progression will be divided in four different stages, very early, mild, moderate and finally severe stage. With the progression, neurofibrillary tangles spread inside the brain,
represented in blue in figure 1.1. Plaques also propagate starting in the neocortex. In illustration
1.1, it is clear that after the primary section, brain tissue has already shrunk considerably.
Very Early Stage
By this stage the first symptoms to appear
are memory problems. People who have morememory issues than usual for their age areclassified as amnesic Mild Cognitive Imparment (MCI). Being classified as such means
the person as more possibility of developing
AD than normal.
Mild Alzheimer’s Disease
In this phase the memory loss problems
continue to progress, while new issues relatedwith cognitive capacities start to appear. The
person starts to get lost, has trouble handling

Figure 1.1: AD Progression Stages, [5]money, typically repeats the same questions,has poor judgement and often takes longer than usual to complete traditional daily tasks. This isaccompanied with often times temperament changes, which frequently result in agitation. Most
5

CHAPTER 1. INTRODUCTIONof the cases are diagnosed in this stage.
Moderate Alzheimer’s Disease
By this stage, people start to have problems recognizing friends and family. Language
and reasoning begin to be affected and therefore people have difficulties in having conscious
thoughts. They can no longer perform tasks with multiple steps or even learn new things. They
may suffer from psychosis and behave impulsively, increasing their agitation and stress crisis.
An agitation and anxiety crisis of an AD patient, at this stage, includes sleep perturbations,
delusions, hallucinations, pacing, restless movement, checking and rechecking door locks, emotional anguish, and inexplicable cursing or threatening language [5, 6].
Severe Alzheimer’s Disease
When a person is in the final stage of AD, plaques and tangles have unfold all over the brain
affecting multiple cognitive areas. By this stage the person in no longer able to communicate.
In the very end, they may spend most of the time in bed, being utterly dependent from others.

1.3.3

Diagnosis

AD cannot be diagnosed in life with entire confidence. This can solely be done in an autopsy
by examination of brain tissue in correlation with the person’s clinical course. However, nowadays doctors have fairly accurate tools to help determine if the person’s has "possible AD" or"probable AD". To do so, doctors follow some procedures,• Asking questions about the person’s clinical record, problems completing daily routines
or noticeable behavioural changes.
• Performing memory tests like problem solving, attention, counting or language processing.
• Through medical tests, to urine, blood or spinal fluid.
• Performing brain imaging scans such as Computed Tomography (CT) or Magnet Resonance Imaging (MRI) [5].

6

1.3. ALZHEIMER’S DISEASE

1.3.4

Early Diagnose

Developing AD is strongly related with age. Studying how the brain normally changes overtime can improve the knowledge of how AD is developed. Diagnosing AD in an early stage canbring several benefits to the person. First of all, despite the fact that the disease process cannot
be stooped, it helps preserving the person’s function for months to years. Moreover, an earlyprocess helps patient’s family plan the future in financial and legal terms.
Secondly, an early diagnosis allows researchers and scientists to follow the disease along all
progress in clinical trials. In those, they test new drugs and procedures to conclude which are
more effective and in what group of people.
An ideal method of diagnose would be cheap, simple and able to separate AD from othersubtypes of dementia. Several new approaches are in development, such as,
Psychometric tests The foremost common used test is the ’Mini-Mental State Examination’,
which is a method to assess cognitive impairment. It has the advantage of being straightforward to apply but suffers from cultural and social sensitivity, along with results whichchange from day to day. There are more sensitive tests, but are not in extensive clinicaluse.
Brain-imaging Imaging techniques allow the visualization of changes within the brain. Structural imaging (CT and MRI) permits the evaluation of alteration in affected areas, while
functional imaging (Positron Emission Tomography (PET) and Single Positron Emission
Tomography (SPET) scans) allow the report of physiological changes. The use of a dye
permits the visualization of amyloid plaques, which may be an indicator of the unwellness.
Biological markers in corporeal fluids Biological markers present in cerebrospinal fluid andblood are being largely investigated in hope to be classified as markers in AD. For instance, some proteins in abnormal proportions are being examined for this purpose [1, 5].

7CHAPTER 1. INTRODUCTION

1.3.5

Treatment

Currently there are some approaches for AD patients. In these groups are included a varietyof drugs, non-drug techniques such as cognitive retraining or advice, and finally support byassistive technology.
Four drugs are presently used. They interact with mechanisms which allow neurons tocommunicate. Three of them are denominated acetylcholinesterase (AChE) inhibitors, which
help maintain signalling molecule acetylcholine. The last one, the memantine blocks the actionof another signalling molecule implicated in neuronal dysfunction.
Tests suggest drugs give benefits in cognitive functions to about 40% of patients for around
6 to 18 months. However, they do not slow the illness progression. New drugs have been
extensively tested which intend to target root causes, but they might take 15 to 20 years indevelopment.
Assistive technology intends to restore some independence to people with AD. Examples
range from calendar reminders, sensors of orientation, to detecting gas, and falls alerting caregivers or caring centres [1].

1.3.6

Statistics

AD numbers are entirely related with dementia prevalence over the world, being the most probable cause, around 55% of cases [1]. The figure 1.2 illustrates the estimated proportion ofaffected people by dementia.
A better analysis can be made by estimation of numbers for the next 20 and 40 years (2030
and 2050). The table 1.1 shows the dementia numbers tend to duplicate every 20 years.
These numbers can be analysed in terms of level of income. Figure 1.3 shows how thedementia prevalence is distributed by income ratio. The gross number of people suffering fromdementia is estimated to belong to low and middle-income class, which might be related withlevel of education and health system [2].

8

1.3. ALZHEIMER’S DISEASE

Figure 1.2: Estimation prevalence of dementia for people in 60s and over [2].

Table 1.1: Statistic values of dementia epidemiology over the world.
Number of people with dementia

Proportionate increases(millions)(%)

Region
2010

2030

2050

2010–2030

2010–2050

Asia

15.94

33.04

60.92

107

282

Europe

9.95

13.95

18.65

40

87

The Americas

7.82

14.78

27.08

89

246

Africa

1.86

3.92

8.74

111

370

World

35.56

65.69

115.3885

225

9CHAPTER 1. INTRODUCTION

Figure 1.3: Estimation of the evolution of people with dementia in different levels of income [2].

1.4

Symptoms and their Impact on Life Quality of Patients

According to a report, produced by the Center for Neuroscience and Cell Biology of the University of Coimbra for the Tice.Healthy project [4], the Alzheimer’s Disease manifests fromthe early stages in various behavioural changes. The table 1.2 shows the observable changes
ordered by decreasing observation frequency.
These behaviour changes have different impacts on the quality of life of the patients and on
the need for assistance by caregivers. The above mentioned report also analyses the impact ofeach observable manifestation of the disease and ranks then by the corresponding impact. The
results of this analysis are shown on table 1.3.
From the above we can see that the Psychomotor Agitation is present in both tables, being
in first place in terms of impact on the quality of life of the patients. Therefore the detectionof these situations becomes of paramount importance. If automatic mechanisms can be created
for this purpose then both patients and caregivers will gain in terms of freedom, as alarms canbe triggered if these situations occur.
The availability of more and more powerful portable devices, in terms of computationaland communication support, makes them the perfect platforms for deploying these surveillancesystems. It is then important to understand what signs of Psychomotor Agitation can be detected10

1.4. SYMPTOMS AND THEIR IMPACT ON LIFE QUALITY OF PATIENTSTable 1.2: Observable behavioural changes in an Early stage of AD, by decreasing observation
frequency [4].
Observed changes

Relative Frequency

Amnesic deficit

100%

Psychological Alterations

50%

Language Alterations

40%

Depressive Symptomatology

30%

Anxious Symptomatology

20%

Disorientation

20%

Psychomotor Agitation

20%

Lack of Criticism

20%

Loss of ability to plan daily activity

10%

Attention Deficit

10%

Acute Confusion State

10%

Abandon of recreational activities

10%

Table 1.3: Behavioural changes with most impact in AD patients and caregivers life quality, bydecreasing observation frequency [4].
Observed changes

Relative Frequency

Psychomotor Agitation

80%

Psychological Alterations

70%

Psychological Symptomatology

60%

Sleep Disturbances

40%

Depressive Symptomatology

20%

Repetition of the same questions or conversations

20%

Apraxic changes

10%

Executive Function Skills deficit

10%

Difficulty in recognizing relatives

10%

11

CHAPTER 1. INTRODUCTION

with wearable sensors.
This behaviour can be characterized as unintentional and purposeless motions, mental tension and anxiety, among others. This is normally accompanied by and increase of the heart rate.
Using an Electrocardiography sensor, it is possible to detect these heart rate variations in theindividual. Electrodermal Activity sensors can be used to detect anxiety in the patient. Finally,using accelerometer sensors it is possible to analyse the patient movements.
Given this, we propose to develop a system based on wearable sensors that may communicate with some computing platform that is able to detect this abnormal situation. Once detected
it may trigger alarms and warn caregivers or relatives that may come in help of the AD patient.
The wearable sensors of choice are produced by the Portuguese company Plux WirelessBiosignals SA, under the brands bioPLUX (figure 2.1) and bioPLUX Chest Strap (figure 2.10).
They consist in two different configurations of wearable sensors capable of measuring different
types of biosignals and make them accessible through a Bluetooth connection.
The next chapter is intended to understand how these devices operate. The aim is to allow
the hardware integration by creating a software, which enables the signal acquisition from thesedevices.

1.5

State of Art

The number of people suffering from Dementia is estimated to rise from 35.5 million people
worldwide (∼ 55% cases of AD [1]) to around 65.7 million in the next 20 years, thus grossly
increasing the healthcare needs. To help this emerging needs, there have been developments ofmonitoring systems to soften the impact in patients and caregivers lifestyle. This section aims
to introduce some works that have been conducted concerning this area.
Falls is one of the most usual consequences of dementia patients affected by disorientation.
In 2006, M. Alwan, P. Rajendran and their colleagues proposed a smart and passive floorvibration method for fall detection for elderly. They developed a piezosensor-based systemthat records floor vibration patterns. The system was tested with anthropomorphic dummies.
The results were a 100% of accurately detected falls with no false alarms. This system has theadvantage of not requiring the subject to wear or activate the device. Nevertheless, the detection
is confined to a restricted area. The method has been deployed in real world residential [7].

12

1.5. STATE OF ART

Still in fall detection area, since 2006 researchers from United Kingdom are working on a"smart carpet" to detect fall incidents. The concept is to use pressure sensors connected to acomputer. The idea is to detect changes in weight distribution reporting them to the system.
The implementation has some drawbacks as people with dementia have difficulties walking on
carpets, which are needed to protect the sensors. The project is currently in evaluation withreal-world setting planned [8, 9].
Urinary incontinence is a common problem in dementia. In fact, more than 50% of people
suffering from dementia have this problem, which can be severe. In 2006, P.Yap and D.Tan
proposed a practical approach for urinary incontinence in dementia patients. The method isbased on a moisture sensor attached to adult diapers. The sensor sends an alarm via wirelesstransmitter, that the diaper needs to be changed, and can be uploaded to the internet to send toselected individuals. The sensor is not disposable, so it will have to be adapted to general use,
as Institutions use disposable adult diapers. It is currently being tested in two nursing homes.
Another different approach in monitoring dementia patients is concerning the home monitoring. In 2007, M. Rowe, S. Lane and C. Phipps proposed a development of a home monitoring
system, CareWatch designed for use in homes of people with cognitive impairment as AD. The
aim is to prevent unwanted exits, specially at night as it can be considerable danger to AD patients. The CareWatch consists of a security system control panel, wireless receiver and sensor
to detect door motion and bed occupation. The system evaluations were done so far in 27 homes
with other 28 in the control test. The system has operated for more than 200 months without
many failures. There was no unattended exits during the night in instrumented homes reported,but the comparison with control population has not yet been published [10].
Audiovisual surveillance has been another area where several researchers have been investigating. In 2008, D. Chen, H. Wactlar and their colleagues proposed an automatic algorithm
capable of recognizing human behaviours from video records using local binary motion. The
aim is to develop a system that can automatically detect aberrations or abnormal patterns ofactivity. The system can already recognize activities as sitting, walking, standing, and passing
in hallways. The success rate is high, however there are still some false positives. The study
has been tested on 15 subjects with AD in a nursing home [11].
Another method for automatic video monitoring has been proposed in 2012 by R. Rodhane,
E. Mulin and their colleagues. The article presents 3 clinical cases. The study was conducted in
13CHAPTER 1. INTRODUCTIONa special room equipped with usual everyday objects for normal activities. The aim was to get
the subjects to do their normal daily activities inside the room. The 3 cases were direct, semidirect and free activities. The assessment was completed with an automatic video monitoring
system composed of a vision component and an event recognition component. Two AD patientswere tested along with one elder control subject. The study results showed AD patients havemore difficulty in completing the suggested tasks [12].
In 2013, the Alzheimer’s Association presented a product to monitor the location of a AD
patient. A person with AD wears or carries a locator device, such as a phone and as he travels
around, it communicates with the Comfort Zone application. The caregivers can setup thesecure zone for the loved one and when the patient leaves these zones an alarmed is triggered.
Family members can access this information either by internet or calling the monitoring centre
[13].

14

Chapter 2
Integration of a Wearable Biosignals
Acquisition System
An hardware integration is the process of bringing together, in this case, the wearble system andthe computer, and make them function as one system. In this case it will enable the acquisitionof biosignals reading from the person to the computer, using the sensors. There are some points
to analyse during an hardware integration, which are the essential four queries in hardware
integration,• what device is employed,• what are its capabilities,• how to communicate with it,• how will it send the data from the acquisition to the storing device [14].
This chapter describes the development of the communication support for connecting two
different types of wearable sensors with a Linux-based platform.

15

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

2.1

Description of Used Wearable Sensors

2.1.1

bioPLUX device

The bioPLUX device (2.1) is an innovative wearable system for the acquisition of biosignals. It
can be seen as a Analog to Digital Converter (ADC) whose values is accessible via a Bluetoothconnection. It has 8 analog ports that can be simultaneously sample from 36 to 1000 Hz using
either 8 or 12 bit resolutions. It should be noted both the sampling frequency and resolution
once selected are the same for all active channels.

Figure 2.1: bioPLUX device [15].
As already stated, all the communications with the device, for selecting operation modes,
starting and stopping the signal(s) acquisition, and for receiving the converted values are performed via Bluetooth 2.0.
The remaining of this chapter will present the communication protocol, the different types of
sensors available for this work, and a chest strap variant of this device with fixed configuration.
The implementation of an acquisition application for linux-based systems is presented followed by the analysis of its capabilities and those of these devices. Finally a set of recommendations were elaborated to send to the Plux company.

16

2.1. DESCRIPTION OF USED WEARABLE SENSORS

Communication Protocol
The transmission protocol allows the communication of the bioPlux device and an host, such asa smartphone or a computer. It basically consists in two opposite information flow directions,commands in string type from the host to the device and data from the bioPlux to the host.
The string commands sent from the host to the device have two forms, depending on the
purpose. To start out the acquisition, a complex command is required, specifying some input
parameters. This string takes the shape of ’@START,FFFF,CC,BB’,• FFFF is the intended sampling frequency in Hertz (Hz), represented with a four digit
integer. It can range from 36 Hz (0036) and 1000 Hz (1000);• CC is a bit-mask to pick which analog channels will be sampled, represented by twohexadecimal digits. This parameter represents one byte, where each bit corresponds toone of the eight channels. The Most Significant Bit (MSB) refers to channel 8 and Least
Significant Bit (LSB) refers to channel 1. To activate a channel sampling one must givethe correspondent bit the value 1. For instance to sample channels 3, 5 and 8, the binary
string would be,10010100 (binary) = 94 (hexadecimal).
So the CC would be the string ’59’.
• BB is the sample resolution, which means the number of bits per channel in the sample.
It is delineated as two decimal digits. The possible options are ’08’ for 8-bit and ’12’ for
12-bit [16].
For instance, let’s imagine an acquisition of the channels 3, 5, 8 as above, at 100 Hz andusing 12-bit resolution. The corresponding string is ’@START,0100,59,12;’.
The data package arrangement along with a more extensive explanation of the protocol isprovided in appendix A.

17

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

Sensors available for this work
A set of three different sensors were used, one for each specific biological signals, Electrodermal
Activity (EDA), Electrocardiography (ECG). Body movements are tracked with accelerometers, as stated in chapter 1. Every one of them is to be explored within the next sections [15].
The connection between the device and its sensor is made through 4 pins, illustrated infigure 2.2. It has a directional junction which assures the correct connection.

Figure 2.2: Connection of the sensor to the main device [15].

Accelerometer
This sensor is especially developed for biomedical applications wherever motion measurements are involved. This sensor can measure accelerations relative to free fall, being capable ofdetecting magnitude and direction of the same acceleration, as a vector quantity. The calculated
force can be processed so as to detect for instance position, vibration or shock.
xyzPlux triaxial accelerometer can be integrated relatively simple due to its tiny size. The
sensor is represented in figure 2.3.

Figure 2.3: xyzPlux Triaxial Accelerometer, [17].
The axes direction reference can be found in figure 2.4, where it is also explained the orderof the connectors. The separated three available analog ports allow the employment as uniaxial,
biaxial or triaxial applications with the same sensor.
18

2.1. DESCRIPTION OF USED WEARABLE SENSORS

Figure 2.4: Accelerometer axes reference, adapted from [17].
It is able to measure in a range of from -3 to 3 G-force (g) [17].
Calibration Procedure The aim of this procedure is to convert the output values of theacquisition into G-force values.
In the first step, the accelerometer is connected as suggested in basic mode (described in
section 2.3.1), taking into account the figure 2.4, beginning an acquisition.
Then, a slow roll movement as illustrated in figure 2.5 is performed, which should at least
admit 180o [17].

Figure 2.5: Roll movement, adjusted from [17]Following the same pattern, a pitch movement as shown in figure 2.6 must be made as well
per at least 180o .

Figure 2.6: Pitch movement, adapted from [17].
The purpose of these movements is to align the x and y axes with the gravity vector. An
excerpt of the file from the session is exhibited in figure 2.7.

19

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

Figure 2.7: Excerpt of the acquisition file.
Electrocardiography Every time there is a heart beat, there are electrical changes generated
from the variation of the action potentials. EcgPlux low-noise triodes were specially created torecord and amplify these tiny changes caused by the heart muscle cycle in every heart beat [18].
The figure 2.8 represents the EcgPlux triode.

Figure 2.8: EcgPlux triode sensor, adapted from [18]This sensor is set to acquire in a range from 0.5 to 100 Hz, which in this kind of exam isquite enough. The obtained values come in an interval from 0 to 3 Volts. The conversion fromoriginal digital values to voltage is done by a factor scale depending on the acquisition mode,
8-bit or 12-bit.
Electrodermal Activity EdaPlux is a sensor able to measure Electrodermal Activity withhigh sensitivity calculation.
The sensor is represented in figure 2.9.
The EdaPlux acquires all sensed signals with a voltage range between 0 and 3 Volts.

202.1. DESCRIPTION OF USED WEARABLE SENSORS

Figure 2.9: EdaPlux sensor, adjusted from [19].

bioPLUX Chest Strap
The bioPLUX Chest Strap is a variation of the bioPLUX device with predefined configuration.
In this device, it is not possible to choose the sensor in each channel. The preconfigured sensors
are a triaxial accelerometer (first three channels), a sensor of respiratory volume (channel 4), an
ECG sensor (channel 5) and finally a thermometer (channel 6). It is represented in figures 2.10.

(a) Front.

(b) Back.

Figure 2.10: bioPLUX Chest Strap, front (a) and back (b)The acquisition protocol is the same as utilized in the bioPLUX system which makes theintegration quite equal. The collected values vary from 0 to 3 Volts (V) in the ECG. This
protocol is explained in section 2.1.1.

21

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

2.2

BluetoothIn this section we introduce some of the Bluetooth concepts. As the major part of the network
programmers are already familiar with TCP/IP protocols, one can always explain Bluetoothessential in terms of their similarities and variations. Although Bluetooth is different from
Ethernet and TCP/IP protocol, it appears reasonable to associate the same principles in each
communication types. These principles rely on one device interchanging data with anotherdevice, in this case a bioPLUX device or a bioPLUX Chest Strap with a computer.
The process can be truncated in several successive goals,• Select the device with whom to communicate,• Discovering a way to exchange data with it,• Make an outgoing connection,• Receiving an incoming connection,• Exchanging information.
Each of these phases will be analysed in a simple approach, which makes one perceive how
the computer can interact with the bioPLUX hardware. This section solely enlightens on how
the Bluetooth works, while the section 2.1.1 explains the actual case for these hardware [14].

2.2.1

Choice of the device to communicate with

A Bluetooth device is primarily identified by its distinctive address. As the nature of the address
is identical to the MAC address of Ethernet, it is also commonly called as Bluetooth MAC
address. Every Bluetooth chip ever made is identified with an unique 48-bit address. It is theforemost viable way to identify devices as it remains static for the lifespan of the hardware,
To communicate with a device it is mandatory to know or have a way to determine its
address. Typically a Bluetooth device has additionally a friendly device name, which identifies
it along with the address. This name does not have to be unique, serving only to simplify thechip’s identification. This label may lead to ambiguity. When a search for devices is performed,
several user-friendly names maybe found. There is no guaranty the devices found have totallydifferent labels, thus one has then to decide one from those [14].
222.2. BLUETOOTH

2.2.2

Choosing a transport protocol

Once the target device is known, it is time to choose how to communicate with it. This implies
selecting a transport protocol. Mainly, the protocol is chosen relying on the devices capabilities
and the application requirements. The context and the priorities of the data connection play a
crucial role in this choice.
Both Bluetooth and Internet programming can use a large number of various transport protocols. As an example, in TCP/IP most of the applications work with TCP or UDP, relying on
IP as the base transport. While TCP provides a connection-oriented process with reliable data
streams, UDP provides a wrapper of the IP which unfaithfully sends individual diagrams of
fixed size.
In Bluetooth, though the protocols are not simply equivalents to those cited above, it provides some protocols which may be employed in similar contexts.

RFCOMM
The RFCOMM protocol can be compared to TCP in terms of service security. As TCP, themost important characteristic in this protocol is to deliver an ordered secure connection. In
general, applications using these kind of protocols are concerned with having a point-to-pointconnection over which the streams of data are exchanged.
The biggest distinction between TCP and RFCOMM is the selection of the port number.
While TCP supports up to 65535 open ports on just one machine, RFCOMM only allows 30.
This may influence however the selection is formed for several applications [14].

L2CAP
UDP protocol is mainly used where reliable delivery of all the packages is not the most important aim. Typically, it is used to avoid the overhead incurred by TCP. Specifically, UDP ischosen for its best-effort and simple datagram semantics. L2CAP satisfies this as a communication protocol. This protocol is highly customizable in terms of assurance. There are threescheme policies an application can use,
• Never retransmit,
23

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM• Retransmit until success or total connection failure, which is the default one,
• Drop a package after attempting to retransmit during 0-1279 milliseconds, moving to thenext one.
In terms of port numbers, while UDP has up to 65535 open ports on a single machine,
L2CAP applications can use ports of odd numbers from 1 to 32765 [14].

2.2.3Communication using sockets

Once the device is chosen along with the communication protocol and port number, it becomes
essentially the same type of programming network, which is by using sockets.
The socket programming follows some steps since the creation of the socket until it is placedin listen mode to receive data from the bioPLUX devices. The flow is indicated below,• The primary step is to allocate a socket, specifying which Bluetooth adapter and port
number to use, employing socket() function,• In the second step, the socket is connected to the server, with the address chosen, using
connect() function,• The last step is to send and receive data to and from the socket, applying send() and recv()
functions [14].

2.3Integration Software

In order to acquire information from the bioPLUX devices, an application was created to makethis process easier to anyone who has no expertise in programming languages or Bluetooth.
This application is designed to create an user-friendly interface the easiest to use as attainable,
dividing it into sections.
This desktop application was created in two different major independent components, onethat actually is meant to record the data from the person in the experiment and another to easilyload and display a previously saved file from a prior session.

24

2.3. INTEGRATION SOFTWARE

Although the method of this work does not require a software that sophisticated, it seems
reasonable to think in a broader way. This software has the potential to be used in future projects
or even by any person exploring the bioPLUX device.
This application is created using C++ language programming utilizing GUI programming
software Qt. Qt is a C++ framework for programming cross-platform GUI applications. Combining a high performance programming language with a cross-platform "write once, compile
anywhere" permits the software to be compiled nor solely in Linux operating system, but in several others. This is one of the reasons for the choice of this combination [20]. The Qt version
used is the 4:4.8.3. The Qwt pack of widgets is additionally used in version 6.0.0-1.2. BlueZ
is the Bluetooth Stack utilized in this work in the Bluetooth programming, on linux-based platform, in Ubuntu 12.10 distribution. The version used is the 4.101.
As stated in section 2.2 the integration and connection via Bluetooth is performed by socket
communication using RFCOMM protocol.

2.3.1

Acquisition Application

The acquisition application allows the user to choose which options are to be applied in each of
the sampling moments. This interface is based on an intuitive tab widgets design which present
the most relevant windows on top, depending on the phase of the acquirement.
The initial start-up window is presented in figure 2.11. The original resolution of the window
is 1280 x 720, which can be expanded up to 1920 x 1080 pixels. In the maximization of thewindow, the area 1 expands proportionally, while the header image only in one direction (xaxis). The areas 2 to 6 maintain their normal length, only distributing proportionally throughthe window.

25

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

26

Figure 2.11: Starting window of the acquisition software.

2.3. INTEGRATION SOFTWARE

Basically, this window, has an header image within the top of the window containing thename of the institutions involved in the project and can be divided in 6 different areas labeled
in figure 2.11,
1. The principal component of the window, where the channel labeling and selection isshown in non-acquisition mode. In acquisition mode this area is destined to the real-time
signal plots, which will be represented later (QTabWidget).
The basic mode of channel configuration is the simplest of the three available. It has
predefined places and simple sensor names associated with their function, as for instanceElectrocardiogram for EcgPlux sensor.
The tab containing the advanced configuration mode is divided into two categories. In thefirst default class, the user can opt for which channels are to be connected to each sensor,
selecting them from the list in the drop-down menus (QComboBox). This is depicted infigure 2.12

Figure 2.12: Default mode in advanced channels selection.
This allows the selection of the EDA sensor in the channel 7, which is originally designed
to be in channel 6 in basic mode. The advanced mode conjointly lets the user have two
or more identical sensors coupled at the same time. Another advantage is regarding the27

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

use of the triaxial accelerometer sensor. One can use here only one or two of its axes
accelerations.
Checking the custom radio button (QRadioButton), changes to the personalized advanced
selection. This enables the custom labelling of the sensors, giving the user total freedom
to choose the channel name. The figure 2.13 illustrates this option.

Figure 2.13: Custom mode in advanced channels selection.
As an example, one can always name the identical selection as in figure 2.12 by just x, y,z and eda.
2. A very important part of the acquisition session involves the selection of the sampling
frequency and resolution. In non-sampling mode this group (QGroupBox) allows theuser to settle on these two variables. In acquisition mode it changes to a set of options tomanage the scales of the axes in the plots, which are readjusted in real time. It additionallydisplays a chronometer with the elapsed time of the session. The figure 2.14 represents
the acquisition mode of this group.
In the drop-down, the user can change which plot is rescaled individually.
3. This area is destined to the connection of a bioPLUX device. There is a button to search
for a device unindexed in the corresponding text file. This feature will be dealt later.
28

2.3. INTEGRATION SOFTWARE

Figure 2.14: Settings group in acquisition mode.
A text area displays the information about the connection errors or the connected device
identification. There is a drop-down menu containing the indexed devices identified by
the user defined labels. The current selection can then be connected by the connect button.
4. This is a similar group, only designed to attach a bioPLUX Chest Strap. It is composedby a drop-down menu with the indexed bands in file, a button to connect the selected one
and a distinct area to display whether or not the connection was successful.
5. This space contains a button which opens the save dialog window, which will be mentioned later. The save option in only allowed once a session is stopped.
6. Finally, this button can serve as three different options depending on the actual mode. It
is used to start, stop or restart the program.
Whenever a connection to a device is made, bioPLUX or bioPLUX Chest Strap, thebutton is turns to a blue colour. This signalizes the button is enabled and the sampling
can begin.
During the acquisition mode, its text changes to STOP ACQUISITION, thus it is used tostop the sampling mode.
Once the acquisition is stopped it changes once again, but this time to RESTART ACQUISITION. Pushing the button now will restart the software.
This can be represented as a cycle, as figure 2.15.
The application functionalities can be briefly portrayed in a flow diagram, dividing it into
five different elements, in figure 2.16.
29

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

Figure 2.15: Mode cycle of the application.

30

Figure 2.16: Global flowchart of the application.

2.3. INTEGRATION SOFTWARE

Previous Settings
Before the application main window pops up, it is necessary to assemble some parameters. An
additional datagram of this phase is illustrated in figure 2.17.

Figure 2.17: Previous settings, the first phase of the application.
By now, both devices (devices_dev.txt) and bands text file (devices_b.txt) are opened andcheck for antecedently indexed hardware.
The type format of the identification is the same for both situations and follows a pattern.
Every indexed device is written in one line, having the address preceding the label, separated
by a space. Here is an example,
00:07:80:4C:0E:EE bioplux
00:07:80:4B:2C:A3 biopluxipn.
where two devices are indexed.
Each one of the indexed devices, from the files, is allocated in the corresponding database,31

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

bioPLUX or bioPLUX Chest Strap, while its label is inserted in the correct drop-down menus.
When an user selects an hardware by its label, the system checks for the corresponding addressin the database.
If the application is not started for the first time, but rather a restart, there is a settings ini file.
The instance of QSettings takes care of reading the settings from it [20]. In these case a device
or a band id may well be specified, or perhaps both. These ids correspond to the connected
devices in the previous session, which are automatically reconnected.
The application dialog window shows up concluding this part.

Acquisition SettingsOnce the program starts, a window like the figure 2.11 shows up. Before an acquisition can takeplace, it is necessary to configure some simple options.
A more elaborate version of this part can be conferred in figure 2.18.

Figure 2.18: Flowchart illustrating the work flow between the start of the program and the
beginning of the acquisition process.

32

2.3. INTEGRATION SOFTWARE

The channel selection is a simple task. A basic mode, the first displayed, suggests a standard
configuration, as in figure 2.11. Images of the sensors make the recognition an easy assignment
even for a totally beginner person.
Once one clicks in the advanced tab, it is presented with a more sophisticated set of choices.
As explained in section 2.3.1, in figures 2.12 and 2.13, one can choose two modes of advanced
channel selection. One with default labels, the technical nomenclature of the sensors, and thesecond as the user wishes. This names will identify the title of the channel acquisition plots, aswell as the save file.
The next step is to settle the sampling frequency. This measure is characterized as the inverseof a sample period. This implies if the user chooses 100 Hz, the process will get one hundred
samples per second. A QSpinBox assures the value introduced is within the valid interval [20].
The 8-bit or 12-bit resolution is chosen in the same sense, by simple navigating in the dropdown menu. The default value is 8-bit. This will affect automatically the plots scales, as the yaxis ranges from 0 to 255 for a 8-bit resolution, whereas the second ranges from 0 to 4095.
To make the acquisition begin, one solely needs to connect one in every of the supported
devices. If a bioPLUX Chest Strap is linked, the application is ready to go.
Once a device is connected, the start button is enabled. If a bioPLUX device is linked but
no channels are selected, it will produce an error, refusing the application to continue. Thismessage will rely on which tab of channel labelling is on top. The error dialog windows arepresented in figures 2.19.
The simplest way to attach a device is through the drop-down menu, followed by clicking
the connect button. This is also applied to bioPLUX Chest Strap. If one wants to connect a
new device, there is a search mode. Once it is activated, the program will look for devices with’bioplux’ in their name. Every time a device is found, it compares it with all the indexed ones.
Being this a new discovery the following menu will pop up, figure 2.20
The address from the found device is presented so the user can confirm it. If it does notcorrespond, the program will keep searching. Supposing it is the correct one, the user is asked
to label the new hardware, which is automatically connected and added to the database.
On the other hand, if one device found is already in the database, an information alert isdisplayed as the figure 2.21.
One can always add a new device directly in the text document, requiring then the applica33

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

(a)

(b)

(c)

Figure 2.19: Error dialog windows in case no channel is selected, once a bioPLUX device isconnected. There are three different cases, one in basic mode (a), one in advanced default mode(b) and eventually in advanced custom mode (c).

Figure 2.20: Pop up window once a new device is discovered.

Figure 2.21: Pop up window informing the device found is already indexed.
tion to be restarted to reload the database.
This concludes the preparation for the acquirement session.

34

2.3. INTEGRATION SOFTWARE

Preparation of Acquisition Environment
Preparing the sampling atmosphere is one of the most important parts. At this moment, theapplication checks all the selected options.
A representation of this specific part can be found in figure 2.22, which is a more complete
diagram from the third part of figure 2.16.

Figure 2.22: Preparation of the acquisition environment.
In fact, the beginning of this phase can be confused with the end tip of the previous. If noneof the device varieties is coupled and no channels are selected, the application cannot continue
returning to the second part. This is exactly what the dashed line implies.
Once this inspection is validated, the value from the frequency is checked. The resolution
mode is also verified, which will adapt the scale from plots, indicated in section 2.3.1, and the
package size disposition of every channel data, as stated in appendix A.
At this point, the program creates the temporary files for the devices online, with file names
temp_dev.txt for bioPLUX devices and temp_b.txt to bioPLUX Chest Strap. Here, a particular
header is written which will identify the document as a viable bioPLUX file. The header style
will be further discussed in section 2.3.1.
35

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEMAt this stage, all the tabs, correspondent to the future sampled channels, are created. The
settings tab to settle on frequency and resolution is disabled, whereas the options to manage
axes scales are enabled and placed on top view.
The start string command is written in the socket or sockets of the connected devices. It
is important to note, having the two types of devices linked, the only section different is thechannel configuration, as the band only uses one.
Starting independent threads, using QThread class and Worker from Qt, for the connected
devices acquirement, is the last step of the preparation. This will prevent the program fromcrashing [20].

Acquisition
The is the principal part of the program, sampling signal. At this point the user can see theinformation gathered from the patient is real time. It confers him the possibility of hiding
channels, stretching axes, moving the data lines with individual slider for each channel, or evenpausing the session.
A flowchart can represent this part, in figure 2.23.

36

2.3. INTEGRATION SOFTWARE

Figure 2.23: Work flow during the sampling process.
As soon as the sampling command starts, the timer begins the counting. This merely provides an idea about the elapsed time of the session.
An example of the acquisition environment is presented in figure 2.24. In this particular
example the accelerometer is connected in basic mode (channels 2, 3 and 4) conjugated with abioPLUX Chest Strap to sample ECG. The sample frequency is 100 Hz in 12-bit resolution.
As the separated threads of acquirement are perpetually attempting to read from the sockets,a mechanism will ask them for new data constantly. In case of new data, using the signals/slots
from Qt, the thread emits a signal, with the new info within the message [20]. This data isprocessed and a replot event is called, refreshing all the plots.

37

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

38

Figure 2.24: Acquisition cycle.

2.3. INTEGRATION SOFTWARE

As stated above, there is some options within the right top corner to manage the axes scales.
This allows the user to enlarge or shorten the range of data in the plot. One has to take inconsideration the restrictions of these operations. The x axis permits the visualization of 10
seconds of sampling in default mode. This can be expanded up to 30 seconds. The y axis
features a restriction in the minimum range, depending on the resolution. In case one reaches
these boundaries, the program emits an error window as the figure 2.25.

Figure 2.25: Example of error in y axis.
It is possible to hide a specific channel visualization in the ALL tab, simply by unchecking
the correspondent check box (QCheckBox) [20]. Having the figure 2.24 as example, hiding x
and y axis of the accelerometer will make the other plots expand as in figure 2.26.

Figure 2.26: Selective choice of channels display.
Selecting an individual tab will present only the corresponding plot, as in figure 2.27, for
the ECG signal.
39

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

Figure 2.27: ECG signal from its individual tab.
The figures 2.28 and 2.29 represent another acquisition, during this case, with advanced
custom labelling. The channels follow the configuration from figure 2.13.

Figure 2.28: Acquisition example in advanced custom mode, using an accelerometer, an EDA
sensor and a bioPLUX Chest Strap to acquire ECG signal.
Hitting the stop button concludes the sampling mode, carrying the application to the follow40

2.3. INTEGRATION SOFTWARE

Figure 2.29: EDA signal from its individual tab.
ing final phase.

Data Saving and Restart of Application
Once the application is ceased, the save option is enabled, allowing the user to save the recorded
session. The time counter stops. The diagram in figure 2.30 illustrates the final section of the
program, also portrayed in an oversimplified form in figure 2.16, as the last part.

41

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

Figure 2.30: Last part of the application
One of the noticeable changes within the interface is the deactivation of the pause and resume buttons, as they are no longer needed. Once the acquisition is stopped, there is no possibility of resuming it. The change can be noted in figure 2.31, correspondent of illustration 2.14
in recording mode.

Figure 2.31: Options in non-sampling mode.
However, sliders and axes scale options can still be modified. The only restriction is thetime length available. The user can solely see the last 30 seconds of the acquisition.

42

2.3. INTEGRATION SOFTWARE

Saving the Session
In this part, the user can save the recording data, in a document with some special headerlines. To save the information, one simply clicks the button with the floppy disk drawn. A
dialog window pops up. The user selects then the location and the file name. The path can be
typed within the edit box, or picked up by the open button.
The program automatically acknowledges if the path does or does not exist, which is resumed in figures 2.32 and 2.33.

Figure 2.32: Success saving the file.

Figure 2.33: Error saving file.
In fact, this saving method is simply a rename and move process of the temporary file createdupon acquisition time. The program presently supports solely the text file format.
The chosen file name is used to generate the final names of the documents, by adding asuffix depending on their source. The bioPLUX device file gets a _dev.txt suffix, whereas to the
bioPLUX Chest Strap file _band.txt is added.
43

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

The header lines of the files in devices and bands, are nearly similar, aside from the channel
identification. Examples of the begin of every one are presented in figures 2.34a and 2.34b
respectively.

(a) bioPLUX device save file.

(b) bioPLUX Chest Strap save file.

Figure 2.34: Example of save files.
In the file from the band, there are five header lines including the identification line, thehardware Bluetooth address, the hardware label, the sampling frequency, the resolution and atlast the date of the acquisition. Within the device file, there are two extra lines indicating thechannel selection mode and the chosen channels.
Every line starts with the # character, followed by an characteristic string. Having in consideration its order,• #checkfile - This line identifies the file as a valid bioPLUX file. The biopluxdatafile
string identifies a bioPLUX device document and biopluxdatafilecb a bioPLUX Chest
Strap.
• #address - The Bluetooth address of the correspondent hardware.
• #label - User defined label of the matching device.
• #mode - Labelling mode in channel selection. It can be basic in basic mode, advancedd
in advanced default mode or advancedc in advanced custom mode. This field is present
solely in bioPLUX device files.
• #channels - This line in influenced by the previous.
– In basic mode, the channels are identified by a name followed by a logical number,which shows the linked sensors.
44

2.3. INTEGRATION SOFTWARE#channels ecg0 z1 y1 z1 eda0 temp0
In this case, only the accelerometer was sampled.
– In advanced default mode, the channels are recognized only by its index in the corresponding drop-down menu. As an example, the selection from illustration 2.12
can be written,#channels 0 4 5 6 0 0 2 0
as the drop-down choices are,0. none,1. ecgPlux,
2. edaPlux,
3. tempPlux,
4. xyzPlux (x axis),
5. xyzPlux (y axis),
6. xyzPlux (z axis).
– Finally, in advanced custom mode, the application simply saves the label chosen by
the user, writing none in those not used.
#channels none x y z none none eda none
• #frequency - Sampling frequency of the acquisition.
• #bits - Resolution of the acquirement. It can ether be 8 or 12.
• #date - Date when the acquisition took place.
The sampling values are separated by commas, preceded by the counter number from 0 to
127.

45

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

Exiting or Restarting
Once the program has stopped, the user is not obliged to save the data. One can merely exit
the program or restart it.
Restarting the program will restore the connection of previously linked hardware. To do so,
it saves the state of connections, keeping the address of the actual linked devices within the ini
file.

2.3.2

Player Application

After a session is recorded, the data can be saved in a specific file, as stated in section 2.3.1. Thisis the input file for the second part of the software package. The player application is meant toallow the visualization of a previously sampled sessions.
The interface follows an identical pattern as the acquisition part. It is also based on an
intuitive tab widgets style. The initial dialog window is illustrated in figure 2.35.

46

47

2.3. INTEGRATION SOFTWARE

Figure 2.35: Initial window of the display application.

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEMAs the acquisition interface, this window, including the header image, can be divided into 5
individual areas, showed in figure 2.35,
1. The main component of the window, where, as in acquisition application, the channel
selection takes place and the tabs from plotted data are displayed.
2. The area where the settings of the recorded session are displayed. Here, the user can see
the identifications of the used devices, sampling options (frequency and resolution) andthe date of the recorded session.
3. This group of buttons permits the manipulation of the axes scale, while visualizing thedata. They work similarly to the case of the acquisition application.
4. Opening the data file allows the necessary inspection of the saved file. The button within
this area, opens a file dialog to pick the saved data file.
5. Once the user has opened the saved record, loading the information into the plots is possible by clicking the load button.
The applications functionalities are summarized in a diagram, as presented in figure 2.36.

Figure 2.36: Global flowchart of the display program.
48

2.3. INTEGRATION SOFTWARE

Basically, the application can be divided into two distinct parts, such as before and after
loading the save data file. Once the user selects the file to be loaded, the program checks, line
by line, the header information, fulfilling the settings (area 2) once at a time. The figure 2.38
represents the program state if the process reaches success. If by chance, one of the lines is not
successfully interpreted, an error window pops up as in figure 2.37, alerting which part caused
it.

Figure 2.37: Example of error window, opening saved data file.

49

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

50

Figure 2.38: Display application window after a successful loading.

2.3. INTEGRATION SOFTWARE

In this example, the bioPLUX Chest Strap was not used. It is important to state once there
are two data files (in case of both types of hardware used), the program looks for the correspondent data file. For instance, by selecting the test_dev.txt file, the application will automaticallyalso attempt to open a test_band.txt file.
After the validation, the process is good to go, and one can see in the example the priormode utilized in the acquisition was the advanced default mode, with the channels 2, 3 and 4 tothe accelerometer and the channel 7 to the EDA. The program will automatically place the tabof used channels mode on top. Now, there is the possibility to deselect unwanted channels. It is
not wise to choose additional previously unsampled channels as the correspondent plot will be
empty.
Once the selection of channels is complete, hitting the load button will bring the data to theplots and place its tabs on top. The figure 2.39 represents the data loaded into the plots.
The load button becomes then the stop button, used to make a new session available.

Figure 2.39: Data loaded into the corresponding plots.
Apart from the vertical slider, also present in the acquisition application, there is a horizontal
slider to allow the user to navigate through the time line of the session. There are no limits instretching the axes.
To load a different session, one simply has to click the stop button and open another data51

CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

record.

2.4

Used wearable sensors analysis

It is now possible to analyse the wearable sensors used in this work. This is done in terms of
their capabilities and limitations.

2.4.1

bioPLUX

The device works via Bluetooth, freeing it from having cables directly connected to the destination hardware. In fact, this is one of the foremost features when it involves observation of amoving person in real-time. The system is compact, simple and easily placed in a subject.
One issue which could have determined whether or not to use this kind of equipment, was its
autonomy. A continuous real-time acquisition requires a battery which may handle an extended
period of time, acquiring data. A test was performed in this system, proving it will. Throughout
the test, the system was set to acquire from all the channels, using the 12 bit mode of resolution,
at a 100 Hz sampling rate. The result was a non-stop acquisition during 14.14 hours. Acquiring
only from the seven needed channels in the method the battery could be extended to 14.36
hours.

Accelerometer
Research applications and studies of body dynamic and biomechanic analysis are the perfectcontext candidates to use triaxial accelerometers.
This is a powerful sensor, as it can measure accelerations relative to free fall, being capableof detecting magnitude and direction of the same acceleration, as a vector quantity. The calculated force can be processed to detect for instance position, vibration or shock. It is able tomeasure in a range of from -3 to 3 G-force, being enough to support this project.

52

2.4. USED WEARABLE SENSORS ANALYSISElectrocardiography
Although it is indicated daily activities monitoring, it did not perform quite well in those conditions. This sensor has a drawback, which compromises the research and invalidates its use. It
is terribly prone to motion artefacts, thus as the research involves evaluating a AD patient in his
daily routine, one should explore another an alternative. This is included in section 2.5, wherea set of recommendations is suggested to the Plux manufacturer.

Electrodermal Activity
This low-noise system is capable of detecting even the most feeble Electrodermal Activity skin
events, due to its amplification circuit. As explained in section 3.1.2, EDA is characterized asa modification in the skin potential, associated with sweat glands, activated by a stimuli. Thissensor can then be used to detect changes in cognitive, emotional and sensory states of a person,
which are extremely significant in detecting Psychomotor agitation.

bioPLUX Chest Strap
The use of the Chest Strap band comes as a propose to replace the EcgPlux triode. As stated in
the beginning of this section, the triode is highly sensible to motion artefacts, thus a different
more robust approach using the chest strap is mandatory.
The bioPLUX Chest Strap has the advantage of being adjustable to the body of the subject.
This will prevent mainly the electrodes to suffer from the motion of the patients. Apart from
this, there is a new drawback, which even not compromising the process may well be corrected.
The band length is not optimized to thin people, creating troublesome to hold it properly. This
will be included within the recommendations to the manufacturer.
As in the first device used, this chest strap band can solely be considerate usable if the autonomy is large enough to the requirements. To prove it, once again, a test was performed.
Likewise before, the system began to acquire from all its channels, set to 12 bit mode of resolution, at a 100 Hz sampling rate. The result was an extended period of acquisition during 19.43
hours. Acquiring only from one channel, the ECG channel, the battery life was able to last for21.14 hours.

53CHAPTER 2. INTEGRATION OF A WEARABLE BIOSIGNALS ACQUISITION SYSTEM

2.5

Recommendations to bioPLUX Manufacturer

There are some recommendations which will be suggested to the Plux devices manufacturer.
In first place, one crucial feature suggested is the introduction of an alarm in the system to be
triggered just in case of low battery charge. This allows the caregiver to know when to charge thedevice and avoids stopping the monitoring, which occurs without any knowledge now. In thisproject this was not crucial as the acquisition process never overtakes 10 minutes per session,
however taking in consideration a future daily elderly monitoring, it becomes critical.
When thinking about a daily monitoring, it is clear the battery life of the device must be
enough to permit long periods of time of acquisition. This was tested and therefore the results
were sufficient. One can always think in improving it, for example by implementing a smart
Bluetooth protocol which would boost the battery life, being the device connected as long asnecessary. This is also needed to create an integration software with mobile platforms, forinstance in iOS, as the iPhone is not compatible with the current version of Bluetooth used by
bioPLUX devices. The integration of GPS signal may also be useful to automatically report
detected abnormal behaviours to caregivers, even if only outdoors.
Another helpful option to be added is an automatic recognition of the sensor connected in
the system. At this moment one can simply connect an EDA sensor and tell the system it is an
ECG. A method which can acknowledge which one is connected would simplify the procedure
to caregivers. The implantation of a distinct impedance for each sensor could easily identify
them.
As it is stated in previous section, the ECG triode sensor cannot handle motion acquisitions,
therefore a recommendation would go towards enlarging the size of the electrodes and the area
in contact with the skin. This would minimize the effect of motion artefacts.
Regarding the bioPLUX Chest Strap, the length is not enough when it comes specially toa female thin person. An evaluation shows that even thought it can be used in this individuals,
it is not stable, as illustrated in figures 2.40. A longer hook-and-loop fastener should solve thematter.

54

2.5. RECOMMENDATIONS TO BIOPLUX MANUFACTURER(b) View from the side.
(a) View from the back.

Figure 2.40: Example of Chest Strap band in a thin female subject.

55

Chapter 3
Data Acquisition Procedure
After having the software ready to acquire signal from the subjects, it is necessary to determine
what procedure it to be implemented in this methodology. The set of material and the placement
location takes in consideration the goal of the study, the detection Alzheimer’s Disease (AD)related behaviours, namely Psychomotor agitation.
To this study, as stated in the introductory part, there were used bioPLUX among with its
sensors (EDA sensor and accelerometers) and bioPLUX Chest Strap (ECG channel). Before any
further steps, it is important to understand how will these systems and sensors be able to detect
Psychomotor agitation. A summarized introduction of Electrocardiography and Electrodermal
Activity is presented next followed by the actual acquisition procedure from this study.

3.1

Theoretical Background

3.1.1

Electrocardiography

Electrocardiography is an exam in cardiac medicine area which registers the potential variations
generated by heart activity. This exam is a vital part of cardiovascular evaluation. It is an
essential tool in diagnosing and monitoring several heart conditions like cardiac arrhythmias.
The cardiac muscle contraction and relaxation triggers depolarization and subsequent repolarization of the myocardial cells. These electrical changes can be registered via electrodes inan electrocardiogram. The electrodes are usually placed in limb and chest.
The sinoatrial node initiates the impulse through the cardiac conduction system, repre-

57

CHAPTER 3. DATA ACQUISITION PROCEDURE

sented in yellow colour in figure 3.1. It is then propagated through bundles into three different
branches. After a delay in the atrioventricular node, the atrial contraction takes place followed
by a fast ventricular contraction characterized by the coordination of the ventricles.

Figure 3.1: Representation of the heart conduction systems, also known as the His-Pukinje
conduction system [21].
As we are measuring potential variations, the activity detected within the electrocardiogramis measured in voltage.
The maximum amplitude of the waveform detected, in any lead (represented in figure 3.4)
may be influenced by the myocardial mass, the dimensions of the tissues involved and the position of electrodes. For example, patients with ventricular hypertrophy are most likely to produce
a waveform with higher amplitude, whereas people’s waveform with obesity is probably lower.
An example is presented in figure 3.2 [21].
A normal waveform is represented in figure 3.3. It is composed by a P wave, a QRS complex, a T wave, and a U wave. The last one is not visible in the major part of the cases due tothe final of the T wave and the upcoming of the new P wave.
The figure 3.4 represents the pericordial leads. Unlike limb leads which measure electricalactivity within the vertical plane, pericordial leads quantify the activity in the horizontal plane.
V1 and V2 are nearest to the right ventricle while V5 and V6 are closest to the left ventricle.
The remaining are in the interventricular space.
58

3.1. THEORETICAL BACKGROUND

Figure 3.2: Influence of disorders in amplitude of ECG waveform. Low amplitude belongs toan obese woman, while the high amplitude waveform is from a hypertensive man [21].

Figure 3.3: Normal waveform of ECG, [22].
The direction of the deflection on the electrocardiogram represents the voltage movement
towards or away from the lead. As the left ventricle is the largest and strongest one, the amplitude of the R peak depends on the direction of the electrical pulse to this ventricle. In lead V1
the depolarisation is mostly in the opposite direction while in the lead V6 is mostly towards its
direction [21].
The heart rate can be calculated just by counting the number of R-peaks in an interval of
60 seconds. In situations of mental or physical stress, the heart rate tends to increase. The
monitoring of these variations can help determine Psychomotor agitation in AD patients.

59

CHAPTER 3. DATA ACQUISITION PROCEDURE

Figure 3.4: Arrangement of the six chest electrodes for the 12 lead electrocardiography [23].

3.1.2Electrodermal Activity

Electrodermal Activity, additionally known as Galvanic Skin Response (GSR), measures electrical skin conductance which varies with moisture level of sweat glands. These are controlled
by the sympathetic nervous system, which affects EDA when it is active, specially when aperson is anxious [24].
This measure can indicate the extent of physiological arousal, providing a measurable feature to judge a person’s internal state. It is straightforward to measure, with good repeatability,
capturing the automatic nerve response.
Physically, GSR can be defined as a change of the electrical features of the skin in response
to a different stimuli, measuring potential variations from the surface of the skin. In fact, any
stimuli capable of arousal effect depend more of the surprise than the strength of the signal[25, 26].
An example of EDA signal can be seen in figure 4.18.
The wave is commonly biphasic or triphasic, lasting several seconds between different stimuli. The waveshape is commonly alike intra-subject. There is an important fact in the surprisefactor. Amplitudes tend to lower and latencies to increase when the surprise indicator becomes
weakened. Apart from this, waveshape remains almost unaltered.

60

3.2. RULES TO CONSIDER A SUBJECT APT TO THE EXPERIMENT

Application in Clinical Diagnosis
EDA is currently used in several applications in clinical diagnosis,• Giving the biofeedback (know what is happening within the body and brain),– Assists in treatment of phobias and anxiety.
– Helps in relaxation of subjects in Hypnoses.
• Combined with Heart Rate (HR) Variability,– Evaluates changes in autonomic nervous system of patients following myocardial
infraction as the increased sympathetic activity can cause ventricular arrhythmia.
– Acts as a marker in determining fatal ventricular arrhythmia, in case of reduced HR
Variability and EDA.
– Helps in determination of personality and signature patterns to monitor changes inheart condition [25].
Using this measure, it is expected to assess the internal state of the AD patient and thus
determining if the subject is going through a Psychomotor agitation state.

3.2

Rules to Consider a subject apt to the experiment

Unfortunately it was not possible to test on real patients, which is scheduled to the early October
this year. The method was tested in healthy people which were requested to simulate an AD
alike Psychomotor agitation symptoms.
To consider a candidate apt for the experiment, there are some conditions to be respected,
so some drop-out restrictions listed below are considered,• The subject must not have known abnormal heart conditions, which might bias the heart
rate results.
• The candidate must not have any motor deficits, which might compromise his ability to
move.

61

CHAPTER 3. DATA ACQUISITION PROCEDURE

From a subset of 21 subject, one is considered unfit, due to his motor skills handicap. The
total drop-out proportion is 4.76%. The considered apt group is composed by 12 males and 8
females subjects, 60% and 40% from the total 20 people, respectively.
As regards to age of the group, the average age is 22.77 years old with a standard deviationof 2.46.

3.3

Placement and procedure using the wearable sensors

3.3.1

Accelerometers

As stated in section 1.4, one of the sensors is placed in centre of mass, near the lower back,whereas the other in the right knee. To make it easier setting them in the person’s body, one
accelerometer is fixed to a metal clip and the other to a hook-and-loop fastener.
The first one allows global tracking of the person’s movement, while the one in the knee
assesses how the patient walks.
The figures 3.5a and 3.5b show the two accelerometers utilized in the experiment.

(a) Centre of mass accelerometer.
(b) Knee accelerometer

Figure 3.5: Accelerometers used to track body movements.
The position of the centre of mass accelerometer can be found in figures 3.6a and 3.6b.
The knee accelerometer position is represented in figure 3.7.
62

3.3. PLACEMENT AND PROCEDURE USING THE WEARABLE SENSORS(a) Rear view.
(b) Lateral view.

Figure 3.6: Position of centre of mass accelerometer.

Figure 3.7: Position of knee accelerometer.

3.3.2

Electrodermal Activity

The EDA sensor is placed in the left hand of the subject. Before one can put the electrodes, twoelectrode snaps are placed as in figure 3.8a. The yellow coloured point matches the ring finger,
while the other is put in the forefinger as indicated in figure 3.8b. The hook-and-loop fastener
mounted around the wrist prevents the sensor string from affecting the readings.

63

CHAPTER 3. DATA ACQUISITION PROCEDURE(a) Electrode snaps placement.

(b) Electrodes locations.

Figure 3.8: Position of the EDA sensor.

3.3.3

Channel Configuration

The channels numbers chosen during this procedure follow the figure 3.9. The illustration 3.10
shows all the sensors connected to the main system.

Figure 3.9: Arrangement of sensor through the channels, adapted from [15].
The nomenclature used to distinguish the sensors follows this pattern,
643.3. PLACEMENT AND PROCEDURE USING THE WEARABLE SENSORSXCM Signal from x axis of the accelerometer in the center of mass;
YCM Signal from y axis of the accelerometer in the center of mass;
ZCM Signal from z axis of the accelerometer in the center of mass;
XKN Signal from x axis of the accelerometer in the knee;
YKN Signal from y axis of the accelerometer in the knee;
ZKN Signal from z axis of the accelerometer in the knee;
EDA Signal from Electrodermal Activity;
ECG Signal from Electrocardiography.
Finally, the device can be fixed as in figure 3.11.

Figure 3.10: System prepared to be used inacquisition.

3.3.4

Figure 3.11: Pinning the device.

bioPLUX Chest Strap

The bioPLUX Chest Strap used to sample ECG signal, described in figures 2.10, needs particular attention upon usage. The electrodes surface need a special gel to permit a reliable signal
collection, minimizing signal artefacts. An example is presented in figure 3.12.
To turn the device on, a button on its top needs to be pressed. This can be seen in figure
2.10a. The proper position of this device can be found in illustration 3.13.
65

CHAPTER 3. DATA ACQUISITION PROCEDURE

Figure 3.12: Placing conductive gel in theband electrodes surface

3.3.5

Figure 3.13: Chest Strap Band correct position.

Experimental Procedure

As it was not possible to test the method in real AD patients timely, it was decided to ask
healthy people to simulate Psychomotor agitation symptom of AD. The experiment is split inthree different parts,• In the first part, the subject is asked to sit down and relax for about 2 minutes. Here, there
are solely two sensors connected, the ECG and the EDA. This part serves to calculate thebaselines of the person.
• Secondly, now already with the accelerometers attached, the individual is requested towalk in a normal state throughout around ten minutes. The subject is suggested to climb
or go down stars whenever he wants during the course. The person can choose the routeduring the experiment. This is considered the control phase, which is assumed as a traditional non-agitation state.
• Finally, the last part of the procedure intends to simulate Psychomotor agitation as inan AD person’s crisis. This part has roughly the same duration as the control instance.
Before the subject starts the simulation, he is prompted to do fifteen squats. This will help
his physiological internal state to become more active, helping a better pretence. At thispoint, the person is ready to the ten minute procedure.
Here the person is asked to simulate an agitated AD patient, including pacing around66

3.3. PLACEMENT AND PROCEDURE USING THE WEARABLE SENSORS

the same place, agitation and disorientation with restless and repetitive movement. [4, 6].
The subject can choose its own route throughout the course has before, being the main
requests equivalent.

67Chapter 4
Detection of Alzheimer’s Disease-Related
Behaviours
This chapter presents the methodology to detect AD-related behaviours, namely psychomotor
agitation in the acquired data in the previous phase. A classification model is implemented todetect such behaviour. The separation of the data is done as non-stress class (normal behaviour)and stress class (abnormal behaviour, namely psychomotor agitation).
The chapter starts to define what is a classification model and how it works. Posteriorly
the used classifiers are presented and explained. It is also defined how the results are evaluated.
The necessary steps to successfully complete the classification process are then described, sincefeature extraction until the final classification of the instances class.

4.1

Classification

The classification process can be defined as the search for a model which can, using someconditions, separate different classes of data. It basically intends to make decisions, on whether
or not an object belongs to some group. This is a task performed by every living being in its
necessity to deal with surrounding environment [27, 28].
To create a classification model, it takes observations and features from an experiment. Eachobservation whose category is to be classified has a feature vector which is an n-dimensional
vector of features. A feature is an attribute that can summarize and characterize the data fromthe observation.
69

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURSThe classifiers consists on two steps, training and validation. The learning data, which has
known class label, is used to train the classification model. The validation data has unknowncategory label and is used to assess the discriminative power of the model.
In terms of this study, the method is assessed to see if the aim can be achieved, using theavailable tools to interpret the acquired signals. The chapter describes all the procedures used
to create a reliable and useful classifier for use in a live application.

4.1.1

Classifiers

A classifier can be defined as an algorithm that implements classification. It indicates whether
or not an observation is a member of a certain class, constructing a rule. This rule is then used
to correctly classify future samples with unknown class label [29].
An example of a simple classification
model is illustrated in figure 4.1, where eachclass, w1 and w2 , are represented by a vector of features x = [x1 x2 ]0 . The correspondent classifier can be represented as a simple
straight line, which divides the upper half (+)
from the lower half (-) of data. This is an example of successful linear separation. Mostof the times this is not that simple.
In this work, a set of five classifiers were

Figure 4.1: Example of two classes of data
implemented and tested. These classifiers are described by two-dimensional feature vectors[27].
Naive Bayes, K Nearest-Neighbors, Decision
Tree, Support Vector Machines (SVM) and
Discriminant Analysis (DA).
The classifiers use a sliding-window to divide the information in individual instances represented in figure 4.2. The size of the window is set to 30 seconds. This type of window has
the advantage of having always the more actual information. A wide range of time per instanceallows a very broad reading.
The channels names adopted are explained in section 3.3.3 also mentioned in figure 3.9.
The next sections explain each one of the five classifiers principle.
704.1. CLASSIFICATION

Figure 4.2: Sliding-window process.

Naive Bayes
The Naive Bayes method is simple to construct as it does not need complicated iterative parameters, being very accessible to unskilled users. It may not be the best classifier in a very specific
type of data, but it can undoubtedly be adapted to a very large range of situations. [28, 30].
Having two classes of data, the aim of this classifier is to construct a score range, using
training data (labelled observations). Smaller scores correspond to one class, while bigger
belong to the other class. Classification is then performed with a threshold t.
To demonstrate the concept of Naive Bayes Classification, we can consider the example infigure 4.3, with two classes green (g) and red (r).

Figure 4.3: Example of data distributed in a 2-dimensional space, [31].

71CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS

Now assuming x is the vector of features of an the new unclassified observation, represented in figure 4.4, P (i|x) is defined as the probability of the x belonging to class i. The ratio
P (g|x)/P (r|x) can be considered as a suitable score system. Decomposing P (i|x), one can get
the prior probability of the class i, without any further knowledge P (i), which is proportional tof (x|i)P (i). The function f (x|i) represents the conditional distribution of x for class i objects.
The ratio becomes the equation 4.1,
P (g|x)f (x|g)P (g)=P (r|x)f (x|r)P (r)(4.1)

Figure 4.4: Representation of the new point to be classified.
To produce the classification it is needed to estimate f (x|i) and P (i). The last one can be
estimated from the proportion of the class i objects from the training set. f (x|i) is estimatedassuming x are independent, calculating each univariate feature individually, summing its likelihood. The equation 4.1 can be then rewritten,
Qpp
P (g|x)P (g) Y f (xj |g)
j=1 f (xj |g)P (g)= Qp=
P (r|x)
P (r) j=1 f (xj |r)
j=1 f (xj |r)P (r)(4.2)

where p is the number of features, in this case two. As the aim is only to produce a score, analternative is to rewrite the equation 4.2,p
P (g|x)P (g) X f (xj |g)
ln
= ln
+
ln
P (r|x)
P (r) j=1
f (xj |r)so this classifier has a simple construction [29].

72

(4.3)

4.1. CLASSIFICATIONK Nearest-Neighbors
The K Nearest-Neighbors method finds a group of k observations, which are closest to the test
object, basing the classification in the predominant class in its neighbours. This implies a choiceof a similarity distance. In a multivariate domain an euclidean distance is the most simple andappropriate.
Having D, the training set of k objects, and test object T = (x0 , y 0 ), being x0 the featuresfrom T and y 0 its label class, the process starts by computing the distance between T and every
object (x, y)  D.
Secondly, one selects DT ⊆ D, the set of k closest training observations to T . Using as
example the illustration 4.5, we have 2 classes (+) and (-), with 5 neighbours selected to classify
the new observation in red.

Figure 4.5: Representation of the new point to be classified using KNN classification method,[32].
Once the list of closest neighbours is known, the new observation is classified based on the
majority classes from neighbours, using the equation 4.4,
y 0 = argmaxvX

I(v = yi )(4.4)

(xi ,yi )  DT

where v is a class label, yi the class label from the ith neighbour, and finally I the function
which returns the class label [29].
In this particular case, the point would be classified as belonging to the minus (-) class.

73

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS

Decision Tree
Decision Trees are among the most used models in classification. To generate one, the main
step is to choose which attribute is to be tested in each node that may separate better the classes.
It creates a decision tree with binary splits and it is usually constructed top-down, which means
starting from the whole set of variables and choosing always first the one that best splits theclasses.
To select the rule of the separation in the node, the Gini Index (equation 4.5) is used. It
measures the impurity of the partition, meaning how often a randomly chosen element would
be incorrectly labelled, taking into account the proportion of labels of the subset.
The aim is to find the test that minimizes the weighted sum of the class impurities of eachbranch. In practice, one first determines the best test for each attribute, and them the best
attribute among the best tests [33].
The Gini Index is defined as,

G(n) = 1 −

k
X
n2
i=1

i
N2

where, n = (n1 , . . . , nk ) represents the number of examples in each class, and N =

(4.5)
P

i ni

is the total examples at a given node.
Decision trees are easy to understand and interpret. It is a robust method which almost
does not require data preparation, like normalization, performing well with large datasets. The
problem of over-fitting can occur, solved reducing the size of the tree, by removing less discriminative sections [34].

Support Vector Machines
Support Vector Machines is one of the most used machine learning method. It offers one of themust robust and accurate procedure for classification being resistant to over-fitting.
Having two classes, the goal is to find the best function which can separate the objects
from the different classes of the training data. Imagining a linearly separable data, the function
corresponds to the hyperplane f (xn ), which passes in the middle of the classes. To classify new
data, yn , one needs to test the sign of the function, meaning yn belongs to the positive class if

74

4.1. CLASSIFICATIONf (yn ) > 0.
Having the figure 4.6 as an example, the line between green and red points represents thefunction that separates the classes.

Figure 4.6: Representation of the function that separates the two classes represented in the
figure (green and red), [35].
The method tries to maximize the margin between different class observations, searching forthe best hyperplane. Geometrically, this margin can be defined as the shortest distance between
the closest data points to a point on the hyperplane. The geometric metric allows the choice ofthe best hyperplanes, which can be solution to SVM. Having the best margin allows the best
possible generalization, both to the training data but most important, to future observations.
To ensure the maximum margin hyperplanes is found, the SVM classifier tries to maximize~ and b,the function 4.6, with respect to w
t
t
X
X
1
LP = k~wk −αi yi (~
w.~xi + b) +
αi
2
i=1
i=1

(4.6)

where t is the number of training examples, and i = 1, . . . , t, are non-negative numbers, when
the derivatives of LP in αi equal to zero. The variables αi are the Lagrange multipliers and LP~ and the constant b define the hyperplane [28, 29].
is denoted as the Lagrangian. The vectors w
The process in figure 4.7 represents the result of the SVM classifier.

75

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS

Figure 4.7: result of the SVM classifier separation of the classes, [35].

Discriminant Analysis
DA is a method, firstly introduced by R. Fisher, known as the linear discriminant analysis,
widely used in classification. It assumes G populations as multivariate normal distributions
P
with common covariance matrix(p × p) and distinct mean vectors µg (p × 1), being g thenumber of populations G.
The first step is to randomly select a sample size n (xn ) from these populations, knowing
the label of each. So, for example from x1,1 to x1,n1 , it corresponds to observations from the
population 1. Under multivariate normal assumptions, the aim is to find the population thatmaximizes the likelihood of the observations to be tested, as shown in equation 4.7,

xg,i  population (eg = argmin(xg,i − µg0 )T
g0X−1(xg,i − µg0 ))(4.7)

Let πg be the part of the population g such as the sum from π1 till πG is equal to 1. So
now, instead of maximizing the likelihood, the posterior probability that the object belongs to aparticular group is maximized, represented in equation 4.8,




X−1
1
T
xg,i  population ge = argmin (xg,i − µg0 )(xg,i − µg0 ) − log πg0 )
2
g0

(4.8)

Knowing its linearity is derived from the assumption of common covariance matrix, it canbe simplified as in equation 4.9,xg,i  population (eg = argmax dg0 (xg,i ))
g0

76

(4.9)

4.1. CLASSIFICATION

where dg (x) = xT

P−1

As both µg andPµg − 12 µTg

P−1µg + log πg is the discriminant function.

are unknown, an estimation is made based on the maximum likelihoodof this parameters,µˆg (x) = x̄g = n1g

Pngi=1 xg,i ,Pˆ = 1 (X − X̂)(X − X̂)T ,nwhere X , p × n, corresponds to the observations, and X̄ its mean vector. Therefore, the sample
version discriminant function used in linear discrimination analysis is represented in equation
4.10 [36],
X−1
1 X
ˆ −1
T ˆ
ˆ
x̄g − x̄gdg (x) = xx̄g + log πg0
2

4.1.2

(4.10)

Feature Extraction

A feature can be defined as an attribute which best summarizes the data of the observations.
Each observation will be now characterized by its vector of features instead of the all data.
Feature extraction is one of the most important parts in classification, as it defines what information is used to create the model. The extraction must follow a path in which the calculated
feature vectors are what most differentiates the classes of activities.
The next sections will address the feature extraction for one of the three sensors used. All
the signals are rescaled by a common factor being it 3/255 to an acquisition in 8-bit mode and3/4095 to the 12-bit mode, so that the data is converted to voltage units, from 0 to 3 Volts.

Accelerometer
The accelerometer is used to track the movement of the patient, in terms of accelerations. The
feature extraction from the accelerometer data is processed in tree steps,• Conversion from the digital values to units of acceleration (g).
• Removal of the gravitational acceleration.
• Computation of three angles variations (from the three axes accelerations) and calculationof the area under its frequency domain, in determined frequency intervals.

77

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS

Calculation of G-force from Digital Values
To fully interpret the signal from the accelerometer, it must be converted from digital values
into a more appropriate scale, like units of acceleration, using the equations 4.11 and 4.12 [17].
This procedure is done separately for each axis,xi =maxxi + minxi
2(4.11)

xi − xi
maxxi − xI

(4.12)

xo =where xi is the input signal, xo is the output signal in g, while maxxi and minxi can be estimatedfollowing the calibration procedure in 2.1.1.
Removal of the Gravity Acceleration
To assure the analysed values used are not compromised by the influence of the gravitational
acceleration, a filtering with a single pole low-pass is performed to isolate the gravity vector, as
in equations 4.13 and 4.15 [37],α=t(t + dT )(4.13)

where t represents the time constant, s, and dT the event delivery rate, which at a sampling rateequal to 100 Hz is 0.01 s.
This can be rewritten using the values,

α=1≈ 0.99(1 + 0.01)(4.14)The gravitational acceleration can be then isolated,~g (1) = signal(1)~g (n) = α × ~g (n − 1) + (1 − α) × signal(n)~l(n) = signal(n) − ~g (n)(4.15)

where ~g is the gravitational acceleration and ~l is the newly calculated linear acceleration.
78

4.1. CLASSIFICATION

After the isolation, the calculated acceleration is removed from the original signal.
Calculation of angle variations and area under the frequency domain
Each one of the accelerometer axis has its own acceleration value. The accelerometer inthe centre of the mass tracks the general movement of the body, while the one in the knee isintended to show the walking pattern.
The axes system can be found in figure 4.8, according to the orientation of the accelerometer.

Figure 4.8: Orientation of the axes, adapted from [38].
Using the acceleration values it is possible to compute three angle variations, ∆α, ∆θ and∆β, which can show the body variation angle in the three principal planes respectively, illustrated in figure 4.9a. The rotation of the knee, as an example, is shown in figure 4.9b.
These three angle variations are represented in figure 4.10, depending on the accelerometer.
These angle variations can be calculated using Pythagorean theorem, being the accelerations
the cathetus of the right-angled triangle. As the angle range is the only measure needed, theorientation of the angle is not important, so the absolute value is used. The equation 4.16
shows, for example, how alpha variation is calculated.

79

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS(b) Rotation in the knee, [40](a) Principal body planes, adapted from [39].

Figure 4.9: Illustration of the movement planes.

(a) Centre of mass.

(b) Knee

Figure 4.10: Illustration of the angles.

∆α = arctan|g~z ||g~y |

(4.16)As the only measure used from the accelerations are variations and not actually angles, theprocess is simplified. To compute the actual angles it is necessary to create a transformation
matrix of the axes. The great advantage of using the variations is that after the variation of theangle, the final axes position becomes the initial to the next range.
804.1. CLASSIFICATIONThe key to extract information from this measures it to see if there is some characteristicchange from non-stress to stress. A better and simplified look of the problem can be seen at themagnitude of the frequency domain instead of the temporal domain.
The magnitude (obtained by Fast Fourier Transform (FFT)) of the angle variation data canbe calculated by equation 4.17, [41, 42].
∞

1 X
Φa,∠ (w) = √fa,∠ e−iwn
2π −∞

2

∗
Fa,∠ (w) Fa,∠
(w)
=
2π

(4.17)

where w is the angular frequency, Fa,∠ (w) is the continuous Fourier transform of fa,∠ and∗Fa,∠(w) denotes its complex conjugate.

The a and ∠ variables in equation can be defined as,a  {centre of mass, knee}∠  {∆α, ∆β, ∆θ}To extracted the feature values, it is calculated the area under magnitude of the FFT for alimited interval of frequencies. This is done for each of the pre-defined intervals, for each of
the accelerometers data, using equation 4.18.
Z wf
Aa,∠ =

Φa,∠ (w) dw(4.18)

wi

Taking into account 1 Hz = 2π rad, for example from 1 to 1.8 Hz, the integration is froms1
to 1.8
rad/s.
2π
2πElectrocardiography
The ECG signal is first pre-processed to remove noise. As in the experiment people are notstanding still, any motion concerning the area around the electrodes in contact with the skin
may produces noise.
As the goal is to detect Heart Rate variations, calculating the R-peaks, a passband filter isimplemented to remove the noise. A combination of a high-pass filter with cut-off frequency of
10 Hz to remove the baseline and straighten the signal, and a low-pass filter (to remove noisy
high frequencies) with cut-off frequency of 25 Hz are implemented [43].

81CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURSThe high-pass and low-pass filters were implemented through a recursive single pole filter,as equation 4.19 [37].

y[n] = a0 × x[n] + a1 × x[n − 1] + a2 × x[n − 2] + . . .
· · · + b1 × y[n − 1] + b2 × y[n − 2] + . . .

(4.19)

Having only one pole, there is simply two a and one b coefficients to the high-pass filter,
while to the low-pass only one of each is used.
These coefficients can be calculated using equations 4.20 to high-pass filter and equations
4.21 to low-pass filter.

a0 = (1 − α)/2
a1 = −(1 − α)/2
b1 = α(4.20)

a0 = 1 − αb1 = α(4.21)The term α from equations 4.20 and 4.21 is associated with the cut-off frequency chosen
and can be calculated by,

α = e2πfc /Fs(4.22)

being fc the cut-off frequency and Fs the sampling frequency.
A threshold is then applied to isolate the peaks, with the value greater 0.4 from the normalized signal.
The last step to detect R-peaks from the ECG signal is to ensure false peaks, which could
not be eliminated, are discarded now.
82

4.1. CLASSIFICATION

The maximum HR an individual can achieve without causing severe damage to his heart canbe calculated by the equation 4.23.

HRmax = 220 − age(4.23)

Assuming Heart Rate can not rise above 198 bpm for a person with a minimum of 22 years
old, the minimum peak separation must be at least 0.30(30) seconds. [21]The final feature value corresponds to the value of HR in beats per minute (bpm) minus thebaseline calculated in the same form from the 2 minutes rest procedure.

Electrodermal Activity
The Electrodermal Activity is known to be a slowly changing signal. To remove noise related tohigh frequencies, a low-pass is implemented as in equations 4.19 and 4.21 in previous section.
The cut-off frequency applied is 0.5 Hz.
After the filtering of the EDA signal, the mean value of the interval is extracted as a feature.
There is another feature which can be useful in the classification process. Only the mean of
the window does not tell if the variation was rather abrupt or smooth, or even if there was any
variation. A new measure is needed. The best one to infer this is the standard deviation. This
will tell how close or disperse the values from all over the window are.
A baseline is calculated in the same form (from the two minute procedure explained in
section 3.3.5) and the final feature is equal to the initial one subtracted by the baseline of theperson.

4.1.3

Outlier Detection

Outliers can be defined as patterns in data which do not follow a normal expected behaviour.
This depends obviously from the input data.There are three types of outliers, which can beclassified according to their context in the whole data.
Type 1 Individual outlying instance;
Type 2 Individual occurrence in a specific context;
Type 3 Subset of outlying data with respect to the entire data.
83

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURSIn this case, the targeted type is the first one.
As the class labels are available, it’s reasonable to go through a supervised method.
A N-Neighbours based approach was taken in consideration, where data is analysed relying
on data points nearest neighbours. The computed distance has to take into account the type andnumber of features. In a multivariate domain an euclidean distance, represented in equation
4.24, is the most simple and appropriate [44]. This method has a drawback as the thresholddistance d from the instance to its nearest neighbours has to be chosen.
qd (r, s) = (xr − xs ) (xr − xs )0(4.24)The xr and xs variables are the rth and sth points in the data set, respectively [45].
Accordingly, it seems reasonable to search for a more robust method, as for example aStatistical approach [44].
The modified Thompson tau technique is a statistical method to help deciding whether todiscard or not an instance of acquisition. It assesses the outliers of each class, one feature vector
at a time.
Being the x the sample mean and S the standard deviation, for n data points, the absolutevalue of the deviation is calculated by the equation 4.25.

δi = |di | = |xi − x|(4.25)The point with the maximum value of δ is the most suspicious point to be considered an
outlier.
The value of the modified Thompson tau can be calculated using the critical value of theStudent’s t test, by the equation 4.26,
tα/2 (n − 1)τ=√ qn n − 2 + t2α/2(4.26)

where tα/2 is the critical Student’s t value, using α = 0, 05 and freedom degrees equal to n − 2.
To determine whether to classify as outlier or not the point’s instance, a simple rule is used.
If δi > τ S, the point is considered an outlier.
On the other hand, if δi ≤ τ S, it is kept.

84

4.1. CLASSIFICATION

The modified Thompson tau method only considers one suspected data point at a time, so
the process is repeated from the beginning until no more outliers are detected.
To reject the complete instance, more than 50 % of the instance feature vector has to beconsidered an outlier [46, 47].

4.1.4

Significant Feature Selection

After the outlier extraction, it becomes important to assess the quality of the extracted featuresdescribed in section 4.1.2. A good feature selection process will not only increase the correctclassification rate of the classifier, but also reduce the computational complexity of the process.
The selection aims to choose a smaller subset of featured from all the initial which can welldiscriminate the non-stress from stress class [45, 48, 49].
The first step of the feature selection is a correlation filter to be applied so that redundantfeatures, which do not give new discriminative power to the method, are eliminated. Selecting
two features which are highly correlated, meaning almost duplicates, will not help the classification model, even if they are highly discriminative. To make sure the selection is made ascorrectly as possible it’s important to apply a correlation filter. This filter, depending on thethreshold, leaves out highly correlations.
Feature selection methods can be essentially divided in three main groups, Filter, Wrapper
and Embedded methods. Filter methods create a ranking in which every features is ranked
according to some univariate metric. It treats every feature separately and its own capabilityof discrimination among classes. Wrapper algorithms basically search for the best subset offeatures, combining different subsets until the best combination is found, relying on some scoreor error. In order to do so, they must interact with the classifier. It’s possible to think asinteracting with a black box, so any classifier can be combined with this type of selection.
Embedded methods also test a sub-assembly of features at a time, but it is directed to a specificclassifier, so it can take advantage of the classifier properties [45].
It is important to state that all the feature selection methods to be implemented and tested
are supervised methods, taking advantage of the known labelled classes.
The next section explains how a each one of the three feature selection methods, Filter,
Wrapper and Embedded are applied.

85

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURSFilter Methods
Filter methods asses each feature individually. These univariate scores are very simple to calculate, having the advantage of short runtime. As they analyse features independently from eachother, multivariate dependences must be dealt with an additional filter, like with the correlation
stated above. There are a large number of filter methods, so it is not clear which one is the best.
They basically work in two steps. First, each variable is tested separately to calculate its
score or error according to some different algorithm. In the second part, in many cases a threshold is set, so if there’s a error ranking, the features below the threshold are chosen. On the other
hand, if the ranking in made by scores, the variables above the threshold are selected [45].
The algorithms chosen which are tested are the Wilcoxon Rank Sum (Wilcoxon) as called
as Mann Whitney Test, the Area Under the ROC Curve (AUC) and the Fisher’s Score (FS).
In this case, a different approach is taken. There is no threshold in which the feature isclassified as good or bad. Taking into account all the features, a cycle of n − 1 tests is made,being n the total number of features. In the first test the classification uses a subset only thetwo best features of each filter method, and in each sequent test, the next feature is added tothe subset. The best aggregation of variables is then analysed taking into account its Accuracy(ACC) and Sensibility (SS) results.
Wilcoxon Rank Sum
The Wilcoxon test is a non-parametric method, known to be an alternative to the usual
Student’s t test. As it does not assume any known distribution upon data, it is only based in
the order in which the instances from the two classes belong. This makes it more robust having
high resistance to outliers [50, 51].
In the first step, a ranking is created, starting from the smallest to the biggest value of thefeature in analysis.
For more than 20 observations the test follows a z-distribution.
The next step is to make a sum of the ranks from the smallest value, using equation 4.27,

Wj =

j
X
n=1

where Rj is the ranking in observation j.
86

Rj(4.27)

4.1. CLASSIFICATION

Now, the calculation of the mean W and its standard deviation in equations 4.28a and 4.28b,ns (ns + nl + 1)
W = µw =2r
ns nl (ns + nl + 1)σw =12

(4.28a)(4.28b)where ns and nl are the length of the smallest and larger samples respectively.
The z-value is calculated by the equation 4.29.

z=

W − µw
σw(4.29)The p-value is then found in the z-distribution table.
Area Under the ROC Curve
The ROC curve is a very popular way of relating true positive with false positive rates
constructing a classification model. Its plot displays the discriminant Accuracy of the model[52].
In specific, the Area Under the ROC Curve has been proven as a good metric in feature
discrimination, as it is considered the larger the AUC, the better the classification performs.
For a perfect classification, the area is one, while for a non-informative one, it ranges around
0.5 [27, 48].
There are a few ways to calculate AUC. One of the methods is the FAST (Feature Assessment
by Sliding Thresholds), which varies the threshold on the class probability estimated in eachcase. This method calculates the AUC for each feature. In the original method, the AUC was
calculated by summing the area under the ROC curve, but this approach has proven not to bevery precise [53]. Alternatively, the Wilcoxon Rank Sum test is used. Using the measured
rankings, r1 , r2 , . . . , rnn , which are for the non-stress example, the AUC is calculated byequation 4.30,
Pnn
AU C =

i=1 (ri ) −nn ×(nn +1)
2

nn × ns(4.30)

where nn and ns denote the number of non-stress and stress instances respectively [48].

87CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS

Fisher’s Score
This method is one of the most used processes in feature selection. As it is a supervised
method, it takes advantage of the labelled classes, into mapping a lower dimensional space[27, 54].
The Fisher’s Score assesses the quality of each feature according to the distinction between
the two populations, in terms of difference of means normalized by the sum of their variances.
This can be calculated by the equation 4.31 [45],F (i) =(µn (i) − µs (i))2σn2 (i) + σs2 (i)(4.31)

Wrapper Methods
Wrapper methods search for a subset of features, which can provide the best classification. As
they treat all the features as a group and equal, there is a more interpreted search in the feature
set space, being remarkably universal and simple. Nevertheless, as a lot of subsets are tested,
the runtime increases, being much longer than a filter method for example. Anyway, it does nothave to start from the beginning, as filter, in every new feature. The addition of a new feature
requires internal cross-validation, which also lengthens the running time. In general, they canprovide very good results if the time is not an issue [45].
To test this type of selection, two methods were implemented, Forward and Backward selections, also called as Sequential forward and backward selection. The first one starts with anempty subset and in every iteration adds one more feature, until the classification is no longer
improved. The second one it’s the complete opposite. It starts with the whole set of variables
and removes one in each iteration until the process performance no longer increases. To validate
the subset, they slip data into train and test, about 1/7 to 1/3 [49, 55].
These methods have a big failure. The whole process depends on the order on which thefeatures are successively chosen. To overcame this problem, a cycle of one hundred iterations
is performed being that the feature order is shuffled every iteration. Its efficiency is then tested
in classification.

884.1. CLASSIFICATION

Embedded Methods
In these methods, features and their selections are turned to a specific classifier. In comparison
to wrapper methods, they make better use of the available data, as there is no need for dividing
information in train and test groups. The learning process is then less computationally and time
expensive. However, one may have a problem when identifying a small set of features [45, 55].
In this process, the method used was the Genetic Algorithm (GA) method with KNN classifier for classification. Firstly, a random subset of features is selected and its fitness scores aremeasured with consideration to the ratio between correctly and wrongly classified observations,using KNN method. This is called the first generation.
Each iteration evolves selecting a new subset of features, with consideration to its precedence. Only the best subsets are kept, in a final pool. Ultimately, one has to count how manytimes each feature appears in the final pool, giving it the measure of significance [56, 57].

4.1.5

Model Testing

To create and test the best accurate model, the algorithms from the feature selection, explained
in section 4.1.4, are evaluated each one at a time. The better results are the balance from the
Accuracy and Sensibility, as indicated in section 4.1.1.
First it is important to define Sensibility (SS), Specificity (SP) and Accuracy (ACC), explained in equations 4.1.5 [58].

TP(TP + FN)TNSP =(TN + FP)
(TN + TP)ACC =(TN + TP + FN + FP)
SS =(4.32)(4.33)(4.34)

where, True Positives (TP) and True Negatives (TN) represent the stress and non-stressobservations respectively, correctly classified. False Negatives (FN) are instances which belong
to stress class, classified as non-stress, while False Positives (FP) are samples labelled as stress,

89

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS

while pertaining to the non-stress group.
The result for the best one is analysed in terms of running time, Accuracy and Sensibility
rate. In this case, the most important is to detect correctly all the stress intervals, which reduces
the false negatives over the false positives. The Sensibility of the model becomes the main goal.
Instead of selecting the best Sensibility, the best combination between Sensibility and Accuracy
is chosen. The combination will prevent a high rate of false positive detections.

4.2

Implementation and Results

This section shows how the previously described methods are implemented in order to construct
the final classification model. The flowchart 4.11 summarizes the different sequential steps of
the work.
The first part of the implementation towards the detection of psychomotor agitation is regarding the feature extraction.

4.2.1

Feature Extraction

The feature extraction is divided in the separated extractions from the different sensors. The
first part includes de extraction from the accelerometer, followed by the ECG feature extraction,
concluding regarding the EDA sensor.
Accelerometer
The first step toward the features calculation is to convert the data from digital values tounits of acceleration g, using the equations 4.11 and 4.11.
After this step, the gravitational acceleration is removed from the axes accelerations so it
does not compromise the results.
The figure 4.12 shows an example of an acquisition before (4.12a) and after filtering (4.12b).
Using the filtered results of the acceleration, it is now possible to compute the three angle
variations refereed in section 4.1.2. Taking in consideration the figures 4.10 and the equation
4.16, the illustration 4.13 shows an example of the angle variations from the axes.
Using the equation 4.17 allows the transformation from the temporal domain to the frequency domain of the signals.
904.2. IMPLEMENTATION AND RESULTS

Figure 4.11: Flowchart Showing the implementation of the method.
Filtered signal to remove Acceleration due to gravity
2

1

1

Amplitude[g]Amplitude[g]Example of triaxial accelerometer acquisition
20x axisy axisz axis

−1
−2

0

0.5

1

1.5

2

2.5
Time[s]33.5(a) Original signal.

4

4.5

0
x axisy axisz axis

−1

5

−2

0

0.5

1

1.5

2

2.5
Time[s]

3

3.5

4

4.5

5

(b) Post-processed signal.

Figure 4.12: Acquisition before and after gravitational acceleration removal.
The figures from 4.14a to 4.14f illustrate the mean of the FFT magnitude from all the 20
people tested.
The figures 4.14 make it visible the difference between non-stress and stress. The window91

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS

Variations of the three angles
2

Amplitude[rad]

1.5
1
0.5
alpha angle
beta angle
theta angle

0
−0.5

0

0.5

1

1.5

2

2.5
Time[s]

3

3.5

4

4.5

5

Figure 4.13: Angle variation from the signal in illustrations 4.12.
is from 0.5 Hz to 5.5 Hz as it was where there were more disparity between the classes. The
window was divided into four suitable frequency band intervals.
The chosen frequency bands to the centre of mass accelerator, in Hz, are,F requency  {[1 − 1.8], [1.8 − 2.4], [2.4 − 3.7], [3.7 − 5.5]}
Chosen bands to the knee accelerator, in Hz, are,F requency  {[0.5 − 0.9], [0.9 − 1.55], [1.55 − 2.8], [2.8 − 5.5]}
The table 4.1 shows the feature names for example to the α variation. The β and θ featurenames are generated in the same way.
Table 4.1: Example of feature names to α angle variation.
Feature nameFrequency [Hz]cmband1alpha1-1.8

cmband2alpha1.8-2.4

cmband3alpha2.4-3.7

cmband4alpha3.7-5.5

knband1alpha0.5-0.9

knband2alpha0.9-1.55

knband3alpha1.55-2.8

knband4alpha2.8-5.5

In the end, there are 24 features from the two accelerometers.
92

4.2. IMPLEMENTATION AND RESULTS

Angle variation back/front in the center of mass

Angle variation back/front in the knee

0.04

0.03
non−stressstress0.035

non−stressstress0.025
Magnitude

Magnitude

0.03
0.025

0.02

0.02
0.015
0.015
0.01
0.5

1

1.5

2

2.5
3
3.5
Frequency [Hz]

4

4.5

5

0.01
0.5

5.5

1

1.5

2

2.5
3
3.5
Frequency [Hz]

4

4.5

5

5.5

(b) Alpha variation in the knee.

(a) Alpha variation in the centre of mass.
Angle variation left/right in the center of mass

Angle variation left/right in the knee

0.04

0.055
non−stressstress0.035

non−stressstress

0.05
0.045
0.04
Magnitude

Magnitude

0.03
0.025
0.02

0.035
0.03
0.025
0.02

0.015
0.015
0.01
0.5

1

1.5

2

2.5
3
3.5
Frequency [Hz]

4

4.5

5

0.01
0.5

5.5

(c) Beta variation in the centre of mass.

1

1.5

2

2.5
3
3.5
Frequency [Hz]

4

4.5

5

5.5

(d) Beta variation in the knee.
Angle variation rotation in the knee

Angle variation rotation in the center of mass
0.04

0.035
non−stressstressnon−stressstress

0.035

0.03

Magnitude

Magnitude

0.03
0.025

0.02

0.025
0.02

0.015

0.01
0.5

0.015

1

1.5

2

2.5
3
3.5
Frequency [Hz]

4

4.5

5

5.5

(e) Theta variation in the centre of mass.

0.01
0.5

1

1.5

2

2.5
3
3.5
Frequency [Hz]

4

4.5

5

5.5

(f) Theta variation in the knee.

Figure 4.14: Fast Fourier Transform of the variations of the angles
Electrocardiography
As it is stated in section 4.1.2 the ECG signal is processed (band-pass filtering) so we candetect R-peaks and calculate the person’s HR.
The figure 4.15 shows the original ECG signal, while the 4.16 illustrates the filtered normalized one.
A threshold is then applied to the normalized signal detecting the peaks above 0.4. The maximum HR is calculated based on the person’s age, in order to calculate the minimum separation

93

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURSRAW signal of ECG
1.65

Amplitude[V]

1.6

1.55

1.5

1.45

1.4

0

5

10

15

Time[s]Figure 4.15: Original signal of ECG.
ECG signal filtered with a band−pass from 10 to 25 Hz

Amplitude Normalized

1

0.5

0

−0.5

0

5

10

15

Time[s]Figure 4.16: Filtered signal of ECG.
of the R-peaks and eliminate duplicates (equation 4.23).
The resulting detection is presented in figure 4.17.
Representation of R−peaks

Amplitude Normalized

1

0.5

0
ECG
R−peaks
Threshold
−0.5

0

5

10

15

Time[s]Figure 4.17: R-peaks detection.
The algorithm was tested in 7 people, with an Accuracy of 0.9912, detecting 2823 correct
R-peaks from a total of 2848 occurrences.
A baseline is extracted in the same way (from the two minute procedure explained in section
944.2. IMPLEMENTATION AND RESULTS

3.3.5) and the final feature is equal to the initial one subtracted by the baseline of the person.
The feature is named as meanhr.
Electrodermal Activity
The pre-processing of the EDA signal is done with a low-pass filter as stated in section 4.1.2.
The figure 4.18 shows the original signal, while the illustration 4.19 the processed one.
Eample of electrodermal activity acquisition
0.5
0.49

Amplitude[V]

0.48
0.47
0.46
0.45
0.44
0.43

0

5

10

15
Time[s]

20

25

30

Figure 4.18: Original signal of EDA.
Filtered electrodermal activity acquisition
0.5
0.49

Amplitude[V]

0.48
0.47
0.46
0.45
0.44
0.43

0

5

10

15
Time[s]

20

25

30

Figure 4.19: Processed signal of EDA.
The feature calculation is based on the mean and standard deviation of the signal interval.
These calculated features are named as meaneda and stdeda.
After this feature extraction there are 27 features to help in the process of classification.
The next section explains how an instance can be considered an outlier.
95

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS

4.2.2

Outlier Detection

For a instance to be rejected, it must be an outlier for at least 50% of all the 27 features. Thismeans an instance labelled as outlier has more than 50% of its feature vector considered has
data which does not follow the expected pattern.
From the initial total of 1697 instances, 112 were considered as outliers, meaning a percentage of 6.6%.

4.2.3

Significant Feature Selection

The procedure of the feature selection is explained in section 4.1.4. The first step is to apply acorrelation filter in order to discard highly correlated features.
The table 4.2 shows the effect of the filter for different limits.
Table 4.2: Number of features below the threshold chosen.
Threshold

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0

Number of Features

27

27

26

21

13

8

6

3

3

2

2

According to the table 4.2, using a limit of 0.9 (best for our number of features), none of
the 27 features can be considered correlated, thus the correlation filter cannot be applied as an
approach in feature selection.
The following sections show the results from the feature selection in the different approaches
implemented.

Filter Methods
Wilcoxon Rank Sum
The figure 4.20 represents the p-values for each feature [47].
The numerical values are in the complete table in 4.3

96

4.2. IMPLEMENTATION AND RESULTS

Individual feature comparison in Wilcoxon test
meanhrstdedameanedaknband4thetaknband3thetaknband2thetaknband1thetaknband4beta
knband3beta
knband2beta
knband1beta
knband4alphaknband3alphaknband2alphaknband1alphacmband4theta
cmband3theta
cmband2theta
cmband1theta
cmband4beta
cmband3beta
cmband2beta
cmband1beta
cmband4alphacmband3alphacmband2alphacmband1alpha
0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5 0.55
P−value

0.6

0.65

0.7

0.75

0.8

0.85

0.9

0.95

1

Figure 4.20: P-values for each feature.
Area Under the ROC Curve
The final scores of each feature are represented in illustration 4.22.
The figure 4.21 shows an example for three purposely selected features with distinct discriminative power, one useless, one good, and one excellent feature.
The complete discriminated values can be found in table 4.3.
Fisher’s Score
The final scores of each feature are illustrated in figure 4.22.
The table 4.3 shows the complete analysis for filter methods.

97

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURSROC Curves
1
0.9

probability of detection(Sensitivity)

0.8
0.7
0.6
0.5
0.4
0.3
0.2
cmband3alphameanedameanhr

0.1
0

0

0.1

0.2

0.3

0.4
0.5
0.6
0.7
probability of false alarm(1−Specificity)

0.8

0.9

Figure 4.21: Three different features represented by the ROC cruve.

Embedded Methods
The results from the final subset are shown in table 4.4

981

4.2. IMPLEMENTATION AND RESULTS

Individual feature discrimination
meanhrstdedameanedaknband4thetaknband3thetaknband2thetaknband1thetaknband4beta
knband3beta
knband2beta
knband1beta
knband4alphaknband3alphaknband2alphaknband1alphacmband4theta
cmband3theta
cmband2theta
cmband1theta
cmband4beta
cmband3beta
cmband2beta
cmband1beta
cmband4alphacmband3alphacmband2alphacmband1alpha
0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5 0.55
Score

0.6

0.65

0.7

0.75

0.8

0.85

0.9

0.95

1

Figure 4.22: Individual feature evaluation results.

99

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS

Table 4.3: Complete results for filter methods, sorted by descending AUC. Note the correspondence between higher scores and lower p-values.

100

id

featurename

fmin − fmax [Hz]P-value

FS

AUC

3

cmband3alpha2.4-3.7

3.45E-174

0.02

0.92

6

cmband2beta

1.8-2.4

1.66E-172

0.01

0.91

17

knband1beta

0.5-0.9

6.43E-153

6.86E-30.90

18knband2beta

0.9-1.55

4.28E-137

7.17E-30.87

7cmband3beta

2.4-3.7

1.74E-127

0.01

0.86

21

knband1theta

0.5-0.9

2.43E-119

4.19E-30.85

5cmband1beta

1-1.8

1.26E-102

4.12E-30.83

11

cmband3theta

2.4-3.7

4.75E-102

6.58E-30.82

22knband2theta

0.9-1.55

9.09E-98

3.08E-30.81

25

meaneda1.95E-95

0.43

0.81

2

cmband2alpha1.8-2.4

3.22E-92

7.31E-30.80

10cmband2theta

1.8-2.4

7.74E-82

3.75E-3

0.78

14

knband2alpha0.9-1.55

1.48E-67

1.81E-30.76

1

cmband1alpha1-1.8

1.62e-54

2.56E-30.73

13knband1alpha0.5-0.9

2.13E-41

6.48E-40.71

4cmband4alpha3.7-5.5

2.34E-39

1.81E-30.70

9cmband1theta

1-1.8

4.07E-28

1.17E-30.67

8cmband4beta

3.7-5.5

5.82E-27

1.73E-30.66

15

knband3alpha1.55-2.8

3.14E-20

1.26E-30.64

23knband3theta

1.55-2.8

5.30E-9

3.44E-40.59

12

cmband4theta

3.7-5.5

7.99E-8

2.14E-4

0.58

26

stdeda2.16E-7

1.90E-3

0.58

24

knband4theta

1.63E-4

2.35E-4

0.56

27

meanhr

0.04

9.84E-40.53

16

knband4alpha2.8-5.5

0.16

5.22E-50.52

19knband3beta

1.55-2.8

0.32

1.79E-50.52

20knband4beta

2.8-5.5

0.39

2.16E-5

0.51

2.8-5.5

4.2. IMPLEMENTATION AND RESULTS

Table 4.4: Final results of the GA/KNN method, being the significance how many times eachfeatures is in the final one thousand subsets.
fmin − fmax [Hz] Significance [0 − 1000]idfeaturename

11

cmband3theta

2.4-3.7764

17knband1beta

0.5-0.9759

27

meanhr15

knband3alpha1.55-2.8753

8cmband4beta

3.7-5.5752

21

knband1theta

0.5-0.9751

18knband2beta

0.9-1.55

750

10

cmband2theta

1.8-2.4749

26

stdeda13

knband1alpha0.5-0.9

747

12

cmband4theta

3.7-5.5746

6cmband2beta

1.8-2.4745

3

cmband3alpha2.4-3.7743

9cmband1theta

1-1.8

742

4

cmband4alpha3.7-5.5742

23

knband3theta

1.55-2.8741

2cmband2alpha1.8-2.4741

7

cmband3beta

2.4-3.7738

1

cmband1alpha

1-1.8

732

19

knband3beta

1.55-2.8731

20knband4beta

2.8-5.5729

25

meaneda14

knband2alpha0.9-1.55

727

16

knband4alpha2.8-5.5726

22knband2theta

0.9-1.55

722

24

knband4theta

2.8-5.5722

5

cmband1beta

1-1.8

714

758

748

728

101

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURS

4.2.4

Classification Results

This section shows the final results from the different classifications for the various final selected
subsets of features in each feature selection method.

Control Test
The control classification is different from all the rest. It basically checks if the classes aredifferent intra-subject. This will assess if the data variation between classes is meaningful.
Using the five classifiers implemented, the samples from the person are divided in train
and test data. The train subset represents 90% of all the samples, while test groups 10%. Thesesamples are randomly chosen. To ensure unbiased choices, the process is cycled by one hundred
times per person. The average results can be found in table 4.5.
Table 4.5: Final average results of control testing.
Classifier

SS

SP

ACC

SS × ACC

Naive Bayes

0.9706

0.99130.99490.9656KNN

0.9631

1

0.99590.9592

Decision Tree

0.96290.99450.99290.9561SVM

0.97061

0.99690.9676DA

0.97061

0.99690.9676

The table 4.5 show the best results are from SVM and DA classifiers. More important thanthe outcome, is to note a great distinction between classes inside the same subject. This provesa state of stress is significantly different from a normal state.

Classification
To train the classification model, the training data is selected from all the subjects except one,which samples are classified by the model to allow the validation. This is done until all theindividuals of the experiment have been selected.
Each selection method produces a different path in classification. The average results are
represented in table 4.6, as the best classifier and number of features in the ideal subset.

102

4.2. IMPLEMENTATION AND RESULTS

Table 4.6: Final average results for different selection method, using the five classifiers.
Best classifier

No of features

SS

SP

ACC

SS × ACC

Control

SVM, DA27

0.97061

0.99690.9676

No Selection

SVM

27

0.92090.86340.89140.8209Wilcoxon

SVM

240.93170.86650.89950.8381SVM

26

0.92360.87330.90060.8318SVM

240.93170.86650.89950.8381SVM

150.95400.92410.93920.8960SVM

16

0.95240.92850.94100.8962

60.79400.86340.89140.7078

Algorithm

Fisher’s Score

Type

FilterAUC
Backward

Wrapper

Forward
GA/KNN

Embedded, directed to KNN

Taking into consideration the final results from table 4.6, there is a visible difference between non-stress and stress states. Below there’s the final index vector of the chosen features
for each selection method.
Filter methods,
Wilcoxonindex {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 21, 22, 23, 24, 25,
26, 27}
FSindex {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24,
25, 26, 27}
AUCindex {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 21, 22, 23, 24, 25, 26, 27}
Wrapper methods,
Backwardindex {3, 4, 5, 6, 9, 10, 11, 12, 15, 19, 20, 22, 23, 25, 27},
Forwardindex {1, 3, 4, 6, 9, 10, 11, 12, 13, 15, 19, 20, 22, 23, 25, 27},
Embedded method, directed to KNN,
GA/KNNindex {8, 11, 15, 17, 21, 27},
Filter methods perform better in a higher dimensional space, while wrapper methods areintermediate. The KNN algorithm has better results in a low dimensional space.

103

CHAPTER 4. DETECTION OF ALZHEIMER’S DISEASE-RELATED BEHAVIOURSLive Approach
One of the main goals of the model is to live detect patient Psychomotor agitation. Unfortunately, the test could not be perform in real patients, so the best approach was to simulate inhealthy people. This will be further discussed in chapter 5.
The computer used for runtime belongs to the Institute of Systems and Robotics (ISR), withan Intel R CoreT M i7-860 CPU (8M Cache, 2.80 GHz), 16 GB of RAM memory, a GeForce
520 graphic card with Ubuntu 12.10 32 bit operating system.
The implementation in Matrix Laboratory (MATLAB) was tested to see the performance ofeach one of the selection type, according to its selected features. The table 4.7 illustrates thisdifferences of run-time to complete the classification from all the 20 subjects.
The total time to classify corresponds to the sum of time of all the subject, equal to 19350
seconds, which is about 322.5 minutes.
Table 4.7: Run-time of feature selection methods.
Selection Method

Run-time [s]No Selection

69.75

Wilcoxon

66.62

FS

68.89

AUC

66.75

Backward

59.89

Forward

62.54

GA/KNN

49.07

Analysing all the results, it is possible to conclude that the best method of classification is
the SVM classifiers, using the subset of features from Forward selection. In this approach, eachclassification second can handle 309.40 seconds of acquisition information. The application canthen be applied in live.

104

Chapter 5
Conclusion and Future WorkIn this work, we have presented a novel method for detecting one of the disease manifestations
that has large impact on Alzheimer’s Disease patients daily life, the psychomotor agitation. To
make this possible, we make a study on the use of classifiers for the detection of patient agitation
periods using wearable sensors capable of acquiring specific biosignals.
The work was initiated with the development of a software package suited to collect signal
from the bioPLUX devices, which were the wearable sensor system of choice.
One of the aims here was not only to create a platform to collect signals, but also to makeit as intuitive as possible. As a result, the produced application can, not only be used by aresearcher utilizing these devices, but also for instance by a caregiver of an Alzheimer patient.
The software is able to connect more than one device at a time, being possible to use the
bioPLUX device in conjugation with the bioPLUX Chest Strap.
The application has proven to be effective, being able to acquire data from the 8 channels
at a sampling rates up to 1000 Hz (hardware upper limit) using 12-bit mode resolution. Theinterface provides graphical guiding support on the use and connection of the device and its
sensors, making it simple even for a first time user. More advanced users can explore morecustomizable functioning modes.
The acquired data can be visualized by showing all the plots at once, individually or by
selection. A set of tools allows the customization of the visualization experience in real-time,
moving plot curves and stretching axes. Another great feature implemented is the adjustablewindow size, to enable an improved visualization in big screens, with full high definition resolution. The acquired data can be saved on files for later processing by other applications or
105

CHAPTER 5. CONCLUSION AND FUTURE WORK

for visualization with the developed player application. This second application has exactly thesame look and feel, together with the same visualization options, as the acquisition one, making
its use simple and easily learnt.
Using this tool, a dataset of biosignals (EDA, ECG and accelerations) was acquired from agroup of 20 volunteers. This dataset was used to support the last part of the work, the classifier
training and evaluation.
From this dataset a set of features were defined for the classification processes. Various
feature selection processes for the different classifiers were tested. Its should be noted that theembedded feature selection methods are only suited for theKNN classifier.
By comparing the results we could observe that the wrapper methods have proven to getbetter results than filter and embedded methods. It can be explained in part, because they treat
features as a group, which does not happen in filter strategies.
By analysing the overall results, the final choice is the SVM classifier as it is the most robust
although being quite heavy.
The feature extraction, training and recognition processes received particular attention to
make the system usable for any new patient, without requiring new training or tuning. The only
necessary calibration of the system is to start it and acquire ECG and EDA samples during two
minutes to compute the respective baselines, which are used in turn in feature calculation.
The choice of balancing the final metric of performance, between accuracy and sensitivity,
received particular attention. We considered that it is very important to minimize false negatives as we don’t want to miss any crisis episode. Nevertheless, the number of false positives
should also be kept to the minimum possible as these may have a desensitisation effect on the
caregivers.
Given this, our choice was to maximise the product of the sensitivity by the accuracy.
As for the quantitative final results, the control classification, intra-subject, shows there
are an excellent distinction between non-stress and stress states. The basic approach, with nofeature selection, shows good results in terms of sensitivity, however not so good in specificity.
The best selection method can improve about 3% in sensitivity and around 8% in specificity,which is traduced in an enhance of 5% in accuracy results. This shows the extreme importanceof feature selection.
Finally, the last obstacle of this work was to prove the method can be implemented to run
1065.1. FUTURE WORKin real-time. Without this feature, there is no possibility of monitoring a patient throughout his
daily routine. The results show the best classification approach can handle around 309 secondsof new information per second, making it a viable method.

5.1

Future Work

There is quite a bit of work, which can be done here. The main goal is to integrate the classification model into the acquisition software. Coupling these two parts makes the term real-time
approach closer to its real sense. To do this, the MATLAB implementation would need to beported to C++ programming language, which would certainly speed up the algorithms performance.
Secondly, it is crucial to test the method in real patients to have more accurate feedback.
This is already scheduled to take place, as mentioned before. This difference will port thiswork from a concept to a real product which can help millions of people regain part of the
independence they lost with the disease.
One of the biggest steps is the integration with mobile platforms. As stated in section
2.5, presently the Bluetooth implemented in bioPLUX devices is not compatible with iPhone.
The advice of upgrade will be sent to the manufacturer. Meanwhile, there is an hardware indevelopment in ISR to serve as bridge between the acquisition hardware and the smartphone,which will try to overcome this drawback.
Finally, the software developed in this work can serve as a base to other works which may
need to use the BioPlux devices, or perhaps alternative new devices having Bluetooth as communication protocol.

107Bibliography[1] Postnote. ALZHEIMER ’ S & DEMENTIA. Parlamentary Office of Science and Technology, (278), 2007.
[2] World Health Organization. Dementia: a public health priority. WHO, Genf. Für dieses
Informationsblatt danken wir, 2012.
[3] Henry Brodaty. Alzheimer ’ s Disease : An International Perspective. 2005.
[4] TICE.Healthy Sistemas de Saúde e Qualidade de Vida. Relatório de Consulta aos Especialistas: Principais manifestações e alterações comportamentais na Doença de Alzheimer
e na Doença de Parkinson. Technical report, Center for Neuroscience and Cell Biology,
2011.
[5] Alzheimer’s Disease Education & Referral (ADEAR) Center. Alzheimer ’ s Disease.
National Institutes of Health, 2008.
[6] Alzheimer’s Association. About agitation and Alzheimer ’ s disease. pages 1–2, 2004.
[7] Majd Alwan, P J Rajendran, S Kell, David Mack, S Dalal, M Wolfe, and R Felder. A
smart and passive floor-vibration based fall detector for elderly. In Information and Communication Technologies 2006 ICTTA06 2nd, volume 1, pages 1003–1007. IEEE, 2006.
[8] Harry W Tyrer, Myra A Aud, Gregory Alexander, Marjorie Skubic, and Marilyn Rantz.
Early detection of health changes in older adults. Conference Proceedings of the International Conference of IEEE Engineering in Medicine and Biology Society, 2007:4045–
4048, 2007.
[9] Harry W Tyrer, Majd Alwan, George Demiris, Zhihai He, Jim Keller, Marjorie Skubic,
and Marilyn Rantz. Technology for successful aging. Conference proceedings : Annual109

BIBLIOGRAPHYInternational Conference of the IEEE Engineering in Medicine and Biology Society. IEEE
Engineering in Medicine and Biology Society. Conference, 1:3290–3293, January 2006.
[10] M Rowe, S Lane, and C Phipps. CareWatch: A Home Monitoring System for Usein Homes of Persons With Cognitive Impairment. Topics in Geriatric Rehabilitation,23(1):3–8, 2007.
[11] Datong Chen, Howard Wactlar, Ming-yu Chen, Can Gao, Ashok Bharucha, and Alex
Hauptmann. Recognition of aggressive human behavior using binary local motion descriptors. Conference Proceedings of the International Conference of IEEE Engineeringin Medicine and Biology Society, 2008:5238–5241, 2008.
[12] R Romdhane, E Mulin, A Derreumeaux, and N Zouba. Automatic video monitoring
system for assessment of Alzheimer’s Disease symptoms. JNHA 2011, 2012.
[13] Alzheimer’s Association. Comfort Zone, 2013.
[14] Albert Huang and Larry Rudolph. Bluetooth for Programmers. 2005.
[15] BioPlux. bioPLUXresearch user manual, version 1.2. Technical report, 2010.
[16] BioPlux. BioPlux Protocol ( version 2 ). Technical Report version 2, BioPlux, 2011.
[17] BioPlux. xyzPlux Accelerometer Sensor Characteristics of Plux triaxial accelerometer
sensors. Technical report, BioPlux, 2011.
[18] BioPlux. ecgPlux Electrocardiogram Sensor Characteristics of ecgPlux ECG sensors.
Technical report, BioPlux, 2012.
[19] BioPlux. edaPlux EDA Sensor Characteristics of edaPlux EDA sensors. Technical report,
BioPlux, 2012.
[20] Jasmin. Blanchette and Mark. Summerfield. C++ GUI programming with Qt 4. PrenticeHall.
[21] Francis Morris, June Edhouse, William J Brady, and John Camn. ABC of Clinical Electrocardiography, volume 324. BMJ Books, 2002.

110

BIBLIOGRAPHY[22] Wikimedia. QRS. http://commons.wikimedia.org/wiki/File:Qrs.png,
2013.
[23] Carlos Costa Almeida. Aparelho Cardiocirculatório. FUNDAMENTOS FISIOLÓGICOSDA ENGENHARIA BIOMÉDICA, page 43.
[24] Melody M Moore and Umang Dua. A galvanic skin response interface for people withsevere motor disabilities. ACM SIGACCESS Accessibility and Computing, (77-78):48,
2003.
[25] ND Ahuja, AK Agarwal, NM Mahajan, NH Mehta, and HN Kapadia. GSR and HRV:
its application in clinical diagnosis. 16th IEEE Symposium on Computer-Based Medical
Systems (CBMS’03), 2003.
[26] M P Tarvainen, a S Koistinen, M Valkonen-Korhonen, J Partanen, and P a Karjalainen.
Analysis of galvanic skin responses with principal components and clustering techniques.
IEEE transactions on bio-medical engineering, 48(10):1071–9, October 2001.
[27] J P Marques. Pattern Recognition, Concepts, Methods and Applications. 2001.
[28] Rajeev Kumar and R Verma. Classification Algorithms for Data Mining: A Survey. International Journal of Innovations in Engineering and Technology (IJIET), 1(2):7–14, 2012.
[29] Xindong Wu, Vipin Kumar, JR Quinlan, and Joydeep Ghosh. Top 10 algorithms in data
mining. Springer-Verlag New York, Inc., 14(1):1–37, December 2008.
[30] WR Shankle and P Datta. Improving dementia screening tests with machine learning
methods. Alzheimer’s Research, (714), 1996.
[31] StatSoft.

Naive Bayes Classifier.

http://www.statsoft.com/textbook/naive-bayes-classifier/, 2013.
[32] StatSoft.

K-nearest-neighbors.

http://www.statsoft.com/textbook/k-nearest-neighbors/, 2013.
[33] Don Coppersmith, SJ Hong, and JRM Hosking. Partitioning nominal attributes in decision
trees. Data Mining and Knowledge Discovery 3,, 1999.
111

BIBLIOGRAPHY[34] Max Bramer. Principles of Data Mining. Springer, 2007.
[35] StatSoft. Support Vector Machines. http://www.statsoft.com/textbook/support-vector-machines/, 2013.
[36] Yaqian Guo, Trevor Hastie, and Robert Tibshirani. Regularized linear discriminant analysis and its application in microarrays. Biostatistics, 8(1):86–100, January 2007.
[37] SW Smith. The scientist and engineer’s guide to digital signal processing. California
Technical Publishing, San Diego, California, second edition, 1997.
[38] Priscila Piassi. Esquema Corporal. http://priscilapiassi.blogspot.pt/
2013/01/esquema-corporal.html, 2013.
[39] Skeletal System. Anatomical/Kinesiological Terminology. http://fog.ccsf.cc.
ca.us/~tkobayas/physiokines/08cSkel.shtml, 2013.
[40] Oxford Sports. Rotation. http://content.answers.com/main/content/
img/oxford/Oxford_Sports/0199210896.rotation.1.jpg, 2013.
[41] L Korowajczuk. Signal Processing Fundamentals. LTE, WIMAX and WLAN Network
Design, 6:1–10, 2011.
[42] Kamrad Khoshhal, Hadi Aliakbarpour, J Quintas, M Hofmann, and J Dias. Probabilistic
lma-based human motion analysis by conjugating frequency and spatial based features.
TU Delft Library, pages 3–6, 2011.
[43] Peter Brath. Atlas of Cardiovascular Monitoring. Anesthesiology, page 130, 2000.
[44] Varun Chandola, Arindam Banerjee, and Vipin Kumar. Outlier Detection: A Survey.
2007.
[45] Milos Hauskrecht, Richard Pelikan, M Valko, and J Lyons-Weiler. Feature selection anddimensionality reduction in genomics and proteomics. (1), 2007.
[46] John M Cimbala. Outliers. (September):1–5, 2011.

112

BIBLIOGRAPHY[47] WR Thompson. On a criterion for the rejection of observations and the distribution of theratio of deviation to sample standard deviation. The Annals of Mathematical Statistics,
1935.
[48] Rui Wang and Ke Tang. Feature selection for maximizing the area under the ROC curve.
Data Mining Workshops, 2009. ICDMW’09. . . . , pages 400–405, December 2009.
[49] L Ladha and T Deepa. Feature selection methods and algorithms. International Journal
on Computer Science and Engineering (IJCSE), 3(5):1787–1797, 2011.
[50] Charlotte Wickham. Wilcoxon Rank Sum Test. Stat 411/511, 2012.
[51] Native American. The Wilcoxon Rank-Sum Test. 2:1–10, 1988.
[52] David Faraggi and Benjamin Reiser. Estimation of the area under the ROC curve. Statistics
in medicine, 21(20):3093–106, October 2002.
[53] DJ Hand and RJ Till. A simple generalisation of the area under the ROC curve for multiple
class classification problems. Machine Learning, pages 171–186, 2001.
[54] Quanquan Gu, Z Li, and J Han. Generalized Fisher Score for Feature Selection A Brief
Review of Fisher Score. Ratio, 2012.
[55] Isabelle Guyon and Andre Elisseeff. An Introduction to Variable and Feature Selection.
Journal ofMachine Learning Research, 3:1157–1182, 2003.
[56] D Lui, JA DiDonato, JD Carpten, J Zhu, and Z Duan. Application of genetic algorithm/Knearest neighbor method to the classification of renal cell carcinoma. Proceedings. 2004
IEEE Computational Systems Bioinformatics Conference, 2004. CSB 2004., (Csb):531–
532, 2004.
[57] ML Raymer, WF Punch, E Goodman, and P Sanschagrin. Simultaneous feature extraction
and selection using a masking genetic algorithm. pages 1–8, 1997.
[58] Wen Zhu, Nancy Zeng, and Ning Wang. Sensitivity, specificity, accuracy, associated confidence interval and ROC analysis with practical SAS R implementations. NESUG proceedings: Health Care and Life Sciences, pages 1–9, 2010.

113

Appendix A
Bioplux Communication Protocol

115

BioPlux Protocol (version 2)
The bioPlux protocol is a binary communication protocol between the bioPlux device
and the host. The protocol is typically implemented over a Bluetooth virtual serial port,
but it can be implemented over any other binary communication medium. The protocol
consists in the commands from the host to the bioPlux, and the data from the bioPlux
to the host.

Commands
The commands are the following (expressed by their ASCII character):V – request for a string with the firmware version
Z – start the acquisition mode at 1000 Hz, 6/8 channels, 12-bit samples
R – stop the acquisition mode
> – set digital output to high< – set digital output to low@ – beginning of extended command string (version 2 only)
The extended command string is available in version 2 only. This string has the format:@command[,parameters];
The string always begins with the character '@' and always ends with the character ';'and has no terminating null character. Following the beginning character, the'command' field currently can have only one possibility:–

START : start the acquisition modeThis command requires a 'parameters' field with the format: FFFF,CC,BB
where:– FFFF is the requested sampling frequency in Hz and it is represented as aninteger with four decimal digits. This parameter must be between 36 Hz and1000 Hz.
– CC is a bit-mask for selecting which analog channels will be sampled and it isrepresented as two hexadecimal digits. This parameter is one byte where the
LSB refers to channel 1 and the MSB refers to channel 8. If a bit is set, thecorresponding channel will be sampled.
– BB is the sample resolution, i.e., the number of bits in each sample and it isrepresented as two decimal digits. The possible values are 8 and 12.
As an example, the string '@START,0060,0F,12;' starts the acquisition of channels 1
to 4 at 60 Hz and using 12-bit resolution.
The acquisition mode is stopped with the 'R' command.

PLUX - Wireless Biosigals
Headquarters
Parkurbis | 6200-865 Covilhã | Portugal
plux@plux.info

Lisbon Office
Av. 5 de Outubro n º70 – 8º | 1050-059 Lisboa | Portugal
Tel.. 217 959 120 | Fax. 217 976 007

1/3

Data
The data sent from the bioPlux device can be of two types:– Response to 'V' command. The bioPlux device should respond with the string:"BioPlux EMG v.X\r\n" ( \r and \n are bytes CR (decimal 13) and LF (decimal 10), noquotes and no null-terminating character). The character 'X' represents the protocol
version number, and currently can be 1 or 2 only.
– During acquisition mode, the bioPlux device sends a data frame with the format andat the frequency defined by the command that started the acquisition mode.

The data frame sent by the bioPlux device contains the following information:– 7-bit frame sequence number;– 1-bit digital input state;– analog sampled values;– 8-bit CRC (polynomial x8 + x2 + x + 1) calculated for the whole frame except the CRC.

The frame sequence number is an incrementing 7-bit unsigned integer running from 0
to 127, and then overflowing to 0. The host should verify this number, since a
difference of more than one unit between two consecutive received frames (correcting
the overflow from 127 to 0) means that there was some missing sent frames between
these two received frames. This loss of frames can occur near the limit of the Bluetoothtransmission range.
The frame sequence number and the digital input are packed in one byte. The
sequence number occupies the lower 7 bits and the digital input is placed in the MSB.
The analog sampled values block can have 8-bit or 12-bit resolution. In 8-bit mode,each byte in this block is the sampled value of each selected analog channel, fromchannel 1 to channel 8. Each value is an unsigned integer, ranging from 0 to 255.
In 12-bit mode, each value is an unsigned integer, ranging from 0 to 4095. In the analog
sampled values block, every two 12-bit values are packed in 3 bytes (24 bits),
according to the following scheme:
Byte 0 (bits 7:0) – value A (bits 7:0)
Byte 1 (bits 3:0) – value A (bits 11:8)
Byte 1 (bits 7:4) – value B (bits 3:0)
Byte 2 (bits 7:0) – value B (bits 11:4)
The order of the selected channels is the same as in the 8-bit mode. If the number of
selected channels is odd, the value of the last selected channel is transmitted as thefirst value of the values pair described above, but since there is no second value, only
two bytes are transmitted and the upper 4 bits of the second byte are filled with zeroes.
PLUX - Wireless Biosigals
Headquarters
Parkurbis | 6200-865 Covilhã | Portugal
plux@plux.info

Lisbon Office
Av. 5 de Outubro n º70 – 8º | 1050-059 Lisboa | Portugal
Tel.. 217 959 120 | Fax. 217 976 007

2/3

If the acquisition mode was started with 'Z' command, the first six channels are
sampled every 1 ms (sampling rate of 1000 Hz) and the last two channels are sampled
every 8 ms (sampling rate of 125 Hz), so the sample values of the last two channels arepresent only in one out of eight data frames. To accomplish this requirement, if theframe sequence number is multiple of eight, the frame has all the eight channels,
otherwise it has only the first six channels. In this mode, the format of the data frame isthe following :Byte 0 - bits 6:0
bit 7
Byte 1 and byte 2 (3:0)
Byte 2 (7:4) and byte 3
Byte 4 and byte 5 (3:0)
Byte 5 (7:4) and byte 6
Byte 7 and byte 8 (3:0)
Byte 8 (7:4) and byte 9– frame sequence number– digital input state– channel 0– channel 1– channel 2– channel 3– channel 4– channel 5

If the frame sequence number is multiple of 8 :Byte 10 and byte 11 (3:0) – channel 6
Byte 11 (7:4) and byte 12 – channel 7
Byte 13– CRC
Otherwise :Byte 10

– CRC

Notes
Before sending the first command to the bioPlux device, the host should send a 'V'
command and wait for the string response, ignoring the bytes possibly received before
the waited string. This also guarantees to the host that the bioPlux device has theproper firmware version and is functioning properly.
Due to latency in the communications channel, the arriving data frames do not cease
immediately after the 'R' command. The host should send a 'V' command and wait forthe string response, flushing the data frames received meanwhile from the input buffer.
This way, the input buffer is kept empty to receive responses to subsequentcommands.

PLUX - Wireless Biosigals
Headquarters
Parkurbis | 6200-865 Covilhã | Portugal
plux@plux.info

Lisbon Office
Av. 5 de Outubro n º70 – 8º | 1050-059 Lisboa | Portugal
Tel.. 217 959 120 | Fax. 217 976 007

3/3