Context-detection API for Android developed as a university project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

outsourcing.lyx 57KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151
  1. #LyX 1.6.4 created this file. For more info see http://www.lyx.org/
  2. \lyxformat 345
  3. \begin_document
  4. \begin_header
  5. \textclass article
  6. \use_default_options true
  7. \language english
  8. \inputencoding auto
  9. \font_roman default
  10. \font_sans default
  11. \font_typewriter default
  12. \font_default_family default
  13. \font_sc false
  14. \font_osf false
  15. \font_sf_scale 100
  16. \font_tt_scale 100
  17. \graphics default
  18. \paperfontsize default
  19. \spacing single
  20. \use_hyperref false
  21. \papersize a4paper
  22. \use_geometry false
  23. \use_amsmath 1
  24. \use_esint 1
  25. \cite_engine basic
  26. \use_bibtopic false
  27. \paperorientation portrait
  28. \secnumdepth 3
  29. \tocdepth 3
  30. \paragraph_separation skip
  31. \defskip medskip
  32. \quotes_language english
  33. \papercolumns 1
  34. \papersides 1
  35. \paperpagestyle default
  36. \tracking_changes false
  37. \output_changes false
  38. \author ""
  39. \author ""
  40. \end_header
  41. \begin_body
  42. \begin_layout Title
  43. Context-Aware API for Android Devices: Outsourcing Report
  44. \end_layout
  45. \begin_layout Author
  46. Chris Smith
  47. \begin_inset Newline newline
  48. \end_inset
  49. Supervisor: Naranker Dulay
  50. \end_layout
  51. \begin_layout Date
  52. January 2009
  53. \end_layout
  54. \begin_layout Standard
  55. \begin_inset Newpage pagebreak
  56. \end_inset
  57. \end_layout
  58. \begin_layout LyX-Code
  59. \begin_inset CommandInset toc
  60. LatexCommand tableofcontents
  61. \end_inset
  62. \begin_inset Newpage pagebreak
  63. \end_inset
  64. \end_layout
  65. \begin_layout Part
  66. Background
  67. \end_layout
  68. \begin_layout Standard
  69. Context- or Activity-Aware devices is an area currently under lots of research.
  70. There are many and varied applications of activity-aware devices, ranging
  71. from personal fitness and healthcare to training factory workers or merely
  72. playing music.
  73. \end_layout
  74. \begin_layout Standard
  75. While this research is going on, there has been a huge expansion in the
  76. ownership, use and power of mobile telephones.
  77. Mobile telephones are so ubiquitous and now come with such a large sensor
  78. platform that they are the obvious choice for implementing activity-aware
  79. technologies for use in day-to-day life.
  80. \end_layout
  81. \begin_layout Standard
  82. This project aims to make a context-aware API available on an open mobile
  83. platform, which will enable developers to start adding context-aware functional
  84. ity to their applications without the extremely large overhead of writing
  85. a logger and classifier themselves, or re-engineering the application to
  86. use an existing context-aware framework if one is available.
  87. \end_layout
  88. \begin_layout Section
  89. Applications
  90. \end_layout
  91. \begin_layout Standard
  92. There are many documented applications of activity-aware systems, and current
  93. research efforts which bring the technology to mobile telephones will only
  94. serve to lengthen this list.
  95. \end_layout
  96. \begin_layout Standard
  97. The canonical example for activity-awareness, especially on mobile telephones,
  98. is modeling the user's
  99. \begin_inset Quotes eld
  100. \end_inset
  101. interruptibility
  102. \begin_inset Quotes erd
  103. \end_inset
  104. \begin_inset CommandInset citation
  105. LatexCommand cite
  106. key "Siewiorek2003,Raento2005"
  107. \end_inset
  108. .
  109. This allows the software to know whether it's appropriate (or "polite")
  110. to disturb the user, and can advise the user's contacts when they are busy.
  111. It can also be used to create a
  112. \begin_inset Quotes eld
  113. \end_inset
  114. smart answering machine
  115. \begin_inset Quotes erd
  116. \end_inset
  117. \begin_inset CommandInset citation
  118. LatexCommand cite
  119. key "Hudson2003"
  120. \end_inset
  121. which can selectively direct calls straight to an answering machine if
  122. the user is engaged in an "uninterpretable" activity and the call does
  123. not appear to be important.
  124. These allow the user's mobile telephone to better approximate human behaviour
  125. - when approaching someone in person it is normally quite easy to determine
  126. whether it would be polite or necessary to disturb them, based on their
  127. demeanour, activity, and the urgency of your request; when picking up the
  128. telephone it is not possible at all without assistance from an activity-aware
  129. system.
  130. \end_layout
  131. \begin_layout Standard
  132. The current implementations of these ideas have several problems, however.
  133. The more interesting research
  134. \begin_inset CommandInset citation
  135. LatexCommand cite
  136. key "Hudson2003"
  137. \end_inset
  138. requires a static camera fixed in an office to observe user behaviour,
  139. instead of implementing it directly on a telephone, which obviously constrains
  140. its usefulness.
  141. Of the two solutions actually targeted at mobile telephones, one
  142. \begin_inset CommandInset citation
  143. LatexCommand cite
  144. key "Siewiorek2003"
  145. \end_inset
  146. requires bulky custom hardware which the user must carry on their belt,
  147. and the other
  148. \begin_inset CommandInset citation
  149. LatexCommand cite
  150. key "Raento2005"
  151. \end_inset
  152. does not expose an API to other applications and only surfaces the context-aware
  153. functionality in two small applications whose focus is on social interaction
  154. rather than improving the user's experience of the telephone locally.
  155. This project will aim to bring the ideas of these to generic hardware (an
  156. Android mobile telephone), and to provide an API which other applications
  157. can harness.
  158. \end_layout
  159. \begin_layout Standard
  160. One use particularly suitable for mobile phones is dynamic adaptation of
  161. the device's settings based on the user's current activity and context
  162. \begin_inset CommandInset citation
  163. LatexCommand cite
  164. key "Schmidt1999"
  165. \end_inset
  166. .
  167. When a user is walking the device can dynamically increase the font size
  168. to make it easier to read with an unsteady hand, and correspondingly decrease
  169. it when the user is stationary.
  170. In a similar fashion, the brightness of the backlight can be altered based
  171. on the ambient light level, and the ringer volume altered according to
  172. the noise level.
  173. Unfortunately this research did not progress beyond a feasibility study
  174. and was implemented on a Nokia 6110, which is severely outdated by today's
  175. standards.
  176. \end_layout
  177. \begin_layout Standard
  178. Another popular area for activity-aware systems is in healthcare.
  179. Such systems can be used to monitor vulnerable people as they go about
  180. day to day activities to ensure that they're not in trouble - several systems
  181. \begin_inset CommandInset citation
  182. LatexCommand cite
  183. key "Song2005,Maurer2006"
  184. \end_inset
  185. can be used to monitor elderly persons and summon help if it is detected
  186. that they have fallen.
  187. Another healthcare application
  188. \begin_inset CommandInset citation
  189. LatexCommand cite
  190. key "Tentori2008"
  191. \end_inset
  192. allows nurses to remotely monitor the activities of their patients in a
  193. hospital ward, allowing them to respond to problems and keep up-to-date
  194. with their patients' well-being while not physically present.
  195. Activity-aware applications have also been used to try to encourage users
  196. to be more healthy; one novel application records the day-to-day fitness
  197. activities a user performs and uses this as a basis for a virtual
  198. \begin_inset Quotes eld
  199. \end_inset
  200. garden
  201. \begin_inset Quotes erd
  202. \end_inset
  203. that blossoms or wilts according to how much the user works out in a week
  204. \begin_inset CommandInset citation
  205. LatexCommand cite
  206. key "Consolvo2008"
  207. \end_inset
  208. .
  209. \end_layout
  210. \begin_layout Standard
  211. As well as monitoring activities which the user is familiar with, activity-aware
  212. systems can also be used to assist users in learning new activities.
  213. One application
  214. \begin_inset CommandInset citation
  215. LatexCommand cite
  216. key "Stiefmeier2008"
  217. \end_inset
  218. monitors the activities of trainee workers in a car manufacturing plant,
  219. and helps to provide a link between theoretical classroom-based training
  220. and practical work.
  221. The activity-aware system can offer advice to the workers that's directly
  222. related to the current task they're performing, and can even monitor their
  223. activities for compliance with procedures and give them a score afterwards.
  224. \end_layout
  225. \begin_layout Standard
  226. While the research into healthcare and training applications present novel
  227. uses of activity-aware systems, the applications themselves are not really
  228. applicable to a mobile device or the scope of this project.
  229. The research does, however, describe the techniques used in those applications
  230. for activity classification and should prove useful in that respect.
  231. \end_layout
  232. \begin_layout Standard
  233. Other areas of research include making activity-aware suggestions to the
  234. user
  235. \begin_inset CommandInset citation
  236. LatexCommand cite
  237. key "Bellotti2008"
  238. \end_inset
  239. , or issuing reminders or alerts based on the user's activity
  240. \begin_inset CommandInset citation
  241. LatexCommand cite
  242. key "Schilit1994"
  243. \end_inset
  244. .
  245. One example of the latter is an activity-aware system that detects when
  246. the user is making coffee, and plays a sound on a remote computer to alert
  247. thirsty coworkers to the fact.
  248. Sound isn't only limited to alerts, however: the
  249. \noun on
  250. XPOD
  251. \noun default
  252. \begin_inset CommandInset citation
  253. LatexCommand cite
  254. key "Dornbush2005"
  255. \end_inset
  256. project is an activity-aware music player, which tailors the music being
  257. played to the user's current activity based on their past ratings.
  258. This type of activity-aware device presents a much greater level of personalisa
  259. tion than previously possible, and making this type of customisation available
  260. to mobile telephone users and application developers will surely result
  261. in many new applications.
  262. \end_layout
  263. \begin_layout Section
  264. Inferring activity
  265. \end_layout
  266. \begin_layout Standard
  267. There are three general phases in most context-aware systems: a sensing
  268. component, which reads or receives raw sensor data relating to the user's
  269. environment or activity; a feature extraction component, which analysis
  270. the sensor data and identifies a set of features from that data; and a
  271. classification component, which uses the extracted features to reason about
  272. the user's activity
  273. \begin_inset CommandInset citation
  274. LatexCommand cite
  275. key "Choudhury2008"
  276. \end_inset
  277. .
  278. Each of these components will be expanded on below.
  279. Depending on the method of classification, some initial or continuous training
  280. may be required, and this is also considered below.
  281. \end_layout
  282. \begin_layout Subsection
  283. Sensors and devices
  284. \end_layout
  285. \begin_layout Standard
  286. At the basis of activity-recognition are the physical hardware sensors.
  287. The most commonly used sensor is the accelerometer, which outputs the accelerat
  288. ion of the sensor
  289. \begin_inset Foot
  290. status collapsed
  291. \begin_layout Plain Layout
  292. and thus the device to which it's attached, and therefore the person using
  293. the device
  294. \end_layout
  295. \end_inset
  296. along a certain axis.
  297. There is extensive research on using accelerometers to classify activities
  298. such as walking
  299. \begin_inset CommandInset citation
  300. LatexCommand cite
  301. key "Mathie2004,Garakani2009"
  302. \end_inset
  303. (including whether or not the subject is walking on flat ground or up and
  304. down stairs
  305. \begin_inset CommandInset citation
  306. LatexCommand cite
  307. key "Caros2005"
  308. \end_inset
  309. ), running
  310. \begin_inset CommandInset citation
  311. LatexCommand cite
  312. key "Garakani2009"
  313. \end_inset
  314. , falling
  315. \begin_inset CommandInset citation
  316. LatexCommand cite
  317. key "Mathie2004"
  318. \end_inset
  319. , sitting
  320. \begin_inset CommandInset citation
  321. LatexCommand cite
  322. key "Mathie2004,Garakani2009"
  323. \end_inset
  324. , cycling
  325. \begin_inset CommandInset citation
  326. LatexCommand cite
  327. key "Garakani2009"
  328. \end_inset
  329. , etc.
  330. \end_layout
  331. \begin_layout Standard
  332. Accelerometers can be combined with magnetic field sensors to convert the
  333. relative acceleration of the device into an absolute acceleration with
  334. respect to the Earth.
  335. This is particularly important when the sensor platform - a mobile telephone
  336. - can be oriented in different ways while performing the same activity.
  337. There are, for example, four different ways to comfortably fit a typical
  338. smartphone into a trouser pocket, made up of two possible orientations
  339. around two axis
  340. \begin_inset Foot
  341. status collapsed
  342. \begin_layout Plain Layout
  343. screen facing towards or away from the body, and the device oriented the
  344. right way up or upside down
  345. \end_layout
  346. \end_inset
  347. .
  348. With just raw accelerometer data these four orientations would lead to
  349. different data for the same activity, but with the combination of magnetic
  350. field sensors we can normalise them.
  351. \end_layout
  352. \begin_layout Standard
  353. Smartphones also come equipped with a microphone and GSM stack (prerequisites
  354. for a telephone conversation!), and commonly a camera, geolocation API
  355. (usually backed by GPS) and Bluetooth stack.
  356. With the exception of the latter two, these types of sensors are not particular
  357. ly well explored for their use in context-aware systems at present.
  358. It is easy to reason how each would be useful - a microphone can reveal
  359. the ambient noise, which could indicate the difference between sitting
  360. in a library and a bar; the camera likewise can reveal the lighting conditions
  361. (if the device is not in a pocket or bag).
  362. The GSM stack can provide rough location information and also a signal
  363. strength to one or more cell towers; the signal strength will vary both
  364. with the user's proximity to the cell tower and the environment around
  365. them - being inside will degrade the signal more than being in open air,
  366. for example - so may provide vital clues to a context-aware system.
  367. One aspect of this project will be to research how the microphone, camera
  368. and GSM stack can be used to enhance existing activity classification algorithm
  369. s.
  370. \end_layout
  371. \begin_layout Standard
  372. Current research on location information and Bluetooth device proximity
  373. is summarised in section
  374. \begin_inset CommandInset ref
  375. LatexCommand ref
  376. reference "sec:Location-analysis"
  377. \end_inset
  378. (p
  379. \begin_inset CommandInset ref
  380. LatexCommand pageref
  381. reference "sec:Location-analysis"
  382. \end_inset
  383. ) and
  384. \begin_inset CommandInset ref
  385. LatexCommand ref
  386. reference "sec:Bluetooth"
  387. \end_inset
  388. (p
  389. \begin_inset CommandInset ref
  390. LatexCommand pageref
  391. reference "sec:Bluetooth"
  392. \end_inset
  393. ) respectively.
  394. \end_layout
  395. \begin_layout Subsection
  396. Feature detection
  397. \end_layout
  398. \begin_layout Standard
  399. It is not possible to reason directly about raw sensor inputs, so the next
  400. step in inferring activities is to extract useful
  401. \emph on
  402. features
  403. \emph default
  404. from the raw input.
  405. Features are usually mathematical properties of the input data, such as
  406. the difference between the minimum and maximum data point in a given time
  407. frame.
  408. Most classifiers use an extremely large number of features -
  409. \begin_inset CommandInset citation
  410. LatexCommand citet
  411. key "Hein2008"
  412. \end_inset
  413. detect 562 different features from their inputs.
  414. \end_layout
  415. \begin_layout Standard
  416. Some of the more commonly used features in activity-recognition systems
  417. are: mean, standard deviation, energy, entropy, correlation between axis,
  418. and discrete FFT coefficients
  419. \begin_inset CommandInset citation
  420. LatexCommand cite
  421. key "Huynh2005"
  422. \end_inset
  423. .
  424. Obviously, not all features are of equal value.
  425. FFT coefficients are generally very good indicators of activity, but the
  426. ideal coefficients and window sizes vary depending on the exact activity
  427. that is being detected.
  428. Likewise, the choice of other features to give the best recognition rate
  429. varies depending on the activity being detected
  430. \begin_inset CommandInset citation
  431. LatexCommand cite
  432. key "Huynh2005"
  433. \end_inset
  434. .
  435. \end_layout
  436. \begin_layout Standard
  437. As the sensor data is received continuously, it needs to be partitioned
  438. somehow before features are extracted.
  439. Most implementations use a sliding window approach with a 50% overlap between
  440. windows
  441. \begin_inset CommandInset citation
  442. LatexCommand cite
  443. key "Bao2004"
  444. \end_inset
  445. .
  446. A window size of 10 seconds with a 50% overlap would result in one set
  447. of features being computed every 5 seconds.
  448. The window size is normally selected to correspond to a pre-defined number
  449. of samples to enable fast computation of certain features - most notably
  450. FFTs
  451. \begin_inset CommandInset citation
  452. LatexCommand cite
  453. key "Bao2004"
  454. \end_inset
  455. .
  456. \end_layout
  457. \begin_layout Standard
  458. One challenge will be determining a set of features that are robust enough
  459. to perform activity analysis on, but are sufficiently inexpensive to calculate
  460. continually on a mobile device, where CPU speed is limited and excessive
  461. usage results in undesirable higher battery consumption.
  462. \end_layout
  463. \begin_layout Subsection
  464. Training
  465. \end_layout
  466. \begin_layout Standard
  467. In order to meaningfully classify and label activities, some kind of training
  468. generally needs to be performed beforehand.
  469. The choice of classifier affects how much offline analysis has to be done
  470. on the training set, and whether or not it can be adapted at run-time.
  471. \end_layout
  472. \begin_layout Standard
  473. One might expect that training would best be performed in a controlled environme
  474. nt, to reduce external influences on the user, but subjects in a laboratory
  475. setting are much more self-conscious about their movements, and this manifests
  476. itself in the data collected.
  477. Walking in a laboratory tends to produce acceleration data showing a consistent
  478. gait cycle which can be split into distinct phases, whereas walking in
  479. an uncontrolled setting produces data showing large fluctuations in gait
  480. phases and length.
  481. This means that classifiers trained on laboratory data may achieve a much
  482. lower accuracy when deployed in natural conditions
  483. \begin_inset CommandInset citation
  484. LatexCommand cite
  485. key "Bao2004"
  486. \end_inset
  487. .
  488. \end_layout
  489. \begin_layout Subsection
  490. Classification
  491. \end_layout
  492. \begin_layout Standard
  493. The classification step involves feeding the features for frame into some
  494. kind of machine learning algorithm which can, using training data
  495. \begin_inset Foot
  496. status collapsed
  497. \begin_layout Plain Layout
  498. and any offline analysis made of that data
  499. \end_layout
  500. \end_inset
  501. , determine which activity the feature-set most like represents.
  502. There are many different algorithms that can be used to perform the classificat
  503. ion, some of which are discussed below.
  504. \end_layout
  505. \begin_layout Subsubsection
  506. Decision trees
  507. \end_layout
  508. \begin_layout Standard
  509. Decision trees are possibly one of the simplest approaches possible
  510. \begin_inset CommandInset citation
  511. LatexCommand cite
  512. key "Hudson2003"
  513. \end_inset
  514. .
  515. A tree is constructed such that each node contains a test function, with
  516. branches for each possible discrete outcome of the function.
  517. This allows data to be classified with a
  518. \begin_inset Quotes eld
  519. \end_inset
  520. divide and conquer
  521. \begin_inset Quotes erd
  522. \end_inset
  523. approach.
  524. While high accuracy is possible in some circumstances
  525. \begin_inset CommandInset citation
  526. LatexCommand cite
  527. key "Hudson2003"
  528. \end_inset
  529. , there are several drawbacks to decision trees: a plain decision tree has
  530. no way to model uncertainty - in an activity-aware system there will always
  531. be a degree of uncertainty as to the classification, and being able to
  532. measure this is an important tool.
  533. They also have an inductive bias which leads to a preference for the most
  534. general solution, and in most cases this generalisation causes many false
  535. results
  536. \begin_inset CommandInset citation
  537. LatexCommand cite
  538. key "Shen2004"
  539. \end_inset
  540. .
  541. \end_layout
  542. \begin_layout Standard
  543. Decision trees require the structure of the tree and the test functions
  544. for each node to be determined during training.
  545. They do not lend themselves to minor on-the-fly modifications or new activities
  546. that are not part of the training set.
  547. \end_layout
  548. \begin_layout Subsubsection
  549. Neural networks
  550. \end_layout
  551. \begin_layout Standard
  552. Neural networks are based on an extremely simplified model of the brain.
  553. The network consists of layers of neurons, and each neuron performs a simple
  554. arithmetic operation on its inputs.
  555. This normally consists of taking each of its inputs, multiplying it by
  556. a weight, and then summing all of the weighted inputs together; the resulting
  557. figure then becomes the neuron's output, and the input to one or more nodes
  558. in the next layer.
  559. \end_layout
  560. \begin_layout Standard
  561. A network consists of a layer of input neurons, a layer containing one or
  562. more output neurons, and one or more layers of
  563. \begin_inset Quotes eld
  564. \end_inset
  565. hidden
  566. \begin_inset Quotes erd
  567. \end_inset
  568. neurons in between.
  569. The number of
  570. \begin_inset Quotes eld
  571. \end_inset
  572. hidden
  573. \begin_inset Quotes erd
  574. \end_inset
  575. layers, and the number of neurons within those layers must be chosen before
  576. training of the network begins.
  577. The training process will then determine the weights for each link in the
  578. network.
  579. The choice of number of layers poses a problem when designing a network,
  580. as too small a number can cripple the power of the network, but too large
  581. can cause it to be too expensive to evaluate and can possibly lead to it
  582. memorising erroneous data
  583. \begin_inset CommandInset citation
  584. LatexCommand cite
  585. key "Dornbush2005"
  586. \end_inset
  587. .
  588. \end_layout
  589. \begin_layout Standard
  590. Neural networks, however, do provide good accuracy and could potentially
  591. (although not easily) be modified on-the-fly to cope with new activities.
  592. \end_layout
  593. \begin_layout Subsubsection
  594. Genetic algorithms
  595. \end_layout
  596. \begin_layout Standard
  597. Genetic algorithms use the principle of natural selection to 'evolve' a
  598. solution to a problem.
  599. A set of random solutions are created, and a pre-defined fitness function
  600. is used to determine their relative worth.
  601. The best solutions are then combined together to produce the next generation
  602. of solutions, in a manner roughly analogous to reproduction in animals.
  603. Small
  604. \begin_inset Quotes eld
  605. \end_inset
  606. mutations
  607. \begin_inset Quotes erd
  608. \end_inset
  609. are also introduced into each generation to counter the effect of local
  610. maxima being reached.
  611. \end_layout
  612. \begin_layout Standard
  613. Genetic algorithms can be combined with other techniques such as neural
  614. networks - the weights in the neural network can be
  615. \begin_inset Quotes eld
  616. \end_inset
  617. evolved
  618. \begin_inset Quotes erd
  619. \end_inset
  620. using genetic algorithms to create a neural network which is good as satisfying
  621. the fitness function.
  622. \end_layout
  623. \begin_layout Standard
  624. The drawback of genetic algorithms is the need for a fitness function -
  625. the network will only ever be as good as the fitness function, and if you
  626. have a way to define what makes a good network you could in most cases
  627. hardcode the solution instead of evolving a network to satisfy it.
  628. \end_layout
  629. \begin_layout Subsubsection
  630. Instance-based learning
  631. \end_layout
  632. \begin_layout Standard
  633. Instance-based learning (IBL)
  634. \begin_inset CommandInset citation
  635. LatexCommand cite
  636. key "Witten2000"
  637. \end_inset
  638. algorithms are a class of
  639. \begin_inset Quotes eld
  640. \end_inset
  641. lazy
  642. \begin_inset Quotes erd
  643. \end_inset
  644. algorithms.
  645. They perform classification based on previously observed instances that
  646. have already been classified.
  647. There is no training required for IBLs, they're extremely adept at adapting
  648. to new scenarios, and they have a very low error rate
  649. \begin_inset CommandInset citation
  650. LatexCommand cite
  651. key "Dornbush2005"
  652. \end_inset
  653. which makes them ideal for activity-recognition.
  654. \end_layout
  655. \begin_layout Standard
  656. One particular type of IBL algorithm which is frequently seen in activity-aware
  657. research is the K-Nearest Neighbour (KNN) algorithm
  658. \begin_inset CommandInset citation
  659. LatexCommand cite
  660. key "Han2006"
  661. \end_inset
  662. .
  663. With the KNN algorithm, each sample is treated as a vector, and the distance
  664. \begin_inset Foot
  665. status collapsed
  666. \begin_layout Plain Layout
  667. the euclidean distance is usually used, but any metric will suffice
  668. \end_layout
  669. \end_inset
  670. between the sample and the existing instances is calculated.
  671. The sample is then classified according to the classification of the majority
  672. of its
  673. \begin_inset Formula $k$
  674. \end_inset
  675. nearest neighbours.
  676. \end_layout
  677. \begin_layout Standard
  678. One drawback of IBLs is that each new instance tends to be remembered for
  679. future use, which eventually results in large amounts of memory consumption
  680. and complexity when comparing distances of new samples.
  681. This can be partially overcome by only storing instances which would affect
  682. the classification of new samples
  683. \begin_inset CommandInset citation
  684. LatexCommand cite
  685. key "Witten2000"
  686. \end_inset
  687. .
  688. \end_layout
  689. \begin_layout Standard
  690. The KNN algorithm can be easily extended to support dynamic classification
  691. of new types of activities - if a sample is not within a certain distance
  692. of sufficient other samples, it can be classified as a new type of activity.
  693. \end_layout
  694. \begin_layout Subsubsection
  695. Conclusion
  696. \end_layout
  697. \begin_layout Standard
  698. There are numerous machine learning algorithms available and suitable for
  699. use in activity classification tasks.
  700. There has been a lot of research into their use, and all of the algorithms
  701. discussed have produced good results.
  702. Because of the lack of need for any training, however, the K-Nearest Neighbour
  703. algorithm appears to be the most promising for a mobile device.
  704. Any algorithm that needs explicit training prior to classification would
  705. almost certainly require a desktop application or a remote service to analyse
  706. the data, as it typically requires large amounts of memory and expensive
  707. computations.
  708. This either makes the application extremely cumbersome for the user (they
  709. have to connect their phone to a computer, transfer a file, obtain and
  710. run a separate application, then transfer some file back), or puts a large
  711. resource burden onto the distributor (having to remotely analyse all of
  712. the data from all users would require dedicated hardware for any more than
  713. a few users).
  714. \end_layout
  715. \begin_layout Section
  716. Mobile telephones
  717. \end_layout
  718. \begin_layout Standard
  719. It's hard to overstate the ubiquity of mobile telephones at present.
  720. In 2003, over a billion mobile telephones were sold - six times as many
  721. as the number of personal computers
  722. \begin_inset CommandInset citation
  723. LatexCommand cite
  724. key "Eagle2004"
  725. \end_inset
  726. .
  727. In 2007, this same figure describes the number of cameraphones sold
  728. \begin_inset CommandInset citation
  729. LatexCommand cite
  730. key "Reynolds2008"
  731. \end_inset
  732. , clearly representing a substantial growth in sales and advancements in
  733. the technology.
  734. In fact, mobile telephones are the fastest adopted technology in human
  735. history
  736. \begin_inset CommandInset citation
  737. LatexCommand cite
  738. key "Eagle2004"
  739. \end_inset
  740. .
  741. This ubiquity, coupled with the fact that mobile telephones are comfortably
  742. carried around on a daily basis by most of their users, makes them a very
  743. attractive alternative to more traditional platforms used for activity-aware
  744. research, which typically involved bulky or inconvenient apparatus that
  745. was expensive to manufacture
  746. \begin_inset CommandInset citation
  747. LatexCommand cite
  748. key "Schmidt2008"
  749. \end_inset
  750. and made users very self-conscious.
  751. \end_layout
  752. \begin_layout Subsection
  753. iPhone
  754. \end_layout
  755. \begin_layout Standard
  756. There have been several published works related to activity-recognition
  757. on the iPhone.
  758. The similarity between iPhone and Android platforms means that many of
  759. the concepts developed for or used on the iPhone are applicable to both.
  760. \end_layout
  761. \begin_layout Subsubsection
  762. iLearn
  763. \end_layout
  764. \begin_layout Standard
  765. \noun on
  766. iLearn
  767. \noun default
  768. \begin_inset CommandInset citation
  769. LatexCommand cite
  770. key "Schmidt2008"
  771. \end_inset
  772. is a suite of three tools -
  773. \noun on
  774. iLog
  775. \noun default
  776. ,
  777. \noun on
  778. iModel,
  779. \noun default
  780. and
  781. \noun on
  782. iClassify
  783. \noun default
  784. - which together allow for real-time classification of low-level activities.
  785. \noun on
  786. iLog
  787. \noun default
  788. is run on the user's iPhone and allows the user to specify which activity
  789. they will be performing.
  790. The application then records raw sensor data from the iPhone's three-axis
  791. accelerometer and 124 features computed from this data in real-time.
  792. The data is then stored on the device, annotated with the selected activity.
  793. \end_layout
  794. \begin_layout Standard
  795. The training data collected by
  796. \noun on
  797. iLog
  798. \noun default
  799. is then transferred to a desktop computer where
  800. \noun on
  801. iModel
  802. \noun default
  803. uses a Naïve Bayesian Network (NBN) to create a model which can be used
  804. to classify future input.
  805. The choice of NBNs was based on their ability to classify a set of trial
  806. data correctly, and the low computational cost of classifying data once
  807. the model has been generated.
  808. \end_layout
  809. \begin_layout Standard
  810. Once the model has been created, it is transferred back to the device where
  811. it is used by
  812. \noun on
  813. iClassify
  814. \noun default
  815. .
  816. This provides an API for other applications, and allows them to register
  817. for a callback which it publishes the user's current activity to every
  818. second.
  819. \end_layout
  820. \begin_layout Standard
  821. Unfortunately, neither the source code nor the API are published.
  822. The inability to run background processes on the iPhone suggests that any
  823. \begin_inset Quotes eld
  824. \end_inset
  825. API
  826. \begin_inset Quotes erd
  827. \end_inset
  828. would have to be more like a framework where the third-party developer
  829. has to re-engineer their application to use the
  830. \noun on
  831. iClassify
  832. \noun default
  833. application as a base.
  834. This is undesirable as it makes it extremely difficult to adapt existing
  835. applications to use the activity-aware API, and is a very cumbersome way
  836. of providing what could be a very minor piece of functionality for the
  837. application.
  838. \end_layout
  839. \begin_layout Subsubsection
  840. Evaluation
  841. \end_layout
  842. \begin_layout Standard
  843. \begin_inset CommandInset citation
  844. LatexCommand citet
  845. key "Miluzzo2009"
  846. \end_inset
  847. present an evaluation of the iPhone for use in
  848. \begin_inset Quotes eld
  849. \end_inset
  850. people-centric sensing applications
  851. \begin_inset Quotes erd
  852. \end_inset
  853. .
  854. One of the major drawbacks highlighted is that the iPhone does not support
  855. applications which run in the background.
  856. This means that any application wishing to perform continuous real-time
  857. activity detection would need to run as a foreground process, preventing
  858. the user from using the device for any other function.
  859. \end_layout
  860. \begin_layout Standard
  861. The research also shows that the computational compatibility of the iPhone
  862. is more than sufficient to perform the necessary calculations for a typical
  863. activity-recognising application, which suggests that any modern smart
  864. phone would be capable of these.
  865. \end_layout
  866. \begin_layout Subsection
  867. Android
  868. \end_layout
  869. \begin_layout Standard
  870. While the Android platform is relatively new, it is rapidly gaining market
  871. share on the more established mobile operating systems.
  872. A December 2009 survey
  873. \begin_inset CommandInset citation
  874. LatexCommand cite
  875. key "ChangeWave2010"
  876. \end_inset
  877. shows that 21% of respondents want their next smartphone purchase to run
  878. Android, a 350% increase from the same survey conducted three months prior.
  879. This is compared to the iPhone, which dropped 4% to 28% in the same time
  880. period.
  881. Gartner, a respected IT research firm, predicts that by 2012, Android will
  882. be the second most popular mobile operating system globally
  883. \begin_inset CommandInset citation
  884. LatexCommand cite
  885. key "ComputerWorld2010"
  886. \end_inset
  887. .
  888. \end_layout
  889. \begin_layout Standard
  890. In addition to its rapidly increasing popularity, the Android platform offers
  891. several advantages over the iPhone platform.
  892. Most notably is the ability to run background processes (called
  893. \noun on
  894. services
  895. \noun default
  896. ), which will allow a classifier application to run without interfering
  897. with the user's normal use of their mobile telephone.
  898. In addition, the Android OS provides access to the Bluetooth and GSM stacks,
  899. allowing for data from both to be used for activity detection.
  900. \end_layout
  901. \begin_layout Standard
  902. The ability to run a background process will enable a proper API for sharing
  903. activity data with other applications, which will allow third-party developers
  904. to make their applications context-aware with relatively little work on
  905. their part.
  906. This is extremely desirable as it will allow rapid prototyping of applications,
  907. which will hopefully lead to innovative new uses of activity classification.
  908. \end_layout
  909. \begin_layout Standard
  910. While it is purported
  911. \begin_inset CommandInset citation
  912. LatexCommand cite
  913. key "Garakani2009"
  914. \end_inset
  915. that there is research being done on bringing activity-awareness to Android
  916. platforms, there does not seem to be any work published on this matter
  917. or any applications available to support it.
  918. While there a small number of self-proclaimed
  919. \begin_inset Quotes eld
  920. \end_inset
  921. context-aware
  922. \begin_inset Quotes erd
  923. \end_inset
  924. applications for Android, this context is almost exclusively limited to
  925. geolocation.
  926. This project will therefore produce one of the first publicly available
  927. activity-aware applications for the Android platform.
  928. \end_layout
  929. \begin_layout Section
  930. Location analysis
  931. \begin_inset CommandInset label
  932. LatexCommand label
  933. name "sec:Location-analysis"
  934. \end_inset
  935. \end_layout
  936. \begin_layout Standard
  937. Location-based services are currently undergoing an
  938. \begin_inset Quotes eld
  939. \end_inset
  940. explosion
  941. \begin_inset Quotes erd
  942. \end_inset
  943. \begin_inset CommandInset citation
  944. LatexCommand cite
  945. key "Bellavista2008"
  946. \end_inset
  947. , thanks to improvements in technology, and greater openness on the part
  948. of service providers and handset manufacturers.
  949. All modern smartphone platforms have a geolocation stack, usually backed
  950. by a GPS chipset and in most cases augmented with either a database of
  951. known cell tower locations, or a map of known wifi network identifiers
  952. and locations, or both.
  953. The two databases allow for rough geolocation when GPS is not available,
  954. or for greatly decreased lookup time when a GPS lock is available.
  955. \end_layout
  956. \begin_layout Standard
  957. However, while the geolocation stack is a rich source of data, it is a poor
  958. source of information.
  959. A latitude/longitude pair may describe the user's exact location, but a
  960. user would be hard-pressed to tell the difference between the latitude/longitud
  961. e of their home, place of work, or of somewhere in between the two with
  962. no real significance.
  963. A great deal of research has therefore been devoted to detecting meaningful
  964. locations from GPS traces.
  965. \end_layout
  966. \begin_layout Standard
  967. \begin_inset Quotes eld
  968. \end_inset
  969. Place recognition
  970. \begin_inset Quotes erd
  971. \end_inset
  972. has two phases: learning and recognising.
  973. An initial learning phase analyses a sensor log and segments the data into
  974. places where the device is stable (stationary), and designates this as
  975. a
  976. \begin_inset Quotes eld
  977. \end_inset
  978. waypoint
  979. \begin_inset Quotes erd
  980. \end_inset
  981. .
  982. It then merges
  983. \begin_inset Quotes eld
  984. \end_inset
  985. waypoints
  986. \begin_inset Quotes erd
  987. \end_inset
  988. that appear to identify the same place being visited multiple times.
  989. The second phase uses these learned waypoints to recognise when the device
  990. is revisiting a place, and therefore also when the device is not visiting
  991. a previously known place (for example when it is moving between two)
  992. \begin_inset CommandInset citation
  993. LatexCommand cite
  994. key "Hightower2005"
  995. \end_inset
  996. .
  997. \end_layout
  998. \begin_layout Standard
  999. Unfortunately, quite a lot of research into location analysis uses GPS
  1000. \begin_inset Quotes eld
  1001. \end_inset
  1002. blackspots
  1003. \begin_inset Quotes erd
  1004. \end_inset
  1005. to identify useful places
  1006. \begin_inset CommandInset citation
  1007. LatexCommand cite
  1008. key "Nurmi2006,Liao2007b"
  1009. \end_inset
  1010. .
  1011. With older GPS chipsets, the satellite signal would be lost when the user
  1012. entered a building, and this allowed an inference that the current location
  1013. was probably a place of interest.
  1014. However, modern GPS chipsets receive a signal in most indoor locations.
  1015. It is possible that a decrease in signal strength or number of locked satellite
  1016. s may still occur, or that GSM signal strength could be used instead, but
  1017. these ideas have not been widely explored at present.
  1018. \end_layout
  1019. \begin_layout Standard
  1020. There is, however, plenty of research relating to the use of location data
  1021. outdoors.
  1022. One application
  1023. \begin_inset CommandInset citation
  1024. LatexCommand cite
  1025. key "Liao2007b"
  1026. \end_inset
  1027. learns not only the user's frequently visited places, but the method of
  1028. transport used between them and the typical routes taken.
  1029. It can then offer instructions showing the user how to go from place to
  1030. place, or issue alerts if the user appears to be going the wrong way (by
  1031. getting on the wrong bus, for instance).
  1032. The ability to correctly infer the user's destination would be extremely
  1033. useful in a context-aware system: a user walking to do their grocery shopping
  1034. is almost certainly going to want to interact with their phone differently
  1035. than a user on a bus going to work.
  1036. \end_layout
  1037. \begin_layout Section
  1038. Bluetooth
  1039. \begin_inset CommandInset label
  1040. LatexCommand label
  1041. name "sec:Bluetooth"
  1042. \end_inset
  1043. \end_layout
  1044. \begin_layout Standard
  1045. The user's context depends on not only what they are doing, where they are
  1046. doing it, but also who they are with.
  1047. Sitting and eating lunch with a manager is quite a different context to
  1048. sitting and eating lunch with a spouse.
  1049. It would therefore be desirable to be able to identify between different
  1050. people when performing context analysis.
  1051. \end_layout
  1052. \begin_layout Standard
  1053. One of the few ways that a mobile telephone can identify other people is
  1054. by searching for
  1055. \emph on
  1056. their
  1057. \emph default
  1058. mobile telephones.
  1059. This can be done by scanning for Bluetooth devices, which involves broadcasting
  1060. a
  1061. \begin_inset Quotes eld
  1062. \end_inset
  1063. device inquiry
  1064. \begin_inset Quotes erd
  1065. \end_inset
  1066. message; if a device chooses to answer the inquiry, it discloses its unique
  1067. MAC address and device class
  1068. \begin_inset Foot
  1069. status collapsed
  1070. \begin_layout Plain Layout
  1071. the device class tells us whether the device is a computer or a mobile telephone
  1072. , for example
  1073. \end_layout
  1074. \end_inset
  1075. .
  1076. Unfortunately, this requires the person to not only be carrying a mobile
  1077. telephone, but a Bluetooth-enabled model, and for them to have configured
  1078. their device to have Bluetooth enabled and to be
  1079. \begin_inset Quotes eld
  1080. \end_inset
  1081. visible
  1082. \begin_inset Quotes erd
  1083. \end_inset
  1084. .
  1085. A study in 2004
  1086. \begin_inset CommandInset citation
  1087. LatexCommand cite
  1088. key "Eagle2004"
  1089. \end_inset
  1090. found that only 1 in 150 people had such a configured device on a university
  1091. campus.
  1092. This figure will undoubtedly be greater now, and may well be greater when
  1093. in public, but it highlights that only a handful of people may be detectable
  1094. via their Bluetooth devices.
  1095. \end_layout
  1096. \begin_layout Standard
  1097. A study in 2006
  1098. \begin_inset CommandInset citation
  1099. LatexCommand cite
  1100. key "Nicolai2006"
  1101. \end_inset
  1102. used a similar technique to monitor the social context of the user, introducing
  1103. the idea of
  1104. \begin_inset Quotes eld
  1105. \end_inset
  1106. familiar
  1107. \begin_inset Quotes erd
  1108. \end_inset
  1109. people,
  1110. \begin_inset Quotes eld
  1111. \end_inset
  1112. unfamiliar
  1113. \begin_inset Quotes erd
  1114. \end_inset
  1115. people and
  1116. \begin_inset Quotes eld
  1117. \end_inset
  1118. familiar strangers
  1119. \begin_inset Quotes erd
  1120. \end_inset
  1121. .
  1122. These labels were applied based on the number of times their Bluetooth
  1123. devices were detected
  1124. \begin_inset Foot
  1125. status collapsed
  1126. \begin_layout Plain Layout
  1127. and by extension the number of times the user had come into contact with
  1128. them
  1129. \end_layout
  1130. \end_inset
  1131. .
  1132. While the definition of
  1133. \begin_inset Quotes eld
  1134. \end_inset
  1135. familiar
  1136. \begin_inset Quotes erd
  1137. \end_inset
  1138. and
  1139. \begin_inset Quotes eld
  1140. \end_inset
  1141. unfamiliar
  1142. \begin_inset Quotes erd
  1143. \end_inset
  1144. are quite obvious,
  1145. \begin_inset Quotes eld
  1146. \end_inset
  1147. familiar strangers
  1148. \begin_inset Quotes erd
  1149. \end_inset
  1150. is a new class of people used to describe those who the user encounters
  1151. repeatedly, but doesn't interact with.
  1152. This may include neighbours that are passed on the street, or fellow commuters
  1153. on a journey into work.
  1154. The number of people in each of those groups (and any changes in those
  1155. numbers) can be used to infer how
  1156. \begin_inset Quotes eld
  1157. \end_inset
  1158. comfortable
  1159. \begin_inset Quotes erd
  1160. \end_inset
  1161. the user feels with their social context, and whether their current activity
  1162. is part of a normal routine or is novel.
  1163. \end_layout
  1164. \begin_layout Standard
  1165. This research has, to date, not been readily combined with activity-aware
  1166. applications, and this project will aim to integrate the results of Bluetooth
  1167. scanning with
  1168. \begin_inset Quotes eld
  1169. \end_inset
  1170. classical
  1171. \begin_inset Quotes erd
  1172. \end_inset
  1173. activity classification techniques and to evaluate whether it provides
  1174. any benefit.
  1175. \end_layout
  1176. \begin_layout Section
  1177. Power management
  1178. \begin_inset CommandInset label
  1179. LatexCommand label
  1180. name "sec:Power-management"
  1181. \end_inset
  1182. \end_layout
  1183. \begin_layout Standard
  1184. One major consideration when deploying an application on a mobile device
  1185. is the amount of power it will use.
  1186. An application constantly polling any one sensor can reduce battery life
  1187. significantly, and an application which kept all available sensors active
  1188. (in addition to doing CPU-heavy analysis on them) would drain the battery
  1189. in a typical smartphone in a matter of hours.
  1190. A context-aware application is not very useful for a user if they can only
  1191. use their telephone for an hour or two before it needs recharging!
  1192. \end_layout
  1193. \begin_layout Standard
  1194. One solution
  1195. \begin_inset CommandInset citation
  1196. LatexCommand cite
  1197. key "Wang2009"
  1198. \end_inset
  1199. is to only use one or two sensors to monitor the user's activity until it
  1200. appears to be transitioning.
  1201. For example, if the user is believed to be walking, the application only
  1202. needs to periodically check either the accelerometer (to confirm the user
  1203. is still making walking motions) or GPS (to confirm the distance traveled
  1204. is still consistent with walking) to know that their activity has not changed.
  1205. As soon as the user's behaviour becomes inconsistent with walking, the
  1206. application can bring other sensors online until it has successfully reclassifi
  1207. ed the activity, and then resume monitoring with minimal sensors.
  1208. \end_layout
  1209. \begin_layout Standard
  1210. Another option
  1211. \begin_inset CommandInset citation
  1212. LatexCommand cite
  1213. key "Wang2009"
  1214. \end_inset
  1215. (which can be used in conjunction) is to only enable sensors for a short
  1216. amount of time, and then sleep for a period before reactivating them.
  1217. The
  1218. \begin_inset Quotes eld
  1219. \end_inset
  1220. duty cycle
  1221. \begin_inset Quotes erd
  1222. \end_inset
  1223. suggested for accelerometers is 6 second of sensing followed by 10 seconds
  1224. of sleeping.
  1225. The six second window is enough time to allow for capturing a full range
  1226. of motion (several complete strides) if the user is walking or running,
  1227. and then the ten second sleep stops the accelerometer using battery power
  1228. until the next cycle.
  1229. This process obviously means that a sudden switch in activity will not
  1230. be noticed immediately, but a delay of a few seconds is acceptable as most
  1231. activities will last for minutes or longer.
  1232. \end_layout
  1233. \begin_layout Standard
  1234. The battery life on modern smartphones rarely exceeds 24 hours of typical
  1235. use, so it is extremely important that any applications developed for this
  1236. project does not significantly reduce this.
  1237. A balance between prompt detection and notification of activity changes
  1238. and battery use by sensors and processing algorithms will need to be found.
  1239. \end_layout
  1240. \begin_layout Standard
  1241. \begin_inset Newpage pagebreak
  1242. \end_inset
  1243. \end_layout
  1244. \begin_layout Part
  1245. Specification
  1246. \end_layout
  1247. \begin_layout Section
  1248. Experimentation
  1249. \begin_inset CommandInset label
  1250. LatexCommand label
  1251. name "sec:Experimentation"
  1252. \end_inset
  1253. \end_layout
  1254. \begin_layout Subsection
  1255. Battery use
  1256. \end_layout
  1257. \begin_layout Standard
  1258. The average lifetime of a typical Android mobile telephone will need to
  1259. be ascertained, taking into consideration typical day-to-day use of the
  1260. device and any additional battery drain caused by that.
  1261. The impact of sensor use on the battery lifetime needs to be calculated
  1262. or experimentally determined, and the effect of the algorithms described
  1263. in section
  1264. \begin_inset CommandInset ref
  1265. LatexCommand ref
  1266. reference "sec:Power-management"
  1267. \end_inset
  1268. needs to be quantified.
  1269. \end_layout
  1270. \begin_layout Standard
  1271. Once this is complete, a selection of algorithms and suitable parameters
  1272. should be made for use in the classifier application (section
  1273. \begin_inset CommandInset ref
  1274. LatexCommand ref
  1275. reference "sub:Classifier-application"
  1276. \end_inset
  1277. ).
  1278. The aim of the selection should be to ensure the best activity detection
  1279. whilst not severely reducing the device's battery life.
  1280. \end_layout
  1281. \begin_layout Subsection
  1282. Location analysis
  1283. \begin_inset CommandInset label
  1284. LatexCommand label
  1285. name "sub:Location-analysis"
  1286. \end_inset
  1287. \end_layout
  1288. \begin_layout Standard
  1289. As discussed in section
  1290. \begin_inset CommandInset ref
  1291. LatexCommand ref
  1292. reference "sec:Location-analysis"
  1293. \end_inset
  1294. , existing algorithms to detect interesting places rely on GPS signals not
  1295. being obtainable indoors, which is no longer true with current generation
  1296. GPS chipsets.
  1297. It may be possible to adapt these algorithms to work instead using the
  1298. GSM signal strength or number of locked GPS satellites.
  1299. The variance of these when inside and outside a building need to be investigate
  1300. d to determine if this is a feasible approach, or whether an alternate algorithm
  1301. needs to be used.
  1302. \end_layout
  1303. \begin_layout Standard
  1304. A suitable algorithm should be implemented which allows the user's activity
  1305. to be annotated with location-based context.
  1306. This would ideally take the form of a source and destination for mobile
  1307. activities, or location for static activities.
  1308. The goal is to be able to differentiate between
  1309. \begin_inset Quotes eld
  1310. \end_inset
  1311. walking to work
  1312. \begin_inset Quotes erd
  1313. \end_inset
  1314. and
  1315. \begin_inset Quotes eld
  1316. \end_inset
  1317. walking to the shop
  1318. \begin_inset Quotes erd
  1319. \end_inset
  1320. , although the labeling of places may be left to future work.
  1321. Unlabeled places (i.e., something akin to
  1322. \begin_inset Quotes eld
  1323. \end_inset
  1324. walking to place2
  1325. \begin_inset Quotes erd
  1326. \end_inset
  1327. and
  1328. \begin_inset Quotes eld
  1329. \end_inset
  1330. walking to place7
  1331. \begin_inset Quotes erd
  1332. \end_inset
  1333. instead of the previous examples) still allow for applications to tailor
  1334. their behaviour based on the user's previous activities at or when walking
  1335. to that place, so will be sufficient for an initial version.
  1336. \end_layout
  1337. \begin_layout Subsection
  1338. Bluetooth usage
  1339. \begin_inset CommandInset label
  1340. LatexCommand label
  1341. name "sub:Bluetooth-usage"
  1342. \end_inset
  1343. \end_layout
  1344. \begin_layout Standard
  1345. The algorithm for classifying familiar, unfamiliar, and
  1346. \begin_inset Quotes eld
  1347. \end_inset
  1348. familiar stranger
  1349. \begin_inset Quotes erd
  1350. \end_inset
  1351. Bluetooth devices (section
  1352. \begin_inset CommandInset ref
  1353. LatexCommand ref
  1354. reference "sec:Bluetooth"
  1355. \end_inset
  1356. ) should be implemented.
  1357. An experiment should then be conducted to determine whether or not the
  1358. data provides useful clues as to the user's context.
  1359. This will depend on the number of other people with Bluetooth discoverable
  1360. devices in the vicinity of the user.
  1361. \end_layout
  1362. \begin_layout Standard
  1363. If there are a sufficient number of discoverable devices, then the algorithms
  1364. should be included in the classifier application to provide additional
  1365. context.
  1366. \end_layout
  1367. \begin_layout Section
  1368. Deliverables
  1369. \begin_inset CommandInset label
  1370. LatexCommand label
  1371. name "sec:Deliverables"
  1372. \end_inset
  1373. \end_layout
  1374. \begin_layout Standard
  1375. The following items should be delivered:
  1376. \end_layout
  1377. \begin_layout Subsection
  1378. Context-aware Framework
  1379. \begin_inset CommandInset label
  1380. LatexCommand label
  1381. name "sub:Classifier-application"
  1382. \end_inset
  1383. \end_layout
  1384. \begin_layout Standard
  1385. An Android application which:
  1386. \end_layout
  1387. \begin_layout Itemize
  1388. monitors raw sensor data and extracts features from the device's:
  1389. \end_layout
  1390. \begin_deeper
  1391. \begin_layout Itemize
  1392. accelerometer sensors
  1393. \end_layout
  1394. \begin_layout Itemize
  1395. magnetic field sensors
  1396. \end_layout
  1397. \begin_layout Itemize
  1398. camera
  1399. \end_layout
  1400. \begin_layout Itemize
  1401. microphone
  1402. \end_layout
  1403. \end_deeper
  1404. \begin_layout Itemize
  1405. monitors relevant data and extracts features concerning:
  1406. \end_layout
  1407. \begin_deeper
  1408. \begin_layout Itemize
  1409. visible Bluetooth devices in proximity to the device
  1410. \end_layout
  1411. \begin_layout Itemize
  1412. the current location of the device
  1413. \end_layout
  1414. \begin_layout Itemize
  1415. the current GSM signal strength and cell ID
  1416. \end_layout
  1417. \end_deeper
  1418. \begin_layout Itemize
  1419. presents the user with a method of optionally annotating this data with
  1420. their current activity
  1421. \end_layout
  1422. \begin_layout Itemize
  1423. classifies the user's current activity using the extracted features and
  1424. a K-Nearest Neighbour algorithm
  1425. \end_layout
  1426. \begin_layout Itemize
  1427. enhances the classification with extra contextual data inferred from location
  1428. or Bluetooth service:
  1429. \end_layout
  1430. \begin_deeper
  1431. \begin_layout Itemize
  1432. the user's probable source and destination, if traveling
  1433. \end_layout
  1434. \begin_layout Itemize
  1435. the user's current location, if stationary
  1436. \end_layout
  1437. \begin_layout Itemize
  1438. the user's company, if detected
  1439. \end_layout
  1440. \end_deeper
  1441. \begin_layout Itemize
  1442. attempts to conserve battery life by intelligent management and timing of
  1443. sensor activity
  1444. \end_layout
  1445. \begin_layout Subsubsection
  1446. Interface
  1447. \end_layout
  1448. \begin_layout Standard
  1449. The application should provide two different interfaces to retrieve the
  1450. user's context.
  1451. The first should be an implementation of the Android ContentProvider interface.
  1452. This allows third party applications to query and retrieve data (in this
  1453. case, the user's probable activities and context) as and when they need
  1454. it.
  1455. \end_layout
  1456. \begin_layout Standard
  1457. The ContentProvider interface exposes data as a table.
  1458. The classifier application should therefore supply a unique ID for each
  1459. possible activity, the name of the activity (if labeled), the time the
  1460. activity was started, and the estimated uncertainty in the classification.
  1461. It should also expose relevant details of any context information, such
  1462. as related places (s
  1463. \begin_inset CommandInset ref
  1464. LatexCommand ref
  1465. reference "sub:Location-analysis"
  1466. \end_inset
  1467. ) or other participants (s
  1468. \begin_inset CommandInset ref
  1469. LatexCommand ref
  1470. reference "sub:Bluetooth-usage"
  1471. \end_inset
  1472. ).
  1473. \end_layout
  1474. \begin_layout Standard
  1475. The second interface should use Android broadcast Intents to notify any
  1476. interested application whenever the user's activity changes.
  1477. This will allow applications to be notified whenever the activity or context
  1478. of the user changes.
  1479. The Intent should contain a URI which corresponds to an entry in the table
  1480. returned by the ContentProvider, so applications can retrieve information
  1481. about the user's activity directly.
  1482. \end_layout
  1483. \begin_layout Standard
  1484. Whenever activities, places or participants are exposed in the interface,
  1485. they should be assigned an ID which remains consistent for the specified
  1486. activity, place or participant.
  1487. Applications can use this ID regardless of any annotations the user supplies.
  1488. For example, the first time an interesting place is detected it may be
  1489. assigned ID 42 and label
  1490. \begin_inset Quotes eld
  1491. \end_inset
  1492. place42
  1493. \begin_inset Quotes erd
  1494. \end_inset
  1495. , the user may then annotate this place as
  1496. \begin_inset Quotes eld
  1497. \end_inset
  1498. home
  1499. \begin_inset Quotes erd
  1500. \end_inset
  1501. , and some time later replace it with
  1502. \begin_inset Quotes eld
  1503. \end_inset
  1504. old house
  1505. \begin_inset Quotes erd
  1506. \end_inset
  1507. ; the ID will be consistent across all of these labels, so any application
  1508. using this information will continue to function.
  1509. \end_layout
  1510. \begin_layout Subsection
  1511. Activity condition for Locale
  1512. \end_layout
  1513. \begin_layout Standard
  1514. As a proof-of-concept, an application should be developed which provides
  1515. Locale
  1516. \begin_inset CommandInset citation
  1517. LatexCommand cite
  1518. key "TwoFortyFourAm2010"
  1519. \end_inset
  1520. , a popular Android application used to alter device settings and perform
  1521. actions based on certain conditions, with a new condition representing
  1522. the user's activity.
  1523. \end_layout
  1524. \begin_layout Standard
  1525. This will allow users to change their device settings based on their current
  1526. activity by creating rules within Locale.
  1527. Locale also allows users to post updates to popular social networking sites
  1528. such as Twitter and Facebook, so it will be possible for users to broadcast
  1529. their activities to their friends.
  1530. \end_layout
  1531. \begin_layout Subsection
  1532. Context-aware home screen
  1533. \end_layout
  1534. \begin_layout Standard
  1535. To demonstrate the utility of applications being context-aware, an application
  1536. will be developed that replaces the standard Android home screen.
  1537. It should dynamically adapt its layout and contents according to the user's
  1538. activity and other context information made available by the classifier
  1539. application.
  1540. \end_layout
  1541. \begin_layout Standard
  1542. The replacement home screen needs to allow users to browse and launch applicatio
  1543. ns, and should expose relevant (context-sensitive) notifications to the
  1544. user, including notifications of e-mails, missed calls, text messages and
  1545. upcoming appointments.
  1546. \end_layout
  1547. \begin_layout Subsection
  1548. User and developer guides
  1549. \end_layout
  1550. \begin_layout Itemize
  1551. A user guide for the classifier
  1552. \noun on
  1553. \noun default
  1554. application
  1555. \end_layout
  1556. \begin_layout Itemize
  1557. A user guide for the Locale condition provider
  1558. \end_layout
  1559. \begin_layout Itemize
  1560. A user guide for the Context-aware home screen
  1561. \end_layout
  1562. \begin_layout Itemize
  1563. A developer's guide for using the information exposed by the
  1564. \noun on
  1565. classifier
  1566. \noun default
  1567. application
  1568. \end_layout
  1569. \begin_layout Subsection
  1570. Website
  1571. \end_layout
  1572. \begin_layout Standard
  1573. A website should be created containing an overview of the applications,
  1574. instructions for both users and developers, and links to download the applicati
  1575. ons.
  1576. The website should explain the basic ideas behind activity and context
  1577. aware applications, and the specific techniques used in this project.
  1578. \end_layout
  1579. \begin_layout Standard
  1580. \begin_inset Newpage pagebreak
  1581. \end_inset
  1582. \end_layout
  1583. \begin_layout Part
  1584. Evaluation
  1585. \end_layout
  1586. \begin_layout Section
  1587. Reports
  1588. \end_layout
  1589. \begin_layout Standard
  1590. The results of the experimentation described in section
  1591. \begin_inset CommandInset ref
  1592. LatexCommand ref
  1593. reference "sec:Experimentation"
  1594. \end_inset
  1595. should be written up as a report.
  1596. The reports must include the data collected in each of the experiments,
  1597. the conclusions drawn from those, and the impact of the results of the
  1598. experiment on the project deliverables.
  1599. \end_layout
  1600. \begin_layout Section
  1601. Deliverables
  1602. \end_layout
  1603. \begin_layout Standard
  1604. On successful completion of the project, there should be three deliverable
  1605. applications as specified in section
  1606. \begin_inset CommandInset ref
  1607. LatexCommand ref
  1608. reference "sec:Deliverables"
  1609. \end_inset
  1610. .
  1611. These can be tested and evaluated in a variety of manners:
  1612. \end_layout
  1613. \begin_layout Subsection
  1614. Unit tests
  1615. \end_layout
  1616. \begin_layout Standard
  1617. Throughout the development of the project, unit tests should be created
  1618. to test key functionality of all applications.
  1619. It is expected that at the completion of the project, all unit tests should
  1620. pass successfully, and they will have a code coverage of 80% or above.
  1621. \end_layout
  1622. \begin_layout Subsection
  1623. System tests
  1624. \end_layout
  1625. \begin_layout Standard
  1626. The classifier application should also have a suite of system tests.
  1627. These should consist of a set of fake or pre-recorded inputs which are
  1628. fed into the application in place of raw sensor data.
  1629. The output of the classifier (via the API) can then be compared to expected
  1630. output for the data.
  1631. \end_layout
  1632. \begin_layout Subsection
  1633. User acceptance testing
  1634. \end_layout
  1635. \begin_layout Standard
  1636. The Locale addon and context-aware home screen should be subject to user
  1637. acceptance testing for evaluation.
  1638. This should take the form of providing the applications to multiple end
  1639. users, allowing them to use them for a period of time (providing instructions
  1640. for certain tasks to complete).
  1641. The users should then be presented with a questionnaire which they can
  1642. use to evaluate the functionality, utility and design of the applications.
  1643. \end_layout
  1644. \begin_layout Subsubsection
  1645. Android market
  1646. \end_layout
  1647. \begin_layout Standard
  1648. In addition to providing the applications to a closed set of users, the
  1649. applications should be published to the Android market.
  1650. This will allow any owner of a compatible Android device to download and
  1651. use the applications.
  1652. The market also allows users to rate the application and leave comments,
  1653. which will be an extremely useful method of evaluating the success of the
  1654. applications.
  1655. \end_layout
  1656. \begin_layout Standard
  1657. As part of this, the classifier application/framework will be published,
  1658. and should include instructions for developers detailing how they can make
  1659. their applications context-aware.
  1660. The interest expressed and number of applications which use it (if any)
  1661. will be an indicator of the effectiveness of the API and its documentation.
  1662. \end_layout
  1663. \begin_layout Subsection
  1664. Classification scope
  1665. \end_layout
  1666. \begin_layout Standard
  1667. The classifier should be able to classify the following activities:
  1668. \end_layout
  1669. \begin_layout Itemize
  1670. walking
  1671. \end_layout
  1672. \begin_layout Itemize
  1673. running
  1674. \end_layout
  1675. \begin_layout Itemize
  1676. standing
  1677. \end_layout
  1678. \begin_layout Itemize
  1679. sitting
  1680. \end_layout
  1681. \begin_layout Itemize
  1682. traveling in a vehicle
  1683. \end_layout
  1684. \begin_layout Standard
  1685. These should be evaluated by means of a leave-one-out cross-validation test,
  1686. with data collected from one or more users and annotated by hand.
  1687. It is expected that the classifier should correctly classify all activities
  1688. with an accuracy of at least 70%, within 30 seconds of the activity being
  1689. started.
  1690. \end_layout
  1691. \begin_layout Subsection
  1692. Resource usage
  1693. \end_layout
  1694. \begin_layout Standard
  1695. Finally, the applications should be evaluated based on their resource usage.
  1696. One of the main concerns will be battery usage (caused both by the application
  1697. using processor time, and activating sensors), but attention must also
  1698. be paid to memory consumption (especially after extended use).
  1699. The goal should be to ensure that the resource usage of the applications
  1700. in this project do not adversely impact the functionality of the device;
  1701. that is, battery life should not be reduced so significantly that it requires
  1702. users to change their normal charging behaviour, and memory usage should
  1703. not be so high as to cause other applications to become sluggish or be
  1704. closed by the operating system.
  1705. \begin_inset Newpage pagebreak
  1706. \end_inset
  1707. \end_layout
  1708. \begin_layout Standard
  1709. \begin_inset CommandInset bibtex
  1710. LatexCommand bibtex
  1711. bibfiles "/home/chris/Uni/project/papers/project"
  1712. options "bibtotoc,savetrees"
  1713. \end_inset
  1714. \end_layout
  1715. \end_body
  1716. \end_document