You are on page 1of 60

DEGREE PROJECT, IN MEDICAL ENGINEERING , SECOND LEVEL

STOCKHOLM, SWEDEN 2015

Motivation and Quantification of


Physical Activity for Hospitalised
Cancer Patients

ARNRUN THORSTEINSDOTTIR

KTH ROYAL INSTITUTE OF TECHNOLOGY

SCHOOL OF TECHNOLOGY AND HEALTH


!!!!
! !
The Royal Institute of Technology

Motivation and Quantification of


Physical Activity for Hospitalised
Cancer Patients

Master Thesis by
Arnrún Thorsteinsdóttir

Supervisor: Jonas Wåhslén


Examiner: Sjoerd Haasl

A thesis submitted in fulfilment of the requirements


for the degree of Master of Science

in

Medical Engineering
School of Technology and Health

August 2015
Declaration of Authorship

I, Arnrún Thorsteinsdóttir, declare that this thesis titled, ’Motivation and Quantification
of Physical Activity for Hospitalised Cancer Patients’ and the work presented in it are
my own. I confirm that:

⌅ This work was done wholly or mainly while in candidature for a research degree
at this University.

⌅ Where any part of this thesis has previously been submitted for a degree or any
other qualification at this University or any other institution, this has been clearly
stated.

⌅ Where I have consulted the published work of others, this is always clearly at-
tributed.

⌅ Where I have quoted from the work of others, the source is always given. With
the exception of such quotations, this thesis is entirely my own work.

⌅ I have acknowledged all main sources of help.

⌅ Where the thesis is based on work done by myself jointly with others, I have made
clear exactly what was done by others and what I have contributed myself.

Signed:

Date:

i
Abstract
Previous studies have shown the positive e↵ect of increased physical activity for cancer
patients during treatments of chemotherapy and stem cell transplantation. Moderate
exercise has shown to cause significantly less loss of muscle mass, less symptoms of
cancer related fatigue, less need for platelet transfusions during treatment time and
shorter hospitalisation. Inactivity at hospital clinics is though still a major concern and
it seems like lack of motivation plays a big roll. It has been shown that an overview of
activity level, personal goal setting and education on the importance of physical activity
can work as a motivation towards increased physical activity. This project aimed to
make a prototype that can quantify physical activity of hospitalised cancer patients
and represent it in a motivational and informative way. An accelerometer was used
to collect activity data; the data was processed and used to train a support vector
machine for classification of activities. Activities recognised by the prototype are the
postures lying down, sitting and standing as well as recognising when the user is active.
Over 90% accuracy was obtained in activity recognition for specific training sets. The
prototype was tested on patients at the haematology clinic at the Karolinska hospital in
Huddinge. Test subjects rated the classification accuracy and the motivational value of
the prototype on a scale of 1-5. The accuracy was rated 4.2 out of 5 and the motivational
value 3.25 out of 5. A pilot study to further test the feasibility of the product will be
performed in the summer of 2015.

ii
Sammanfattning
Studier har visat att ökad fysisk aktivitet har en positiv e↵ekt på cancerpatienter som
genomgår cellgiftsbehandling och stamcellstransplantationer. Måttlig träning innebär en
signifikant minskning i tappad musklemassa, minskning av cancerrelaterad trötthet, min-
skat behov av trombocyttransfusioner och kortare vårdtider. Inaktivitet på sjukhusen
är fortfarande ett stort problem och brist på motivation verkar spela stor roll. Det har
visats att motivationen ökar om man har översikt över sin aktivitetsnivå, har möjlighet
att sätta upp personliga mål och är informerad om den positiva e↵ekten av ökad fysisk
aktivitet. Syftet för detta projekt var att bygga en prototyp som kunde mäta den fysiska
aktiviteten för inlagda cancerpatienter och visa upp resultatet på ett motiverande och
informativt sätt. Varje patient fick bära en accelerometer på bröstet, vars data samlades
in, bearbetades och användes till att träna en maskininlärningsalgoritm i att känna igen
olika typer av aktiviteter. Prototypen kunde di↵erentiera mellan aktiviteterna liggande,
sittande, stående och aktiv. Över 90 procents korrekta klassifikationer uppnåddes.
Prototypen har testats på patienter inlagda på Hematologiskt Centrum på Karolinska
sjukhuset i Huddinge. Testpersonerna betygsatte klassificeringskvalitén och hur mo-
tiverande produkten upplevdes på en skala mellan 1 och 5. Klassificeringskvalitén fick
betygen 4,2 av 5 och motivationsfaktorn var 3,25 av 5. En pilotstudie för ytterligare
tester av prototypens e↵ekt kommer att genomföras under sommaren 2015.

iii
Acknowledgements
First and far most I want to thank the whole team I worked with on this project for
all the help, support and the fun times, Faris, Henrik, Håkan and Johan. I want to
especially thank Faris as well for the help with figures and diagrams displayed in this
report. I want to thank the Centre for technology in Medicine and Health (CTMH) for
making this project possible. I want to thank all the sta↵ at the haematology clinic
at the Karolinska hospital in Huddinge, especially Nina Nissander physiotherapist and
Martin Jädersten head doctor, for all their help and precious time spent on this project.
I am also grateful to all the patients that took their time in testing our product and
answering our questions during the test period. I want to thank Carl Henrik Ek assistant
professor in machine learning at KTH and Oskar Henrikson psychologist for their advice
and thank my supervisor Jonas Wåhslén. Last but not least I want to thank my family
and friends for their endless support and encouragements that make me believe that I
can do anything.

iv
Contents

Declaration of Authorship i

Abstract ii

Sammanfattning iii

Acknowledgements iv

Contents v

List of Figures vii

List of Tables viii

Preface ix

1 Introduction 1
1.1 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.1 Aim of the pilot study . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.2 Aim of the final product . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 My contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Outline of the report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Background & Literature Review 4


2.1 Exercise and Cancer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.1 Inactivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 How to motivate patients . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Physical activity recognition . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Methods & Pre-Testing 8


3.1 Sensor evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.1 Pebble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.2 ZephyrLIFE Home . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.3 Microsoft Kinect . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 The Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.1 Sensor location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.2 Attachment of the Sensor . . . . . . . . . . . . . . . . . . . . . . . 11
3.3 Accelerometer Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

v
Contents vi

3.3.1 Processing of Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 12


3.4 Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4.1 Support Vector Machine . . . . . . . . . . . . . . . . . . . . . . . . 14
3.4.2 Training Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.5 User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.5.1 Motivational Factors . . . . . . . . . . . . . . . . . . . . . . . . . . 16

4 The Study Design 18


4.1 Study set up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.1.1 Crossover Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.1.1.1 Inclusion and Exclusion Criteria . . . . . . . . . . . . . . 19
4.1.2 Parallel Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.1.2.1 Inclusion and Exclusion Criteria . . . . . . . . . . . . . . 20
4.2 Execution of the Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5 Results & Analysis 21


5.1 Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.1.1 Version 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.1.2 Version 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.1.3 Version 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.1.4 Version 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.1.5 Study Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.2 Sensor Placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.3 Sensor Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.4 Support Vector Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.5 Patient Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.5.1 One Hour Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.5.2 Full Day Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.6 Socio-Economical Impact . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

6 Conclusions & Future Work 32


6.1 The product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.1.1 Activity recognition . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.1.2 Motivational tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.2 The Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

A Processing of data in Matlab 34

B Matlab Machine Learning 37

C Sensor Placement Surveys of Patients and Personnel 40

Bibliography 42
List of Figures

3.1 Diagram of the activity recognition and motivational concept. . . . . . . . 9


3.2 Diagram of data logging for training sets. . . . . . . . . . . . . . . . . . . 15
3.3 Usability testing and software design flow chart. . . . . . . . . . . . . . . . 17

5.1 Measurement view of the first version where the latest classification and a
time stamp is on the right side and list over accumulated values displayed
on the left side. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.2 The interface for the 2nd version. . . . . . . . . . . . . . . . . . . . . . . . 23
5.3 The race interface for the 3rd version. . . . . . . . . . . . . . . . . . . . . 24
5.4 The main interface for the 4th version. . . . . . . . . . . . . . . . . . . . . 25
5.5 The interface for entering the VAS and mood scale values. . . . . . . . . . 25

vii
List of Tables

3.1 Parameters computed for each time window. . . . . . . . . . . . . . . . . . 12


3.2 Distribution of data sets for algorithm testing. . . . . . . . . . . . . . . . 13
3.3 Results from machine learning algoritms in Matlab . . . . . . . . . . . . 14

5.1 Accuracy of detection for di↵erent placements. . . . . . . . . . . . . . . . 26


5.2 Confusion matrices for test 2 with 2 second windows. . . . . . . . . . . . . 26
5.3 Best solution for the arm and the chest with best C and . . . . . . . . . 28
5.4 Best solution for the arm and the chest with best C and for 5 sec averaging 28
5.5 Questions and answers from patients after 1 hour testing, where unan-
swered questions are marked N/A (not available). . . . . . . . . . . . . . . 29
5.6 Questions and answers from patients after the second testing. Patients
were asked to rate on the scale of 1-5. 1 being worst and 5 being the best. 30

viii
Preface
This master thesis project was done as a part of the work for a clinical innovation
fellowship team (CIF) in collaboration with Center for technology in medicine and health
(CTMH). CTMH has the aim to develop the Stockholm region as a world-class centre
for technology in medicine and is a collaboration between Karolinska Insititutet (KI),
The Royal Institute of Technology (KTH) and Stockholm County Council (SLL). The
aim of the CIF program is to create expertise within technical innovation with a special
focus on the needs of hospital clinics [1].

To be able to understand this report fully the reader should have basic knowledge within
medical terminology, programming and product development.

ix
Chapter 1

Introduction

Numerous studies through out the years have shown the positive correlation between
exercise and good health. Lately the e↵ect of exercise has even been proven to be positive
for very sick patients, including cancer patients going through chemotherapy and stem
cell transplantation [2][3]. One of the benefits of physical activity during such treatments
has been shown to be decreased hospitalisation, less loss of physical performance and
less fatigue. The single biggest problem the CIF team saw from observations at the
haematology clinic at the Karolinska hospital, which is also a well-known problem in
the health care sector in general, was lack of bed spaces and human resources to care
for patients. With increasing the physical activity of patients and in that way decrease
their hospitalisation this problem could be decreased.

The positive impact physical activity can have on recovery and health of cancer patients
is becoming a common knowledge among doctors and physiotherapists. The question
is then why isn’t everyone moving? A known problem in most healthcare systems is
the lack of financing and human resources. With making it easier for doctors and
physiotherapists to motivate and monitor their patients movements the health of the
patients could be improved as well as hospitalisation decreased. In that way money
could be saved for hospitals and more space made for treating patients.

With the latest sensor and mobile technology it has become easier to track our physical
activity with di↵erent tools available on the market. A visual overview of step count,
active minutes, estimated calories burned and a possibility of setting personalised goals
has been shown to work as a motivation to increase over all physical activity[4]. Pro-
viding patients and medical sta↵ with a tool that can track patients movements, store
that information and present it could possibly result in increased motivation for physical
activity, improve overview of patients’ activity level and lead to shorter hospital stay.

1
Chapter 1. Introduction 2

1.1 Goals

The main goal of this project was to make a prototype that could evaluate the physical
activity of patients at the haematology clinic at the Karolinska University Hospital in
a quantitative measure. A sensor was to be placed on patients to record their activity
and a visual interactive user interface needed to be built and used to motivate patients
to be active. We wanted to see if patients would be more motivated to exercise if they
could set goals and visualise their progress. First aim was to make a prototype of an
application with a user interface for the patient that would be connected to the sensor
attached to the patient and show basic activity and progress towards a set goal. The
research questions of the project are:

1. What kind of a sensor is suitable for the project, what do we need to measure and
what is the best way to do it?

2. How can the application motivate patients to be more physically active?

3. What is important to display to the patients in the application?

4. How e↵ective is the tool in motivating patients and in giving doctors and physio-
therapist an activity overview of their patients?

1.1.1 Aim of the pilot study

A pilot study to test the feasibility of the product will be conducted during the summer
of 2015. We want to know if it is possible to increase patients’ physical activity using
a motivational tool that gives a visual representation of the patients activity and if it
helps the hospital sta↵ to have an overview of their patients activity levels. The pilot
study was designed in two parts, a cross over study with a limited amount of patients
participating for a long period of a time and a parallel study with many patients but
shorter and varying periods. The set up of the study can be seen in Chapter 4.

1.1.2 Aim of the final product

The aim of the project is to make a prototype that can be further developed into a final
product that can be launched on the market before the end of the year. Along with
building a tool for the pilot study the system is to be expanded to have an interface
for doctors and physiotherapist to access patients data in a centralised database and
in that way have a better overview of the activity levels. A option of having di↵erent
Chapter 1. Introduction 3

motivational interfaces to choose from will also be developed along with making all
components of the product, such as sensors and tablet set up, feasible for commercial
use.

1.2 My contribution

In this project, my tasks were to investigate the relationship between physical activity
and cancer as well as physical activity and health in general. I was to look at earlier
studies of activity recognition and decide what methods and tools were most promising
to use in this project. After deciding on an approach I was to test and implement the
activity recognition algorithm and adjust it to our project. I did both hardware and
software tests, on myself and other team members, as well as tests on patients at the
Haematology clinic at the Karolinska hospital in Huddinge. I took also part in coming up
with motivational concepts and decisions about what to display to patients and hospital
sta↵ in our application.

1.3 Outline of the report

This report first reviews literature and background of why and where this product can be
helpful and what components should be considered in the development. It also reviews
the background and studies that show techniques that have been used earlier for activity
recognition. In Chapter 3 the methods used in this project are outlined. The evaluation
of hardware used as well as pre-processing of data and implementation of recognition
algorithms is explained. Methods used when developing the user interface and how the
motivational value of the application was evaluated is also listed. In Chapter 4 the
design of the pilot study can be seen with explanations of the di↵erent testing concept,
inclusion and exclusion criteria as well as how the study will be conducted. Chapter 5
lists the results of the prototype building and analyses the outcome of the whole project.
Chapter 6 goes through the conclusions of the project and lists possible future work.
Chapter 2

Background & Literature Review

It is important before starting to build a prototype for activity recognition of hospitalised


patients to know what the benefits of such a product could be and what to have in mind
during the development process. It is well known that physical activity has a positive
correlation with good health but the e↵ect and amount of physical activity possible for
hospitalised cancer patients is on a di↵erent scale [2]. To make a tool that is intended to
motivate physical activity motivational theories need to be studied and implemented in
a way that can work in this specific environment. Many tools are available for healthy
individuals to track their physical activity but those are not intended for hospitalised
users. To make such a tool that is specially intended to meet the needs of the hospital
environment previous recognition methods have been studied and analysed with that in
mind.

2.1 Exercise and Cancer

Exercise is good for all organ systems, it increases cell generation and can help strengthen
the immune system [5]. Lately more emphasis has been put into research of the positive
e↵ects of exercise for patients with severe deceases such as cancer. It is well known that
cancer patients su↵er from fatigue and loss of muscle mass during treatment time. It used
to be a common belief that exercising during such period of weakness and exhaustion is
not favourable to patients but recent studies [6][2] show that moderate exercise is not
only safe but can be very beneficial during cancer treatment. Research has presented
results of reduced fatigue [7], decreased length of hospitalisation as well as reduced loss
of muscle mass during treatment [2][3].

A study done in 1997 by the American Society of Haematology [2] that tested the e↵ect
of aerobic exercise during high-dose chemotherapy of patients with blood cancer already
4
Chapter 2. Background & Literature Review 5

showed significant positive results. Patients of the test group participated in a 30-minute
stationary biking training each day of their hospitalisation. The results showed that loss
of performance was 27% greater in the group that did not exercise. As well did the group
that trained experience shorter period of neutropenia and thrombocytopenia, less need
for platelet transfusion, less severity of pain and diarrhoea and shorter hospitalisation.
Other complications that patients su↵ered from during the study were all also lower in
the training group or no di↵erence could be seen between the two groups.

Special studies have been done on the e↵ect of physical activity on cancer related fatigue.
Overview study [7] that goes through eight studies about physical activity of di↵erent
cancer patients groups such as breast cancer, lymphoma and prostate cancer reports
very positive results. The conclusion is that physical exercise shows a strong evidence
of preventing or reducing cancer related fatigue and is one of the few interventions that
can be suggested for that.

2.1.1 Inactivity

A study done on 53,440 men and 69,776 women enrolled by the American cancer society
[8] to examine the relation between leisure time spent sitting and being physically active
in relation to mortality implies the importance of minimising inactivity. The study
results showed that the least active individuals, those that did not work out regularly
and spent more than 6 hours a day sitting, had increased risk of all-cause mortality of
98% for women and 48% for men compared to people that exercised regularly and spent
less than 3 hours sitting per day. It was also stated that the time spent sitting was
associated with total mortality independent of the over all physical activity and that
the strongest association was with cardiovascular disease mortality. Thus it is not only
important to be physically active but decreasing periods of inactivity is very important
as well.

Other studies have also shown that inactivity of patients can be linked to significantly
higher risk of getting deep vein thrombosis [9] and that moderate activity can reduce
the risk of upper respiratory infections up to 20% [10].

2.2 How to motivate patients

The reason behind inactivity among hospitalised patients seems to be a great deal caused
by lack of motivation. Hospitals are not built with the goal of keeping patients active
but for medical treatments. All rooms observed at the Karolinska hospital were an
Chapter 2. Background & Literature Review 6

obvious proof of that. The set up encourages patients to stay in bed with the TV set
up in a convenient height, not much space to move around in the room and limited
time with physiotherapists due to their limited resources. The haematology clinic is
even worse of than other clinics due to the weak immune system of patients during
treatment time and their need of isolation. Most patients face a time of total isolation
in their rooms during the busiest time of the day over some period of their stay. That
is undeniably demotivating when it comes to physical activity. It is a time consuming
job for physiotherapists to motivate all patients to exercise on daily basis and is not
possible with todays resources. It is though very important for those weak patients to
get motivated to increase their activity even just slightly on their worst days to diminish
the chances of getting pneumonia or bedsores according to the clinics physiotherapist
( Nissander N 2015, physiotherapist at the haematology clinic at Karolinska Huddinge,
oral communication, 17th February).

A study done on patients admitted to an intensive care unit that had early activity
as a priority showed a 55% decrease in physical activity of patients when they were
afterwards transferred to a regular ward [11], implying the importance of paying special
attention to motivate the patients to move.

To be able to get the patients to increase their physical activity the right motivational
tools need to be used. Obviously there are di↵erences between patients, what they
like and what they need, but with the help of previous studies done on motivational
theories the most a↵ective methods can be extracted. It has been shown that having an
overview of your activity level, having visual goals to work towards as well as written
down instructions and education on the benefits of increased physical activity works as
a motivational tool towards increased activity [12][4]. These are factors that we want to
focus on and implement in our system to make it a good motivational tool along with
being an informative tool for patients.

2.3 Physical activity recognition

With fast development on the technical front, activity recognition has become a more
common task. With built-in sensors in mobile phones and other commonly used equip-
ment, focus on activity recognition has increased. There are a lot of applications on
the market for mobile phones that track the users activity through accelerometers, gy-
roscopes and GPS sensors either on the phone or from an external sensor on a wrist- or
chest band for example. These applications can provide useful information for common
users but within the hospitals the need is di↵erent. Physical activity recognition for hos-
pitalised patients needs to be on a much smaller scale, at times only sitting up couple
Chapter 2. Background & Literature Review 7

of times during the day can be all that some patients can perform. For isolated patients
all their activity happens within their room and GPS based system cannot work in that
case. We need a system that can classify between very basic postures and activities.
Studies [13][14][15] have shown that good results have been obtained for recognition of
lying down, sitting, standing and walking around with the use of an accelerometer with
extracting trends from the raw data and using machine learning algorithms to classify
the postures and activities.

Papers that focus on using one accelerometer for recognition of simple activities often
use accelerometers provided in mobile devices. A mobile phone is something most peo-
ple carry with them on daily bases and is therefore a convenient source for activity
recognition. Some of those studies have shown very good results, many well over 90%
success rate for many activities [16]. A problem with the mobile phone is its various
location, depending on where the user prefers to keep it, and that can a↵ect the results
[17]. With a sensor that is fixed in place it can be assumed that the results will be
more accurate since training data and live data will be recorded from same source. Use
of multiple sensors gives even better results and can recognise more complex activities.
With more advanced processing algorithms less specific activities such as being at home,
commuting, being at work or working out can be identified as well [18].
Chapter 3

Methods & Pre-Testing

To obtain information about patient movements, a sensor with an accelerometer was


used. This method was chosen since earlier studies have shown good results with the
use of a single accelerometer and is it easy for patients to carry around. The raw data
was retrieved through a low-energy Bluetooth connection and processed on a Android
application platform. A machine learning algorithm was used to classify di↵erent activity
categories. The activities detected in the prototype of the system were the postures
lying down, sitting, standing as well as indicating when the patient was active, that is
walking around and doing exercises. A machine learning library, the Encog toolbox,
was imported into Android Studio to obtain the classification. In Android Studio the
raw data was processed and ran through a machine-learning algorithm, the classified
activity categories were than sent with a time stamp value to the user interface to be
represented to the user. The concept can be seen in Figure 3.1.

3.1 Sensor evaluation

A lot of di↵erent sensors were reviewed in the process of choosing a suitable sensor
for the pilot study. The main requirement was that the sensor had to have an open
software development kit (SDK) so raw data could be extracted. There are a lot of
di↵erent products on the market but for example few of the fitness sensors or smart
watches available have completely open SDK and often only o↵er access to processed
values such as step count or active minutes. Camera based sensors were also reviewed
as a possible solution. The sensor needed to be easily disinfected due to the sterile
environment at the hospital and not provide discomfort for the patients. Three options
that filled the requirements, a Pebble smart watch, ZephyreLIFE sensor and a Microsoft

8
Chapter 3. Methods & Pre-Testing 9

Kinect camera sensor, were chosen as possible components for the prototype and were
purchased or borrowed for further examination.

Figure 3.1: Diagram of the activity recognition and motivational concept.

3.1.1 Pebble

The Pebble is a smart watch that has a completely open SDK and is therefore a good
choice for development. The Pebble has an accelerometer, is waterproof and can thus
be easily disinfected as well as having up to 7 day battery life [19]. The Pebble has
an interface where applications can easily be written in the programming language C
and uploaded to the watch. Since the Pebble is a open source product a lot of helpful
information from other developers can be found online which makes development much
easier. The Pebble is cheap and therefore was it possible to purchase three watches for
testing. All of these are factors make the Pebble a very good choice for the prototype.

3.1.2 ZephyrLIFE Home

Zephyr is another sensor that was tested for the project. Zephyr is a bioTech sensor that
is intended to be used in home care and to deliver information to the patients doctors
Chapter 3. Methods & Pre-Testing 10

[20]. We borrowed two sensors from their Swedish office to try out for the project. The
Zephyr includes an accelerometer as well as hart rate monitor that is sensed trough gel
electrodes that are attached to the patient’s chest. A plastic holder is attached to the
electrode nobs and the sensor itself than placed into the plastic holder. The openness of
the Zephyrs SDK is not to the same extent as the Pebble and accessing and extracting
accelerometer data from it was difficult. Another down side of the Zephyr sensor was
the short lasting battery life, only about 24 hours when in use. The Zephyr is as well
more expensive option than the Pebble but has additionally a heart rate monitor that
could be useful for future work.

3.1.3 Microsoft Kinect

The Microsoft Kinect is a sensor that uses a colour-based camera, infrared light emitter
and a microphone to sense location, motion and voices of people [21]. This technology
has successfully been used in many computer games but has started to integrate to the
health care sector as well. Systems have been made where a Kinect sensor is used to
monitor patients exercises and activity at home and can than be communicated to their
physiotherapist through the internet [22]. The Kinect is a desirable choice when it comes
to specific activity recognition such as di↵erent aerobic exercises. The down sides to the
Kinect in our case are mainly two. The Kinect proved to perform badly in detecting
the posture lying down as well as being stationary in the patient’s room and thus need
a wearable sensor as well for activity recognition outside the patients room. The Kinect
is also a more expensive choice than the Pebble for example.

3.2 The Sensor

The sensor chosen for the prototype was the Pebble smart watch because of its open SDK,
how easy it was to retrieve raw data form it and it is much cheaper than the other options.
One team member wrote an application that accesses the raw accelerometer data from
the watch and sends it via Bluetooth to the android application on the touch screen
tablet. The Pebble could be set to two modes, one that sends the accelerometer values
approximately every 2 seconds and the second one that only sends values approximately
every minute. The fist setting was mainly for development purposes and the second
setting for real life use.
Chapter 3. Methods & Pre-Testing 11

3.2.1 Sensor location

Since the Pebble is a watch its obvious location is on the patients wrist. When it comes
to classifying and di↵erentiating between static postures such as lying down, sitting and
standing we were not sure if having the sensor placed on the patients wrist was the best
option. Scenarios of patients walking with a walker needed to be covered for example and
that seemed to be difficult to detect for slow walking. Tests were done with recording
simultaneously activity of a test subject with one Pebble placed on the wrist of their
non dominant hand, another Pebble attached to the subjects chest with a medical anti
allergic patch and the third one located at the subjects ankle. Classification error was
calculated for each of the locations to evaluate the di↵erence. Surveys were also done
at the hospital for getting the opinion of both patients and the medical sta↵ in order to
determine how much each placement interfered with other interventions. Results can be
seen in Chapter 5.2.

3.2.2 Attachment of the Sensor

For locating the sensor on the patients’ chest, tests needed to be done to find the best
solution. To start with an hypo-allergic clear medical patch was used that covered the
whole sensor and the area around. For the first sets of testing this method was used but
for testing on patients it was considered hard to put on and too much of a intervention
to cover this large part of their skin. Patients at the haematology clinic often have
very sensitive skin and thus it was recommended to find a solution that would have as
little impact as possible on the patients. The solution that was used for patient testing
was a cut o↵ rubber watchband with attached snap fastener that could be clicked on
to an electrode button. Two hypo-allergic tested electrodes were used and glued on
the patient’s chest and than the sensor attached to them. Ideas for later attachment
methods were also considered, such as 3-D printing a special holder for the sensor that
could be attached to electrode buttons as well.

3.3 Accelerometer Data

Previous studies on classification of physical activity through the use of accelerometers


have shown di↵erent methods to detect specific postures, movements and gestures. Many
of the studies viewed use machine learning algorithms for the classification but use
di↵erent pre processing of data to try to optimise the detection accuracy. The machine
learning approach is explained in section 3.4. The most common approach for the pre
processing is to split the data into overlapping time windows and extracting various
Chapter 3. Methods & Pre-Testing 12

trends from each time window. The majority of all activity recognition papers viewed
use 50% overlap of windows and we chose the same [23][14]. Sampling rate in viewed
studies were from 10-100 Hz but for ambulatory recognition increasing the sampling rate
over 20 Hz is not reported to give significantly improved results [24]. In our tests, we
tried sampling rates of 10 Hz and 25 Hz, the results can be seen in Table 3.3. Since not
much improvement was seen between the di↵erent sampling rates, 10 Hz was chosen to
decrease power consumption of the sensor.

3.3.1 Processing of Data

The most common calculations done on time windows for accelerometer data is to com-
pute the average value of each axis, the standard deviation for each axis, absolute dif-
ference for each axis and average of the resultant value. Some studies have also used
frequency analysis of each window with either Fourier transformation or a Wavelet trans-
formation. Since we had a convincing accuracy with the parameters shown in Table 3.1,
we did not do frequency analysis of the data for the prototype. Frequency analysis does
not give much extra information for static postures and is more important for classi-
fication of di↵erent dynamic and cyclic activities. A two-second window size for the
processing of the data was chosen after testing di↵erent instances, the results can be
seen in Table 3.3. The data processing was first written in Matlab but later translated
to Java for Android compatibility, the Matlab processing code can be seen in Appendix
A.
Method Equation
P
Xn
Average of Axis X= n
qP
(Xn X)2
Standard Deviation of Axis SD = n 1
P
(Xn Xn 1)
Absolute Di↵erence AD = n

P p
( Xn2 +Yn2 +Zn
2)
Resultant Acceleration RA = n

Table 3.1: Parameters computed for each time window.

The processed data was then normalised on the interval [-1,1] for the machine-learning
algorithm to perform better. Normalisation was done as shown in Equation 3.1 for
every processed value X in a training set, where Xmin represents the lowest value for
each calculation and Xmax the highest value for each calculation. Same normalisation
was performed on all data that was classified from that training set.
Chapter 3. Methods & Pre-Testing 13

X ⇤ (Xmin Xmax ) Xmin ⇤ (1) + Xmax ⇤ ( 1)


Xnorm = (3.1)
1 ( 1)

3.4 Machine Learning

To categorise the movements, we used machine-learning algorithms. Machine learning


is a field of computer science where artificial intelligence algorithms are used to recog-
nise trends and learn from data sets and than predict outcomes of new data. We tried
di↵erent kind of algorithms and chose the one that gave the highest classification ac-
curacy. Data of known classification was split into a training set and a test set to test
the performance. The confusion matrix was studied in order to determine the success of
each algorithm. A confusion matrix is a table where the classification of the test set is
matched with the correct classification and gives an overview of the classification perfor-
mance. The percentage of right classifications can then be calculated for each category
and the average value of all the categories indicates the performance of the whole set.

For the testing of di↵erent algorithms, existing functions in Matlab were used for dis-
criminant analysis, K - nearest neighbour method, Naive Bayes method and a support
vector machine (SVM). The Matlab script can be seen in Appendix B. The same data
set was recorded with two di↵erent sampling rates, 10 Hz and 25 Hz. Ten sets were
recorded for each activity and the ten sets then split into training data and testing data.
About 70% of the data was classified as training data and the rest as testing data. Ran-
domisation performed in Matlab decided which 7 sets were classified as training sets and
which as testing for each activity. Distribution and size of training and test sets can be
seen in Table 3.2.
Training sets Size 10 Hz Size 25 Hz Testing sets Size 10 Hz Size 25 Hz
Lying 2,4,5,6,7,9,10 246 kb 514 kb 1,3,8 102 kb 243 kb
Sitting 1,2,3,5,7,8,9 284 kb 683 kb 4,6,10 112 kb 271 kb
Standing 2,3,4,5,6,7,8 220 kb 535 kb 1,9,10 83 kb 207 kb
Walking 2,3,6,7,8,9,10 245 kb 587 kb 1,4,5 86 kb 213 kb

Table 3.2: Distribution of data sets for algorithm testing.

The results from the testing of classification of data with the di↵erent algorithms and
with di↵erent window sizes can be seen in Table 3.3. It can be seen that both the
K-nearest neighbour algorithm and the SVM algorithm performed with well over 90%
accuracy for the classification on average. Discriminant analysis performed worst with
classification accuracy of about 80% on average and the Naive Bayes method performed
with about 85% accuracy for the classification on average. It should be noted that the
Chapter 3. Methods & Pre-Testing 14

test is not a cross-user test and all sets were recorded from the same person at one
occasion.
Window Size: 2 sec (10Hz) 6 sec (10Hz) 10 sec (10Hz) 2 sec (25Hz) 6 sec (25Hz) 10 sec (25Hz)
Discriminant analysis 83% 76% 72% 84% 81% 81%
K-nearest neighbour 89% 95% 94% 95% 99% 99%
Naive Bayes 85% 81% 75% 91% 91% 92%
SVM 97% 97% 96% 99% 100% 100%

Table 3.3: Results from machine learning algoritms in Matlab

From those results it was decided to use SVM for the classification. The SVM performed
on average with 98% accuracy for the classification. For machine learning in Java al-
gorithms from the Encoge library was imported to Android Studio. We used the SVM
algorithm set for classification with the kernel type radial basic function.

3.4.1 Support Vector Machine

Support vector machines can be used for solving both classification and regression prob-
lems. It is a supervised learning model that learns to recognise patterns by analysing
training data to be able to classify or predict values of new input data.

Linear support vector machines used for classification try to make clear boundaries or
hyper planes between classified training data. The hyper plane g(~x) = 0 with the biggest
margin between the hyper plane and the nearest classification point is chosen to optimise
the classification. For classification of two di↵erent objects the equation of the hyper
plane, g(~x) = !
~ ~x + !0 , is scaled so for points of class 1 the hyper plane equation will
always deliver an outcome higher than 1 and points from class 2 will always deliver
outcomes of value lower then -1. The weight vector !
~ of the hyper plane is minimised
with the use of Lagrange multipliers which will maximise the margin between the two
classes and therefore maximise the separability of the two classes. New data is then
classified by the hyper plane equation and assigned to a class depending on the output
[25].

For non-linear classification problems, the support vector machine uses non-linear deci-
sion boundaries that consist of sets of complex polynomial features that create bound-
aries between classifiers. These features are called kernels and are functions that describe
the similarities between a specific landmark and a chosen training sample. For the radial
basis function kernel (Gaussian) that we use in our algorithm, a similarity function for a
~ 2
feature f between a landmark ~l and a sample ~x is f = K(~x, ~l) = exp( ||~x l||
2 ) where ! 2!
is a free parameter. Since the numerator of the fraction within the exponential function
represents the distance between the landmark ~l and the sample ~x squared it is going
to be close to zero when ~x is very close to ~l. The outcome of the feature will then be
Chapter 3. Methods & Pre-Testing 15

approximately 1. If ~x is located far away from the landmark ~l, the numerator is going
to be a large number and the outcome of the feature close to 0. For a complex problem
many features can be defined and calculated for each training point and in that way
define more complex boundaries for each class and make predictions more accurate [26].

3.4.2 Training Sets

For the SVM to be able to classify between di↵erent categories correctly the training
data needs to be of good quality and representative for the intended scenarios. For initial
testing, a mobile app was written for an iOS platform that accessed the accelerometer
data on the phone and recorded it to a comma separated value (CSV) file. This way,
di↵erent activities could be recorded when mounting the phone on a subject’s arm or the
chest and then each CSV file was classified according to that. For the testing of di↵erent
machine learning algorithms, training and test sets were recorded with this method and
analysed in Matlab.

The first version of the prototype included a training mode where di↵erent categories
could be directly recorded, classified and saved in a CSV file on the Android tablet. The
sensor was connected with a Bluetooth connection to the tablet to access the accelerom-
eter values. When the recording button in the application was pushed each batch of
incoming accelerometer data was stored until the stop button was pushed. After record-
ing the data the whole set could be saved into a CSV file with the correct classification.
The diagram for the process can be seen in Figure 3.2.

Figure 3.2: Diagram of data logging for training sets.


Chapter 3. Methods & Pre-Testing 16

3.5 User Interface

The user interface was created in Android Studio by one of the team members. Require-
ments for the user interface were to show in a quantitative manner the total sum of the
patients activity and inactivity. The user interface was also to work as a motivational
tool and thus have a feature to set and monitor personalised goals for example. The
interface was to be as simple as possible, easy to understand with big figures and text.
It was taken into consideration that many of the potential users will be old and may not
have much technical knowledge and experience.

To optimise these components, usability testing was done on patients at the haematology
clinic as well as presenting di↵erent solutions to the sta↵ and collecting feedback. All
members of the team carried out usability testing on several occasions. Things tested
with the usability testing were readability of the app, di↵erent motivational methods,
di↵erent set ups of the accumulated activity data and what functions to include in the
app. The personnel were also asked what kind of information they thought were most
valuable for them to see for each patient and how they would like to access it. For the
study it was also decided that the user interface should have a function where mood and
pain level of patients could be observed. A function where patients can put in values
depending on their daily condition. This can indicate if there is a correlation between
activity levels between days and how the patients are feeling.

To get valuable information from the usability testing there are few things that are good
to have in mind. It is important how the product is introduced to the tester, that the
tester is asked to think out loud and made feel comfortable to expressing their opinion.
It is also important to formulate questions in a way for them not to be leading or unclear
[27]. The flow chart of the iterated process of usability testing and development can be
seen in Figure 3.3.

3.5.1 Motivational Factors

Di↵erent motivational concepts were studied in order to make the motivational value
of the application high. This was obtained with testing and interviewing of patients,
study of di↵erent theories and an interview of Oskar Henrikson, psychologist, that has
specialised in behavioural patterns and changes. Factors that can a↵ect the motivational
value of the application are many and from Oskar we got useful information. The
education of the patient towards why the physical activity is important for them and
what it can mean for their recovery should be a point of focus. Setting the right goal is
also important. The goal needs to be clear and easily understood, how it can be achieved
Chapter 3. Methods & Pre-Testing 17

Figure 3.3: Usability testing and software design flow chart.

and why it is important to achieve it. In this, case the goal for most patients is to get
healthy and out of the hospital to the comfort of their own home so that should be a
field of focus. Involving other parties such as family members or sta↵ can also work as a
motivational factor. It is important to make the application in a way that the patients
want to interact with it, perhaps make it more game like so it catches the attention of
the users and therefor make it more likely they will use it.

The main factors we decided to focus on were the set up of the activity goal in a way
were it was clear what it meant and how to achieve it. It was also considered important
that there would be some kind of a reward when a goal was achieved as well as a feature
that would motivate the patient along the way such as positive messages or figures. The
gamification of the application and involvement of family members or other external
individuals will not be included in the prototype but is under consideration for a later
version.
Chapter 4

The Study Design

The design of the study was in two parts, a crossover study and a parallel study. A
crossover study is when the test subject goes through periods of intervention and non-
intervention during the study time. A parallel study splits the test subjects into two
parts where one part is the test group and exposed to the intervention the whole time of
the study and the other group is a control group where same parameters are measured
but with out the test intervention. The study will be done at the haematology clinic at
the Karolinska hospital in Huddinge during the summer of 2015. The study design was
done in collaboration with Martin Jädersten, the head doctor at the clinic. The aim of
the study is to evaluate the motivational value of the prototype built under the course
of this master project. The hypothesis of the study is that an application on a touch
screen tablet that shows quantified activity of patients in a visual and motivational way
will increase the patients over-all activity level.

4.1 Study set up

Before the study could be started, a study design had to be made to try to predict the
significance of the study depending on number of test subjects and set up of the study.
It was decided to do the study in two parts due to the changes of physical conditions
of patients during cancer treatment. Patients undergoing chemotherapy or stem cell
transplantation usually have a period of significant weakness during the treatment time.
Patients are also in di↵erent physical condition when they start their treatment and
that can a↵ect their physical performance during the treatment. To be able to get clear
results from the study despite these facts, the study was split into the crossover that
tests subjects against themselves and the parallel study that tests subjects against each
other.

18
Chapter 4. The Study Design 19

All patients that agree on taking part in the study will be asked to sign a document
stating their informed consent. The study will not be blinded due to the fact it is
impossible both for the patients and for the conductors in this case.

Parameters to be measured during the study for each patient, both on the crossover study
and the parallel study, are their activity level through the application, their quality of life
and value analogue scale (VAS) pain level through the application as well, the patients
temperature, if the patients need to be in isolation, oxygen requirement of the patient,
haemoglobin level and length of hospital stay will be collected from the hospital sta↵
and registered as well.

4.1.1 Crossover Study

For the crossover study it was decided to have minumum of 4 patients from the haema-
tology clinic at Karolinska. Patients taking part in the crossover study need to have
estimated hospital stay of more than 20 days, that is to have enough time to test them
against themselves. The subcategories of patients that could be chosen were patients
with Acute Myeloid Leukaemia that are over 70 years old and patients with Lymphoma
coming in for a BEAM chemotherapy and a autologous stem cell transplantation. The
expected hospital stay for these patients is between 22-28 days and 25 days respectively.

The crossover study includes four periods where intervention and non-intervention is
switched. During the intervention period, the patients will wear the sensors and have
an access to the application, goals will be set for the physical activity and they will have
the regular interaction with the physiotherapist. During the non-intervention period,
the patient will still be wearing the sensor but with no indication of activity level and
only the regular interaction with the physiotherapist. The intervention periods were
randomised between the patients, that is if intervention is marked as period A and non-
intervention as period B then the di↵erent intervention programs between the patients
are ABBA, BAAB, BABA and ABAB.

4.1.1.1 Inclusion and Exclusion Criteria

Inclusion criteria for the crossover study are that the patients are from either one of the
two categories mentioned above, admitted at the haematology clinic during the study
period and that their expected length of stay is at least 22 days. Exclusion criteria
include if the patient declines to sign the inform consent document or if the patient
cannot understand and/or remember necessary instructions regarding the study, due to
language barriers, cognitive impairment or other reasons. Another exclusion criterion
Chapter 4. The Study Design 20

is if the patient has a pacemaker since the e↵ect of the sensor on the pacemaker or the
other way around is not known.

4.1.2 Parallel Study

For the parallel study, all patients entering the M71 and M73 haematology clinics at
Karolinska in Huddinge during the study time will be checked if they meet the inclusion
criteria and not the exclusion criteria. The patients that agree on participating will
be assigned randomly to either the control group or the intervention group. Patients
assigned to the intervention group get the sensor and the tablet with the application
as well as normal interaction with the physiotherapist. Patients in the control group
get the sensor and a tablet that stores the values from the sensor but does not provide
access to the application. The control group does also get normal interaction with the
physiotherapist.

4.1.2.1 Inclusion and Exclusion Criteria

Inclusion criteria for the parallel study are that the patients are admitted at the haema-
tology clinic during the study period and have a final haematological diagnosis. Further-
more, the patients need to be between 18 and 80 years of age and have an estimated
admission time of at least 4 days. For patients to enrol into the study one or more sensor
and one or more tablet need to be available at that moment. Exclusion criteria include
if the patient declines to sign the inform consent document or cannot understand and/or
remember necessary instructions regarding the study or if the patient has a pacemaker
as mentioned for the crossover study.

4.2 Execution of the Study

During the study time, the team members have to take turns in enrolling new patients
into the study. The concept needs to be explained to patients and the patients need to
sign the informed consent document. Set up of the sensor and the application also needs
to be done on the first day as well as teaching the patients in the intervention group to
use the application. Every day during the study, a team member also needs to check
on all devices to see if they are running correctly, how much battery life is left and to
collect data. This will be done both for the intervention group and the control group to
show the same behaviour towards both groups.
Chapter 5

Results & Analysis

The aim for the prototype was to have a working tool that could quantify patient
movements from accelerometer data provided by the attached sensor. The intended use
for the prototype is to record patient activity during the study that will be done at the
haematology clinic at Karolinska. It was thus required for the prototype to save all data
to a database for later analysis. The prototype included a Pebble sensor, Android tablet
and a software application with machine learning classification algorithm, motivational
user interface and a database.

5.1 Interface

The prototype was made in several steps. Working sprints were planned with everyone
involved in the development with a clear goal to what should be included in each version
of the prototype.

5.1.1 Version 1

Included in the first version of the prototype was a training mode where training data
could be recorded with the correct classification. Options to add a new category or to
delete a category were included as well as a recording button and a button that saved
recorded data to a CSV file. A measurement mode could then be opened when sufficient
training data had been recorded. The measurement mode showed classification of live
data sent from the sensor, that is the name of the latest classification appeared on the
screen. An accumulation of the categorised values was showed on the left side where
number of classified windows for each category was displayed. The view can be seen in
Figure 5.1.
21
Chapter 5. Results & Analysis 22

Figure 5.1: Measurement view of the first version where the latest classification and
a time stamp is on the right side and list over accumulated values displayed on the left
side.

5.1.2 Version 2

In the second version, the accumulated values where used to show the quantified data
in histograms where the number of classified windows was calculated over to time spent
doing each category. To be able to set goals for the activity level the concept of activity
points was made. Accumulated data was calculated over to activity points and than
the progress was shown in a pie chart, see Figure 5.2. Di↵erent activities give di↵erent
number of activity points. In this version being inactive, that is lying down, gave zero
points, sitting up for one minute gave one activity point, standing for one minute gave
two points and being active gave 6 points for every minute. The goal could thus be set
in number of activity points and the pie chart would show how close in percentages the
user was to achieving the goal. It was decided to use the made up concept of activity
points to make the goal setting clearer and easier to understand.

5.1.3 Version 3

In the third version of the app the motivational e↵ect of the app was of main focus.
The left side of the screen was design to have a racing mode where the patient could
race against their earlier activity. An avatar would go through a course that ended at a
goal when enough activity points had been collected. Another shadowed avatar was to
be connected to the activity points earned the day before so the patient could compete
Chapter 5. Results & Analysis 23

Figure 5.2: The interface for the 2nd version.

against her/him self. In this version it was possible to choose between the di↵erent
motivational modes. Having the pie chart like before, having the race mode with out
the competing avatar or have it include a shadowed avatar. The race mode with the
competing avatar can be seen in Figure 5.3.

5.1.4 Version 4

In the fourth version of the interface the design of the whole concept was changed. We
got the feedback that the set up was too raw and not very user appealing. The aim for
the fourth version was to make the information in the application more compact and
the user experience better. It was also time to implement a value analog scale (VAS)
to monitor the patients pain level and a mood scale for monitoring the patients over all
well-being in the interface.

In this version only the activity points were shown on a horizontal scale where each
activity had a di↵erent colour and moved together towards a set goal. Underneath, the
icons for each activity was showed for each colour with an accumulated time for each
activity as well. When tapping each activity more information such as precise points
for the activity and how much points the activity would give could be seen. Since being
inactive does not give any points a feature was made where the application notifies the
user how long he/she has been continuously inactive. A time limit could be set for
Chapter 5. Results & Analysis 24

Figure 5.3: The race interface for the 3rd version.

inactive time and if that was reached the tablet would show a message telling the user
to move. This was implemented to get the patients to move constantly over the day and
not just be active for some periods and than have long periods of inactivity in between.
The design for the main interface can be seen in Figure 5.4 and the VAS and mood scale
interface can be seen in Figure 5.5.

5.1.5 Study Version

For the study it was decided to have one main interface so that all subjects would be
exposed to the same motivational method. Version 2 with the histograms and the pie
chart for activity points will be used combined with the VAS and mood scale chart
developed in the 4th version. The concept of reminding patients to move after long
periods of inactivity will also be added to the study version.

5.2 Sensor Placement

For the sensor placement, a couple of things needed to be validated. The accuracy of the
classification with the machine learning, comfort of the patients, hygiene in the hospital
and if the sensor could be in the way for procedures that need to be done on the patients.
Chapter 5. Results & Analysis 25

History Nu har du varit inaktiv i 1 h 12 min

42%

Dagens mål: 1000 poäng

inaktiv sittande stående aktiv

3 h 10 m 1 h 22 min 44 min 10 min

Figure 5.4: The main interface for the 4th version.

Figure 5.5: The interface for entering the VAS and mood scale values.
Chapter 5. Results & Analysis 26

Results from accuracy tests for the sensor placements can be seen in Table 5.1. Fifteen
sets of each activity were recorded from 3 subjects with sensors placed on the wrist,
ankle and chest. Two types of testing were run on the data. First where 30% of data
from each activity was picked out randomly and tested against the other 70% as training
set. Than a test was done where 30% of the data of each activity from each subject was
put in the test set and tested against the other 70% as training set.

Window Size: 2 sec 5 sec 10 sec


Test1
Arm 75.25% 74.25% 75.75%
Chest 80.25% 77% 78.25%
Leg 72.5% 72.75% 72.25%
Test2
Arm 79.25% 79.5% 80.25%
Chest 82.5% 78% 77.5%
Leg 75.5% 75% 72.75%

Table 5.1: Accuracy of detection for di↵erent placements.

The results are obtained from studying the confusion matrices for each location. The
confusion matrices for the second test with 2 second time window can be seen in Table
5.2. The vertical headers represent the actual activity performed and the horizontal
headers the outcome from the algorithm. From the results of these tests the chest and
the arm was investigated better. New tests sets from a fourth subject were recorded.
The test set included 5-minute intervals of each activity recorded both at the chest and
the arm. The new test data was than tested against all data recorded for the chest and
arm in the earlier test. The results can be seen in Table 5.3 in Section 5.4.

Inactive Sitting Standing Active


Arm:
Inactive 155 108 0 1
Sitting 5 257 0 2
Standing 0 0 220 4
Active 1 19 44 111
Chest:
Inactive 204 0 39 4
Sitting 0 206 51 13
Standing 0 2 228 0
Active 0 7 39 120
Leg:
Inactive 262 2 0 1
Sitting 0 178 50 2
Standing 0 48 175 22
Active 0 33 49 102

Table 5.2: Confusion matrices for test 2 with 2 second windows.


Chapter 5. Results & Analysis 27

We had to confirm that our preferred placement worked in the hospital setting as well.
During user testing patients were asked if any of the placements would not work for them
and that was noted down with comments on what the problem was and what position
they liked the best. Surveys were also done for the sta↵ of the clinic where they could
list pros and cons of each placement for us to get a better understanding of what was
possible and what not. We got a lot of di↵erent feedback and we needed to evaluate it
regarding severity of the problem, how frequent the situation would appear and if there
were any possible solutions to the problem. List over the answers of both patients and
personal can be seen in Appendix C.

5.3 Sensor Testing

Battery time was tested for the Pebble while running the accelerometer application
and sending 10 Hz data to the tablet. The battery life lasted for the sensor to send
information for over 5 days. The memory of the sensor was tested as well to see how
long the sensor could store data without a connection to the tablet. After 3 hours of
data logging without having a connection to the tablet the sensor memory started to
erase the oldest measurements so if the user would be away for a longer period only the
latest 3 hours would be transferred to the application.

5.4 Support Vector Machine

When using a SVM for classification it is important to do cross-validation of specific


parameters to get the best trade o↵ between learning error and generalisation ability
of the machine. For SVM using the radial basic kernel there are two parameters that
are important to test: the parameter C which is a penalty parameter of the error term
and which is a free parameter of the kernel function [28]. The cross-validation of the
parameters was done in an exponential manner as described in [28] where C = 2i for
i=-5,-3,...,15 and = 2j for j=-15,-13,...,5 was tried for all variations. When the best
values for (C, ) had been identified a smaller step test was made to isolate the single
best (C, ) pair. Both the learning error and the test error were checked to get the best
trade o↵ and avoid over fitting of the training set. For di↵erent training sets the best
values for (C, ) can di↵er and thus was written a function that cross-validates each
training set and stores the optimal (C, ) values in the database.

The comparison test of the arm and the chest location with di↵erent C and parameters
can be seen below in Table 5.3.
Chapter 5. Results & Analysis 28

Test Accuracy Train Accuracy C


Arm 74% 92% 0.3 6
Chest 96% 92% 0.3 5

Table 5.3: Best solution for the arm and the chest with best C and

To increase the stability of the real-life classification, a 5 second averaging was added to
the post processing of the data. For classification of each window four windows a round
are also checked and the window gets the majority class. A test was ran for the same
data as before and results can be seen in Table 5.4
Test Accuracy Train Accuracy C
Arm 74% 93% 0.3 8.5
Chest 98% 94% 0.1 6

Table 5.4: Best solution for the arm and the chest with best C and for 5 sec
averaging

5.5 Patient Testing

All patient testing was done at the haematology clinic at the Karolinska University
hospital in Huddinge. Patient testing included testing the feasibility of the prototype,
if the prototype measured and displayed what we intended to measure and display and
how the patients and sta↵ liked the product. Patient testing was done in two parts.
First one hour testing on 4 patients to get an initial idea of the state of our prototype.
Later longer patient testing was done on 6 patients where patients had the sensor on
and an access to the application for up to 6 hours.

5.5.1 One Hour Testing

During the one-hour testing the patients were first introduced to the over all concept
and asked if they were willing to wear one of our sensors for one hour. The sensor was
placed on all patients’ chest with the electrode patches and the sensor clicked on to
them. The patients were asked to keep an eye on the application on the touch screen
tablet and report to us how they thought it performed classification wise. The patients
were left alone in their room for about an hour to get them to interact with the product
undisturbed. After the testing time, the patients were asked how their over all impression
of the product was, if they thought it classified correctly, what movements or positions
they thought were most often classified wrong, how they liked having the sensor on and
if they would like to use such an application. The questions and answers can be seen in
Table 5.5.
Chapter 5. Results & Analysis 29

Questions: Patient 1 Patient 2 Patient 3 Patient 4


Gender and Male Female Female Female
date of birth 1962 1956 1949 1945
Over all
Good Good Good Good
impression?
Did the product
Yes for the Yes for the
measure Yes Yes
most part most part
correctly?
Categories that Sitting and More standing
were miss standing classification None None
classified: conflicted than should
Was it
uncomfortable
No No No No
to wear
the sensor?
Would you
like to use the Yes and at
application to Yes Yes home N/A
help you move as well
more?

Table 5.5: Questions and answers from patients after 1 hour testing, where unan-
swered questions are marked N/A (not available).

5.5.2 Full Day Testing

For the second patient testing the aim was to see the function of the application during a
longer period of use. Technical issues such as data storage, continuous classification when
interacting with the application and quality of classification in the hospital environment
was to be tested. The acceptance and impression of patients was also to be investigated.
Patients were introduced to the concept and asked to wear a sensor for up to 6 hours
while having the tablet with the application set up and displaying activity values in
their room. Team members checked regularly in on the patients during the testing to
make sure the system was still running. The use of the VAS and mood scale was also
tested. All patients completed the task of entering their pain level and mood with little
or no help from team members. After the test period, all test subjects were asked a few
questions and to rate certain factors of the product on a scale of 1-5 where 1 was worst
possible outcome and 5 was the best. The results can be seen in Table 5.6.

Over-all, testing of the prototype was very successful. All patients claimed to understand
the activity point concept and classification was rated 4.2 out of 5 for accuracy. The
main problem with classification was conflicts of the postures sitting and standing. Since
the sensor is in a similar position for these to position it can be difficult to set the
right threshold between them, which can result in wrong classifications. The average
rating on the motivational factor of the application was 3.25 out of 5, which is fairly
Chapter 5. Results & Analysis 30

Patient 1 Patient 2 Patient 3 Patient 4 Patient 5 Patient 6


Gender and Female Female Male Male Female Male
data of birth 1979 1946 1959 1943 1955 1951
Did you
understand the
Yes Yes Yes Yes Yes Yes
activity point
concept?
How accurate
was the 5 3.5 3.5 4 5 4
classification?
How motivated
were you to
3 5 2.5 4 1 4
increase your
physical activity?
How comfortable
was the sensor 5 5 5 5 1 5
to have on?
If this product
was available
Yes Yes Maybe Yes No Yes
now would you
like to have it?

Table 5.6: Questions and answers from patients after the second testing. Patients
were asked to rate on the scale of 1-5. 1 being worst and 5 being the best.

good but could be a point of interest to make even better. It seemed like patients
that were well informed about the advantages of physical exercise during treatment
time and were already focusing on keeping their activity levels up did not find the
application increase their motivation. The three patients giving the lowest rating for the
motivational e↵ect did all have that in common. These patients might need a di↵erent
motivational approach compared to less active patients. The comfort of having the
sensor on was rated 4.3 out of 5 where all patients but one claimed they had hardly
noticed it during the time of testing. The one patient that did not find it comfortable
to wear the sensor thought the sensor was too big and heavy. At last, the patients
were asked if they would like to start using such a product if it was available right now.
All patients but one were very interested in having such a system in their room during
treatment and some were even interested in bringing such a system home with them.
The patient that was not interested in the system felt that the limitations of the systems
were too many, that it can not recognise precise exercises such as doing exercises while
lying in bed or cycling.
Chapter 5. Results & Analysis 31

5.6 Socio-Economical Impact

Since studies have shown the positive impact increased physical activity can have during
cancer treatment and even that physical activity can decrease the likelihood of cancer re-
currences [29] it can be argued that a product that motivates increased physical activity
can have a significant positive impact. If the prototype proves to work as a motivational
tool within the hospital clinics, that may lead to shorter hospitalisation and fewer come-
back patients which would save money in the health care system in the long run. Since
the intended buyers of the product are the hospital wards the economical background of
the users does not play a roll in who gets to use this product. Increased physical activity
can also increase over all well being of users and quality of life and in such a way have
a positive socio-economical impact on patients’ lives.
Chapter 6

Conclusions & Future Work

It is well possible to get convincing results from activity recognition with one accelerom-
eter and machine learning classification with SVM algorithm. The Pebble sensor was a
good choice for the project since it saved a lot of time when it came to hardware devel-
opment. The preliminary results from testing the prototype showed a very promising
outcome. Most all sta↵ and patients at the haematology clinic that where interviewed,
took part in questionnaires or tested the prototype showed a great interest in the prod-
uct. The need for a tool that can give an overview of patients’ activity level and at the
same time motivate patients to be more physically active seems to be desirable within
this sector. Even though most results were very positive, there are many factors that
can be improved in the system. Calibration on accelerometer data to acount for di↵erent
placements across users could increase the classification accuracy. It would as well make
the system easier in use since the precise location of the sensor will not have as much of
an impact. The system set up has not been tested in a setting where the team members
are not part of the set up crew and thus hard to say how the product will function in
every day use at a clinic. The motivational impact of the product has not thoroughly
been tested and it is thus not possible to state if the product does increase physical
activity among hospitalised cancer patient. Our observations do though suggest that
this kind of a product can increase motivation for physical activity.

6.1 The product

A company, Magnea AB, was started around the project in May 2015. The study to
test the feasibility and motivational value of the product will be the main concern at
first for the company. The aim of the company is to have a minimal viable product
ready to launch to the market in the fall of 2015. Future work for the product will be

32
Chapter 6. Conclusions & Future Work 33

to continuously improve it to make the best tool we can for activity recognition and
motivation within the hospital clinics. Interface for hospital sta↵ will be developed in
cooperation with clinics that have shown interest in the product to be able to deliver
what the customer wants. Improvements when it comes to the hardware will also be
addressed such as making our own sensor that will be customised to our use.

6.1.1 Activity recognition

With development in activity recognition techniques and the performance of machine


learning algorithms a lot of improvements can be done on this front. First on the plan
is to include re-calibration of the sensor to count for di↵erent sensor placements across
users. Smoothing of data with filtering is also a point of interest. Using a hidden
Markov model for example could improve the classification with testing the likelihood
of the classification of each window against every other category and not just the whole
training set as is done now. This method could improve the di↵erentiation of the postures
sitting and standing. Later more categories could also be added to the system for more
diverse recognition.

6.1.2 Motivational tool

An important focus for the product is to make the motivational value as e↵ective as
possible. Since the potential users will be a diverse group of people the plan is to make
a library of di↵erent interfaces for users to choose from. A more interactive and possibly
a game-like version can be made for younger users while the focus for the oldest users
will be on making it simple, easy to understand and to maximise the size of all texts
and figures.

6.2 The Study

The study will be performed in the summer of 2015 and will be the first official test of
the feasibility of this product. The results from the study will be analysed and published
by Magnea AB after the end of the study period. The plan is to conduct further studies
with a larger number of test subjects and across more clinical fields after a final product
has been launched.
Appendix A

Processing of data in Matlab

function [X , Y ]= R aw D a t a T o M L I n p u t ( Files , Classifications , WindowSize ,...


SamplingRate , Overlap , MachineLearningInputFields , Directory )

X =[];
Y =[];

[ NumberOfFiles , Letters ]= size ( Files );

for i =1: NumberOfFiles ;


Raw_Data = csvread ([ Directory Files (i ,:)] , 0 ,0); % read data from csv files

Windows = D a t a T o T i m e W i n d o w s ( Raw_Data , WindowSize ,...


SamplingRate , Overlap ); % split data to time windows

ProcessedData = t i m e W i n d o w T o P r o c e s s e d D a t a ( Windows ,...


M a c h i n e L e a r n i n g I n p u t F i e l d s ); % pre p r o c e s s i n g of data

[ Windows , Fields ]= size ( ProcessedData );

X =[ X ProcessedData ’]; % adding p r o c e s s e d data to one matrix


[r , c ]= size ( X );
Class = ones (1 , Windows )* Cl a ss if ic a ti on s ( i );
Y =[ Y Class ]; % adding c l a s s i f i c a t i o n to one vector
end

end

Listing A.1: Raw Data to machine-learning input

34
Appendix A. Processing of data in Matlab 35

function [ Windows ]= D a t a T o T i m e W i n d o w s ( Raw_Data , WindowSize ,...


SamplingRate , Overlap )

Poin tsInWind ow = WindowSize * SamplingRate ;

[ rows , colums ]= size ( Raw_Data );

N um be rO f Wi nd ow s =(( rows / P ointsIn Window )*2) -1; % Number of windows in the data

Windows = zeros ( floor ( N um be rO f Wi nd ow s ) , PointsInWindow , colums );


line =0;

% c o n s t r u c t i n g windows from raw data


for i =1: PointsIn Window *(1 - Overlap ): rows -( PointsInWindow -1)
line = line +1;
col =0;
for j = i : i + PointsInWindow -1
col = col +1;
for k =1: colums
Windows ( line , col , k )= Raw_Data (j , k );
end
end
end

end

Listing A.2: Data to time windows

function [ ProcessedData ]= t i m e W i n d o w T o P r o c e s s e d D a t a ( Windows ,...


MachineLearningInputFields )

ProcessedData =[];

% c a l c u l a t i o n for each ML field


for i =1: length ( M a c h i n e L e a r n i n g I n p u t F i e l d s )
% average of x - axis
if M a c h i n e L e a r n i n g I n p u t F i e l d s ( i ) == 1
Proc essedVal ue = WindowAverage ( Windows (: ,: ,1));
% average of y - axis
elseif M a c h i n e L e a r n i n g I n p u t F i e l d s ( i ) == 2
Proc essedVal ue = WindowAverage ( Windows (: ,: ,2));
% average of z - axis
elseif M a c h i n e L e a r n i n g I n p u t F i e l d s ( i ) == 3
Proc essedVal ue = WindowAverage ( Windows (: ,: ,3));
% standar d e v i a t i o n of x - axis
elseif M a c h i n e L e a r n i n g I n p u t F i e l d s ( i ) == 4
Proc essedVal ue = WindowSD ( Windows (: ,: ,1));
% standar d e v i a t i o n of y - axis
elseif M a c h i n e L e a r n i n g I n p u t F i e l d s ( i ) == 5
Proc essedVal ue = WindowSD ( Windows (: ,: ,2));
Appendix A. Processing of data in Matlab 36

% standar d e v i a t i o n of z - axis
elseif M a c h i n e L e a r n i n g I n p u t F i e l d s ( i ) == 6
Proc essedVal ue = WindowSD ( Windows (: ,: ,3));
% average asolute d i f f e r e n c e of x - axis
elseif M a c h i n e L e a r n i n g I n p u t F i e l d s ( i ) == 7
Proc essedVal ue = A v e r a g e A b s o l u t D i f f e r e n c e ( Windows (: ,: ,1));
% average asolute d i f f e r e n c e of y - axis
elseif M a c h i n e L e a r n i n g I n p u t F i e l d s ( i ) == 8
Proc essedVal ue = A v e r a g e A b s o l u t D i f f e r e n c e ( Windows (: ,: ,2));
% average asolute d i f f e r e n c e of z - axis
elseif M a c h i n e L e a r n i n g I n p u t F i e l d s ( i ) == 9
Proc essedVal ue = A v e r a g e A b s o l u t D i f f e r e n c e ( Windows (: ,: ,3));
% average r e s u l t a n t a c c e l e r a t i o n over all axis
elseif M a c h i n e L e a r n i n g I n p u t F i e l d s ( i ) == 10
Proc essedVal ue = A v e r a g e R e s u l t a n t A c c e l e r a t i o n ( Windows )
end
ProcessedData =[ ProcessedData ProcessedValue ’]; % adding up p r o c e s s e d data

end
end

Listing A.3: Time windows to processed data


Appendix B

Matlab Machine Learning

% C o p y r i g h t 2013 The MathWorks , Inc .


% Edited by Arnrun T h o r s t e i n s d o t t i r in F e b r u a r y 2015

% % Prepare the Data : R e s p o n s e and P r e d i c t o r s

Files_test =[ ’ Lie1 . csv ’; ’ Lie3 . csv ’; ’ Lie8 . csv ’; ’ Sit4 . csv ’; ’ Sit6 . csv ’ ;...
’ SitX . csv ’; ’ Sta1 . csv ’; ’ Sta9 . csv ’; ’ StaX . csv ’; ’ Wal1 . csv ’; ’ Wal4 . csv ’ ;...
’ Wal5 . csv ’ ]; % files with test data

CL_test =[1 ,1 ,1 ,2 ,2 ,2 ,3 ,3 ,3 ,4 ,4 ,4]; % c l a s s i f i c a t i o n for each file

Dire ctory_te st = ’ chest25Hz / ’; % d i r e c t o r y set d e p e n d i n g on test set

ML =[1 2 3 4 5 6 7 8 9 10]; % number of fields to be c a l c u l a t e d in pre process

[ Data_test , Class_test ]= R a w D a t a T o M L I n p u t ( Files_test , CL_test , 10 ,25 ,0.5 ,...


ML , Directo ry_test ); % raw data to the ML input format

Xtest = Data_test ’; % The raw test data


Ytest = Class_test ’; % C l a s s i f i c a t i o n of each data point

D ir ec to r y_ tr ai n = ’ chest25Hz / ’; % d i r e c t o r y d e p e n d i n g on test set

Files_train =[ ’ Lie9 . csv ’; ’ Lie2 . csv ’; ’ Lie7 . csv ’; ’ Lie4 . csv ’; ’ Lie6 . csv ’ ;...
’ LieX . csv ’; ’ Lie5 . csv ’; ’ Sit1 . csv ’; ’ Sit9 . csv ’; ’ Sit7 . csv ’; ’ Sit8 . csv ’ ;...
’ Sit5 . csv ’; ’ Sit3 . csv ’; ’ Sit2 . csv ’; ’ Sta4 . csv ’; ’ Sta8 . csv ’; ’ Sta3 . csv ’ ;...
’ Sta5 . csv ’; ’ Sta7 . csv ’; ’ Sta2 . csv ’; ’ Sta6 . csv ’; ’ Wal3 . csv ’; ’ Wal6 . csv ’ ;...
’ Wal7 . csv ’; ’ Wal9 . csv ’; ’ WalX . csv ’; ’ Wal2 . csv ’; ’ Wal8 . csv ’ ];

CL_train =[1 ,1 ,1 ,1 ,1 ,1 ,1 ,2 ,2 ,2 ,2 ,2 ,2 ,2 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,4 ,4 ,4 ,4 ,4 ,4 ,4];


% c l a s s i f i c a t i o n of the test sets

[ Data_train , Class_train ]= R a w D a t a T o ML I n p u t ( Files_train , CL_train , 10 ,...


25 ,0.5 , ML , D i re ct or y _t ra in ); % raw data to ML input format
Xtrain = Data_train ’; % The raw t r a i n i n g Data
Ytrain = Class_train ; % c l a s s i f i c a t i o n of each data point

bank =[ Data_test ’ Class_test ’; Data_train ’ Class_train ’]; % Matix with all data

37
Appendix B. Matlab Machine Learning 38

% % The set up of test and t r a i n i n g sets


disp ( ’ Training Set ’)
tabulate ( Ytrain )
disp ( ’ Test Set ’)
tabulate ( Ytest )

XtrainNN = Xtrain ;
YtrainNN = Ytrain ;
XtestNN = Xtest ;
YtestNN = Ytest ;
[ nrows , ncols ] = size ( bank );
catPred = false (1 , ncols );

%% Discriminant Analysis
% D i s c r i m i n a n t an a l y s i s is a c l a s s i f i c a t i o n method . It assumes that
% d i f f e r e n t classes g e n e r a t e data based on d i f f e r e n t G a u s s i a n
% d i s t r i b u t i o n s . Linear d i s c r i m i n a n t a n a l y s i s is also known as the Fisher
% discriminant .

% Train the c l a s s i f i e r
da = C l a s s i f i c a t i o n D i s c r i m i n a n t . fit ( Xtrain , Ytrain , ’ discrimType ’ , ’ quadratic ’ );

% Make a p r e d i c t i o n for the test set


Y_da = da . predict ( Xtest );

% Compute the c o n f u s i o n matrix


C_da = confusionmat ( Ytest , Y_da );
% Examine the c o n f u s i o n matrix for each class as a p e r c e n t a g e of the true class
C_da = bsxfun ( @rdivide , C_da , sum ( C_da ,2)) * 100

% % C l a s s i f i c a t i o n Using Nearest N e i g h b o r s
% C a t e g o r i z i n g query points based on their d i s t a n c e to points in a t r a i n i n g
% dataset can be a simple yet e f f e c t i v e way of c l a s s i f y i n g new points .
% Various d i s t a n c e metrics such as euclidean , correlation , hamming ,
% m a h a l o n o b i s or your own d i s t a n c e metric may be used .

% Train the c l a s s i f i e r
knn = C l a s s i f i c a t i o n K N N . fit ( Xtrain , Ytrain , ’ Distance ’ , ’ seuclidean ’ );

% Make a p r e d i c t i o n for the test set


Y_knn = knn . predict ( Xtest );

% Compute the c o n f u s i o n matrix


C_knn = confusionmat ( Ytest , Y_knn );
% Examine the c o n f u s i o n matrix for each class as a p e r c e n t a g e of the true class
C_knn = bsxfun ( @rdivide , C_knn , sum ( C_knn ,2)) * 100

% % Naive Bayes C l a s s i f i c a t i o n
% Naive Bayes c l a s s i f i c a t i o n is based on e s t i m a t i n g P ( X | Y ) , the p r o b a b i l i t y
% or p r o b a b i l i t y density of f e a tu r e s X given class Y . The Naive Bayes
% c l a s s i f i c a t i o n object p r o v i d e s support for normal ( G a u s s i a n ) , kernel ,
% multinomial , and m u l t i v a r i a t e m u l t i n o m i a l d i s t r i b u t i o n s

% The m u l t i v a r i a t e m u l t i n o m i a l d i s t r i b u t i o n ( _mvmn_ ) is a p p r o p r i a t e for


Appendix B. Matlab Machine Learning 39

% categorical features
dist = repmat ({ ’ normal ’} ,1 , ncols -1);
dist ( catPred ) = { ’ mvmn ’ };

% Train the c l a s s i f i e r
Nb = NaiveBayes . fit ( Xtrain , Ytrain , ’ Distribution ’ , dist );

% Make a p r e d i c t i o n for the test set


Y_Nb = Nb . predict ( Xtest );

% Compute the c o n f u s i o n matrix


C_nb = confusionmat ( Ytest , Y_Nb );
% Examine the c o n f u s i o n matrix for each class as a p e r c e n t a g e of the true class
C_nb = bsxfun ( @rdivide , C_nb , sum ( C_nb ,2)) * 100

% % Support Vector M a c h i n e s

% Make a p r e d i c t i o n for the test set


[ result ] = multisvm ( Xtrain , Ytrain , Xtest );
% Compute the c o n f u s i o n matrix
C_svm = confusionmat ( Ytest , result );
% Examine the c o n f u s i o n matrix for each class as a p e r c e n t a g e of the true class
C_svm = bsxfun ( @rdivide , C_svm , sum ( C_svm ,2)) * 100

Listing B.1: Machine-learning algorithms


Appendix C

Sensor Placement Surveys of


Patients and Personnel

Chest: Arm: Leg:


Pros Cons Pros Cons Pros Cons
Could be
irritating Swollen
Patient 1 Best
while ankles
sleeping
Best, has
already
Patient 2 Ok
things
on the arm
Ok if there
is not Is not so
Patient 3 Best
increased visible.
infection risk
Patient 4 Ok Ok Ok
Has a lot of
other stu↵ on
the chest and
was worried
Patient 5
about red
spots
from the
attachment
Difficult
Patient 6 Ok Ok because
out of reach
Worried
Patient 7 about Ok
discomfort

40
Appendix C Sensor Placement Surveys of Patients and Personnel 41

Chest: Arm: Leg:


Pros Cons Pros Cons Pros Cons
Can give
Least wrong
Can sit in the
Person 1 wrong calculations.
way of ECG*
calculations Worse for
hygene
Can be in the
Ok if easy Ok if easy
Person 2 way for ECG*
to clean to clean
or CIVIC**
Will fall o↵
Easy to put
when Swollen
Person 3 on and take
showering ankles
o↵
or sweating
Will fall o↵ Can be seen
because of easily if
chest hair or patient has
big breasts. on. Many Looks like
Person 4
Will get lost people used prisoner
in wash if to having
goes o↵ a watch on
with clothes their writs
Unhygienic.
In the way of
tubes on
Hard to get Can lead to
Best arms,
Person 5 stuck when ulcers when
position id-bands. Is
hairy chest lying in bed
possible to
cheat when
on the arm
The sensor
Can be in the
can end up Can be
Can work Easy to see way when
in the trash Good irritating
Person 6 better as if patient needles need
when placement when
necklace has it on to be inserted
changing sleeping
in the arm
clothes
Least
Can fall o↵ hygienic. Needs to
when putting Needs to be Best be taken
Person 7
on and taking taken o↵ placement o↵ while
o↵ clothes while showering
washing
Sensor can
be destroyed
Can not be
Gets easily in the case of
Person 8 Best too close
wet diarrhoea and
to CIVIC**
micturition
problems.

*Electrocardiogram, **Central intravenous catheter.


Bibliography

[1] CTMH - Center for Technology in Medicine and Health. URL http://www.ctmh.
se/eng_pages/eng.php.

[2] F. Dimeo, S. Fetscher, W. Lange, R. Mertelsmann, and J. Keul. E↵ects of aerobic


exercise on the physical performance and incidence of treatment-related complica-
tions after high-dose chemotherapy. Blood, 90(9):3390–4, November 1997. ISSN
0006-4971. URL http://www.bloodjournal.org/content/90/9/3390.abstract.

[3] F. Dimeo, S. Schwartz, T. Fietz, T. Wanjura, D. Böning, and E. Thiel. E↵ects


of endurance training on the physical performance of patients with hematological
malignancies during chemotherapy. Supportive care in cancer : official journal of
the Multinational Association of Supportive Care in Cancer, 11(10):623–8, October
2003. ISSN 0941-4355. doi: 10.1007/s00520-003-0512-2. URL http://www.ncbi.
nlm.nih.gov/pubmed/12942360.

[4] S. N. Martin, B. K. Crownover, and F. E. Kovach. What’s the best way to mo-
tivate patients to exercise? : The Journal of Family Practice. The Journal of
family practice, 59(1):43–44, 2010. URL http://www.jfponline.com/?id=21643&
tx_ttnews[tt_news]=178064&cHash=ea697f1807fa8c8b6644c2c8c22a794e.

[5] B. K. Pedersen and L. Ho↵man-Goetz. Exercise and the Immune System: Regula-
tion, Integration, and Adaptation. Physiol Rev, 80(3):1055–1081, July 2000. URL
http://physrev.physiology.org/content/80/3/1055.short.

[6] J. Huber and G. Wiskemann. Physical exercise as adjuvant therapy for patients
undergoing hematopoietic stem cell transplantation. Bone Marrow Transplantation,
41(4):321–329, 2008.

[7] T. Watson and V. Mock. Exercise as an Intervention for Cancer-Related Fatigue.


Physical Therapy, 84(8):736–743, August 2004. URL http://ptjournal.apta.
org/content/84/8/736.

42
Bibliography 43

[8] A. V. Patel, L. Bernstein, A. Deka, H. S. Feigelson, P. T. Campbell, S. M.


Gapstur, G. A. Colditz, and M. J. Thun. Leisure time spent sitting in rela-
tion to total mortality in a prospective cohort of US adults. American journal
of epidemiology, 172(4):419–29, August 2010. ISSN 1476-6256. doi: 10.1093/
aje/kwq155. URL http://www.pubmedcentral.nih.gov/articlerender.fcgi?
artid=3590043&tool=pmcentrez&rendertype=abstract.

[9] A. Imhof and W. Koenig. Exercise and thrombosis. Cardiology Clinics, 19(3):
389–400, August 2001. ISSN 07338651. doi: 10.1016/S0733-8651(05)70224-1. URL
http://www.sciencedirect.com/science/article/pii/S0733865105702241.

[10] C. E. Matthews, I. S. Ockene, P. S. Freedson, M. C. Rosal, P. A. Merriam, and


J. R. Herbert. Moderate to vigorous physical activity and risk of upper-respiratory
tract infection. Medicine & Science in Sports & Exercise, 34(8):1242–1248, August
2002. ISSN 0195-9131. doi: 10.1097/00005768-200208000-00003. URL http://
europepmc.org/abstract/med/12165677.

[11] R. O. Hopkins, R. R. Miller, L. Rodriguez, V. Spuhler, and G. E. Thomsen. Physical


therapy on the wards after early physical activity and mobility in the intensive care
unit. Physical therapy, 92(12):1518–23, December 2012. ISSN 1538-6724. doi:
10.2522/ptj.20110446. URL http://ptjournal.apta.org/content/92/12/1518.

[12] E. M. Phillips, J. C. Schneider, and G. R. Mercer. Motivating elders to initiate


and maintain exercise. Archives of Physical Medicine and Rehabilitation, 85(3):
52–57, July 2004. ISSN 00039993. doi: 10.1016/j.apmr.2004.03.012. URL http:
//www.sciencedirect.com/science/article/pii/S000399930400365X.

[13] Z. Prekopcsák, S. Soha, T. Henk, and C. Gáspár-Papanek. Activity Recognition


for Personal Time Management. 2009. URL http://prekopcsak.hu/papers/
preko-2009-ami.pdf.

[14] W. Wu, S. Dasgupta, E. E. Ramirez, C. Peterson, and G. J. Norman. Classi-


fication accuracies of physical activities using smartphone motion sensors. Jour-
nal of medical Internet research, 14(5):e130, January 2012. ISSN 1438-8871. doi:
10.2196/jmir.2208. URL http://www.pubmedcentral.nih.gov/articlerender.
fcgi?artid=3510774&tool=pmcentrez&rendertype=abstract.

[15] Jennifer R. Kwapisz, Gary M. Weiss, and Samuel A. Moore. Activity recognition
using cell phone accelerometers. ACM SIGKDD Explorations Newsletter, 12(2):
74, March 2011. ISSN 19310145. doi: 10.1145/1964897.1964918. URL http:
//dl.acm.org/citation.cfm?id=1964897.1964918.
Bibliography 44

[16] U. Wallace, D. Cardador, K. Vega, E. Velloso, R. Milidiu, and H. Fuks. Wearable


Computing: Accelerometers’ Data Classification of Body Postures and Movements.
Technical report, 2012. URL http://www.academia.edu/2319746/Wearable_
Computing_Accelerometers_Data_Classification_of_Body_Postures_and_
Movements.

[17] M. Shoaib, S. Bosch, O. D. Incel, H. Scholten, and P. J. M. Havinga. Fusion


of smartphone motion sensors for physical activity recognition. Sensors (Basel,
Switzerland), 14(6):10146–76, January 2014. ISSN 1424-8220. doi: 10.3390/
s140610146. URL http://www.pubmedcentral.nih.gov/articlerender.fcgi?
artid=4118351&tool=pmcentrez&rendertype=abstract.

[18] E. Garcia-Ceja and R. Brena. Long-Term Activity Recognition from Accelerom-


eter Data. Procedia Technology, 7:248–256, 2013. ISSN 22120173. doi: 10.1016/
j.protcy.2013.04.031. URL http://www.sciencedirect.com/science/article/
pii/S2212017313000327.

[19] Pebble Smartwatch for iPhone & Android. URL https://getpebble.com/pebble.

[20] ZephyrLIFE Home Remote Patient Monitoring. URL http://www.


covidien.com/rms/products/health-informatics-and-monitoring/
zephyr-life-home-remote-patient-monitoring#features.

[21] Kinect for Windows features. URL https://www.microsoft.com/en-us/


kinectforwindows/meetkinect/features.aspx.

[22] J. Sporring and K. S. Pedersen. The 3D Home Rehab. URL http://image.diku.


dk/HUMIM/.

[23] R. W. DeVaul and S. Dunn. Real-time motion classification for wearable comput-
ing applications. Technical report, 2001. URL http://digitalmechanics.net/
realtime.pdf.

[24] Report on strategies of mobile sensing in eParticipation. Technical report, Live


Gov, 2013. URL http://liveandgov.eu/deliverables/D2.2.pdf.

[25] T. S. Körting. How SVM (Support Vector Machine) algorithm works, 2014. URL
https://www.youtube.com/watch?v=1NxnPkZM9bc.

[26] Support Vector Machines (SVM) - Part 1 - Linear Support Vector Machines, 2014.
URL https://www.youtube.com/watch?v=HwQQXs4Nyjo.

[27] M. Margolis. User research, quick and dirty. URL http://www.gv.com/lib/


user-research-quick-and-dirty.
Bibliography 45

[28] C. Hsu, C. Chang, and C. Lin. A Practical Guide to Support Vector Classification.
2010. URL http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf.

[29] A. S. Fairey, K. S. Courneya, C. J. Field, and J. R. Mackey. Physical exercise and


immune system function in cancer survivors: a comprehensive review and future
directions. Cancer, 94(2):539–51, January 2002. ISSN 0008-543X. doi: 10.1002/
cncr.10244. URL http://www.ncbi.nlm.nih.gov/pubmed/11900239.
!!!!
! !
!
TRITA 2015:081

www.kth.se

You might also like