12
Lightweight Modeling of User Context Combining Physical and Virtual Sensor Data Mattia Giovanni Campana IIT-CNR Pisa, Italy [email protected] Franca Delmastro IIT-CNR Pisa, Italy [email protected] Dimitris Chatzopoulos HKUST Hong Kong [email protected] Pan Hui HKUST and University of Helsinki Hong Kong and Helsinki [email protected] Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. ACM. UbiComp/ISWC’18 Adjunct,, October 8–12, 2018, Singapore, Singapore ACM 978-1-4503-5966-5/18/10. https://doi.org/10.1145/3267305.3274178 Abstract The multitude of data generated by sensors available on users’ mobile devices, combined with advances in machine learn- ing techniques, support context-aware services in recogniz- ing the current situation of a user (i.e., physical context) and optimizing the system’s personalization features. However, context-awareness performances mainly depend on the ac- curacy of the context inference process, which is strictly tied to the availability of large-scale and labeled datasets. In this work, we present a framework developed to collect datasets containing heterogeneous sensing data derived from per- sonal mobile devices.The framework has been used by 3 vol- untary users for two weeks, generating a dataset with more than 36K samples and 1331 features. We also propose a lightweight approach to model the user context able to ef- ficiently perform the entire reasoning process on the user mobile device. To this aim, we used six dimensionality reduc- tion techniques in order to optimize the context classification. Experimental results on the generated dataset show that we achieve a 10x speed up and a feature reduction of more than 90% while keeping the accuracy loss less than 3%. Author Keywords Context-awareness; mobile computing; machine learning ACM Classification Keywords [Human-centered computing]: Mobile computing 1309

Lightweight Modeling of User Context Combining Physical ... · [email protected] Franca Delmastro IIT-CNR Pisa, Italy [email protected] Dimitris Chatzopoulos HKUST Hong Kong

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

Lightweight Modeling of User ContextCombining Physical and VirtualSensor Data

Mattia Giovanni CampanaIIT-CNRPisa, [email protected]

Franca DelmastroIIT-CNRPisa, [email protected]

Dimitris ChatzopoulosHKUSTHong [email protected]

Pan HuiHKUST and University ofHelsinkiHong Kong and [email protected]

Permission to make digital or hard copies of all or part of this work for personal orclassroom use is granted without fee provided that copies are not made or distributedfor profit or commercial advantage and that copies bear this notice and the full citationon the first page. Copyrights for components of this work owned by others than ACMmust be honored. Abstracting with credit is permitted. To copy otherwise, or republish,to post on servers or to redistribute to lists, requires prior specific permission and/or afee. Request permissions from [email protected].

ACM.UbiComp/ISWC’18 Adjunct,, October 8–12, 2018, Singapore, SingaporeACM 978-1-4503-5966-5/18/10.https://doi.org/10.1145/3267305.3274178

AbstractThe multitude of data generated by sensors available on users’mobile devices, combined with advances in machine learn-ing techniques, support context-aware services in recogniz-ing the current situation of a user (i.e., physical context) andoptimizing the system’s personalization features. However,context-awareness performances mainly depend on the ac-curacy of the context inference process, which is strictly tiedto the availability of large-scale and labeled datasets. In thiswork, we present a framework developed to collect datasetscontaining heterogeneous sensing data derived from per-sonal mobile devices.The framework has been used by 3 vol-untary users for two weeks, generating a dataset with morethan 36K samples and 1331 features. We also propose alightweight approach to model the user context able to ef-ficiently perform the entire reasoning process on the usermobile device. To this aim, we used six dimensionality reduc-tion techniques in order to optimize the context classification.Experimental results on the generated dataset show that weachieve a 10x speed up and a feature reduction of more than90% while keeping the accuracy loss less than 3%.

Author KeywordsContext-awareness; mobile computing; machine learning

ACM Classification Keywords[Human-centered computing]: Mobile computing

1309

Page 2: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

IntroductionThe pervasive nature of smart mobile devices, and the plethoraof sensors they are equipped with, enabled the developmentof context-aware systems that can support a variety of per-sonalized services. Example applications include healthcareand well-being [36], human activity recognition [43], intelli-gent transportation systems [40], personal assistant devel-opment [38], IoT environments [35], and recommender sys-tems [2]. Dey et. al. defined user context as the informationneeded to characterize the situation in which a person is in-volved [20]. Consequently, context-awareness refers to theability of a system to adapt and respond proactively to thechanges in the users’ situation.

Figure 1: Stages of the usercontext inference process.

Fig. 1 depicts the common stages required to infer the usercontext from raw sensors data [42]. First, the collected dataare modeled and preprocessed to better represent the con-text information. During this stage, several aspects of thecontext must be considered (e.g., heterogeneity, compara-bility, and asynchronous sensors) in order to produce morereliable data for the further processing steps. Then, a featurevector is built by extracting those information from the sen-sors data that better characterizes the user context. Finally,the feature vector is used as input of a context reasoningmodule that infers more abstract information such as the situ-ation in which the user is currently involved. The context rea-soning module is often represented by a machine learningmodel (e.g., classifier) trained by using the supervised learn-ing approach. The performance of this algorithms stronglydepends on the availability of a large amount of labeled data.In fact, in order to correctly infer the user context, the learn-ing algorithm requires to process a large set of sensors data(i.e., training set), where each sample is associated with alabel that describes its semantic meaning.However, collecting real data for the training phase can becostly or even impractical in some cases, since it requiresto develop specific applications to obtain sensors data and

then, to manually label them. In order to cope with thisproblem, we present Context Kit (CK ), a sensing frameworkdesigned to perform large-scale sensing experiments andto easily collect data from real mobile devices. CK sup-ports the collection of data related to physical sensors (e.g.,accelerometer, gyroscope) and to the user interaction withthe mobile device (e.g., app usage statistics, phone calls,and connected devices). This information mainly character-izes the user physical context. Most of the publicly availabledatasets take into account only a small set of physical sen-sors. Even though they could be successfully used to recog-nize standard human activities (e.g., “running" or “sitting"),they are not suitable to recognize the user’s situation (e.g.,“having a coffee" or “studying") that is generally character-ized by more complex and abstract information.CK allows us to collect heterogeneous context data from realmobile devices. It has been recently used by 3 users for2 weeks and the collected dataset is composed by 36354labeled samples, each of them composed by 1331 features.We publicly release both CK and the collected dataset on thefollowing website: https://contextkit.github.io.Another challenging problem related to context-aware sys-tems is represented by both context modeling and reason-ing stages. The context reasoning is executed wheneverthe context of the user needs to be recognized. Althoughthe model’s training can be executed remotely, on power-ful servers, the classification phase needs to be executedlocally on the mobile device, and for that reason, it has tobe lightweight. Computation offloading mechanisms can beused to perform the classification on remote servers, but thismay generate monetary costs (for the use of the server andthe data transmission) or poor quality of experience causedby mobile ads. In addition, the use of remote servers orcloud-based services may demotivate privacy-aware usersto use context-aware services, since a third party entity willbe in charge of storing users’ personal data [15, 37]. More-

1310

Page 3: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

over, depending on the communication technology, the delayof the data transmission may make the classification use-less with respect to the service optimization, since the usercould have changed her context in the meanwhile. Basedon this observations, we argue that the classification pro-cess should be executed locally on the mobile devices andproduce results in the order of milliseconds. To this aim, inthis paper we also propose a lightweight approach to modelthe user context in order to speed up the context reasoningprocess and perform the entire computation on the local de-vice. Traditional context-aware systems heavily rely on hand-crafted features, which are limited to human domain knowl-edge and can affect their generalization performance [5]. Onthe contrary, we propose the use of latent features startingfrom a high number of heterogeneous sensed data to speedup the classification process and allow its local execution onthe mobile device. Latent features represent hidden con-text patterns modeled as numeric vectors that are extractedfrom raw sensor data and can be automatically inferred usingDimensionality Reduction (DR) techniques in a data-drivenway. We investigate if it is possible to reach the same ac-curacy level obtained with the raw features using those ex-tracted by six well-known DR techniques.In summary, our contribution in this paper is threefold. First,we propose a new framework to perform large-scale sensingexperiments and to easily collect raw context data. Second,we release a real and labeled dataset which contains datafrom both physical and virtual sensors collected by a setof heterogeneous smartphones. Third, we propose a newmethodology to model the raw context data using latent fea-tures in order to speed up the context reasoning process andperform the entire computation on the local device.

Related Work and Main ContributionNowadays, context-awareness is a fundamental requirementto develop ubiquitous and pervasive systems. The main goal

of these systems is to infer the user context from differentsensors to provide autonomous and proactive services to thefinal user. According to Bettini et. al [6], the term "sensor"can describe not only the physical device (e.g., accelerom-eter or GPS), but also any kind of data source that can beuseful to characterize the user context; in the latter case,we refer to this kind of data source as virtual sensors [42].We can consider as virtual sensors data the application us-age statistics, the ringtone level (e.g., if the smartphone isin silent mode, probably the user is busy), and the displaystatus. In this section we discuss the characteristics of state-of-the-art solutions related to different aspects of the con-text inference process, highlighting how the combination ofphysical and virtual sensors improves the process and theadvantages introduced by our proposal.

Context InformationMost of the context-aware solutions proposed in the literaturefocus on few sensor data for inferring the user context. Forinstance, keeping into account only the accelerometer datais a common practice for the user’s gait recognition and falldetection [1, 26, 32], while the GPS coordinates and the listof Wi-Fi access points are commonly used to infer the cur-rent location of the user and her social interactions [16, 19].Even though a small set of sensors could be sufficient to rec-ognize standard human activities (often requiring complex al-gorithms), inferring more abstract information like the user’ssituation requires the combination of several heterogeneoussensors. To this aim, we propose to characterize the usercontext using a large set of sensors commonly available oncommercial mobile devices. Specifically, we define the user’ssituation based on the combination of the following physicaland virtual sensors: the user’s current gait (e.g., walking oron bicycle); time’s information (e.g., morning/night, or week-day/weekend); the list of running applications, informationrelated to the device’s audio status (e.g., ringtone level, or

1311

Page 4: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

connected earphones); weather conditions; battery level; ifthe device is plugged into a power source; list of connectedBluetooth (BT) devices; display status (i.e., on/off, and ro-tation angle); GPS location; if the device is connected to aWi-Fi Access Point; physical sensors data (e.g., gyroscope,accelerometer, and light); devices in proximity (both via BTand Wi-Fi Direct); and if the user is using the camera for tak-ing a picture or recording a video.

Context AcquisitionIn order to assist the collection of sensing data from commer-cial mobile devices, several sensing frameworks have beenrecently proposed in the literature. Funf [3] is one of the first;it allows to easily activate and deactivate sensor monitoringthrough a configuration file, but its maintenance is discontin-ued and its support for recent mobile operating systems isvery limited. SensingKit [28] is a more recent project pro-posed by the Queen Mary University of London. It is a multi-platform framework (i.e., iOS and Android), but it does notsupport useful sensors (e.g., Wi-Fi Direct) or to query ex-ternal services to obtain additional information that can beuseful to characterize the user context (e.g., weather condi-tions). In order to cope with these limitations, we propose anew sensing framework specially designed to perform large-scale sensing experiments with mobile devices. Our frame-work allows data collection from several sensors (both phys-ical and virtual) to characterize the user context and it imple-ments some unique features that are not available in othersimilar frameworks. For instance, it supports the usage ofdifferent external data sources, such as OpenWeatherMap(https://openweathermap.org) to download the weather condi-tions of the geographical area in which the user is located. Inaddition, CK exploits both BT 4.0 and Wi-Fi Direct to estimatethe proximity between different devices (e.g., smartphones,IoT devices, external sensors or Wi-Fi Access Points). Infact, proximity information can be used to further character-

ize the user physical context, both in terms of location andpossible interactions with other users or devices [8].

Context ModelingRaw sensor data must be modeled to infer a more abstractrepresentation of the user context (i.e., the user’s situation).The most challenging part of the context modeling processis the identification of the sensor information that is the mostdescriptive of the user context [34]. Traditional approachesfocus on modeling the context information using softwareengineering formalisms such as ontology-based technolo-gies (e.g., RDF [21], graphical models (e.g., UML [24] orORM [22]), and OWL [41]), or simple mark-up schemes (e.g.,XML [29]). Each of them has several pros and cons in termsof different aspects (e.g., expressive power of the model,complexity), and they can also affect the computation perfor-mance and scalability of the context reasoning process [6,42]. Moreover, defining these models is a time-consumingtask and requires to manually identify the best set of fea-tures to characterize the user context. On the other hand,raw data coming directly from sensors may contain irrelevantor redundant features that may affect the performance of thecontext classification.In order to cope with these drawbacks, instead of using time-consuming models or manually feature selections, we pro-pose to learn a compact representation of raw sensor infor-mation in a data-driven way. More specifically, we use thefollowing DR techniques: (i) Autoencoder (AE) [25], a specialclass of Artificial Neural Networks that uses hidden layers ofneurons to learn a non-linear and compressed representa-tion of the input data; (ii) Non-Negative Matrix Factorization(NMF) [27], which decomposes the original feature spaceinto two non-negative matrices that can be applied to reducethe dimensionality of the original feature space; (iii) FeatureAgglomeration (FA) [17], which uses a recursively approachto merge the features that look similar in a hierarchical way;

1312

Page 5: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

(iv) Principal Component Analysis (PCA) [33], which exploitsthe eigenvalue decomposition of the data covariance matrixto suggest an eigenvector along which the projection of datashould have the minimal distortion; and (v - vi) Random Pro-jection (either Sparse -SRP- or Gaussian -GRP-) [7], whichrepresent a quicker alternative to the PCA, where the originalfeature space is projected to a lower subspace using a ran-dom kernel matrix. In this work, we explore the use of theseDR techniques to automatically extract the most relevant fea-tures from the raw data and to speed up the recognition ofthe user context in order to perform the entire computationon the local mobile device.

Figure 2: High-level architectureof the Context Kit framework.

Context ReasoningContext Reasoning (CR) represents the core of the inferenceprocess. Most of the CR approaches proposed in the litera-ture use supervised learning algorithms to learn a classifierfrom raw sensor data like the following: i) k-Nearest Neighbor(k-NN) [18], which predicts the label of any new sample x byrunning majority vote among its k > 1 nearest neighbors; ii)Support Vector Machines (SVM) [23], a binary classifier thatlearns the hyperplane maximizing the margin between sam-ples of different classes; and iii) Classification and Regres-sion Tree (CART) [9], which breaks down the feature spacein a way to minimize the misclassification error. Here, webenchmark these three classifiers both in terms of classifi-cation accuracy and execution time. Moreover, we comparetheir ability to correctly classify the user context using boththe raw sensor data and the features learned by the afore-mentioned DR techniques.

Context DatasetsThe performance of supervised learning algorithms mostlydepends on the availability of labeled data [42]. However,most of the publicly available datasets (e.g., UMA Fall [10],UniMiB SHAR [32], and RealWorld (HAR) [39]) take into ac-

count only a limited number of sensors since their main pur-pose is to assist the creation of models for specific activityrecognition (e.g., user’s gait and fall detection). Therefore,these datasets are not suitable for learning a model able toinfer the user’s current situation. In this work, we presenta new dataset of labeled context data acquired with an An-droid application created on top of CK sensing framework.In order to obtain a real dataset, we avoid to perform thedata acquisition in controlled environments (e.g., lab), andwe enrolled a set of voluntary users equipped with heteroge-neous commercial mobile devices, with different character-istics and sensors. The users signed an informed consentincluding all the policies adopted for personal data storage,management and analysis, including the publication of theanonymized dataset, according to the EU GDPR regulation.

Context Kit and DatasetCK (depicted in Fig. 2) is designed to collect a high varietyof sensors data, configurable depending on the experiment’srequirements. To this aim, it implements every sensing cat-egory as an independent module, which can be activatedor deactivated by using a configuration file. When CK is run-ning, sensor data are stored in different log files (one for eachsensing module) and saved on the device’s hard drive. Fi-nally, in order to simplify the data collection from several de-vices, CK includes also a network module which compressesand sends the log files to a specified remote endpoint.

Context Labeler and Data acquisitionResearch studies in the area of activity recognition and hu-man behavior modeling base their results on experimentsperformed in controlled environments (e.g., a research lab-oratory) [32]. During the data collection process (often per-formed with the same device), some volunteers are asked toperform some activities that have been previously defined byresearchers. However, in the real world we have heteroge-

1313

Page 6: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

neous devices and different users may have different ways ofdoing the same activity; thus the experimental results usuallydiverge from those obtained in the lab [31].

Figure 3: UI of the ContextLabeler app.

In order to build a real dataset, we have developed an An-droid application called Context Labeler that includes the CKframework as a library and allows to associate predefinedlabels with the collected context data. We asked three vol-unteers to install Context Labeler on their own smartphonesand to select their daily life activities from the list of prede-fined labels (depicted in Fig. 3). After the activity selection,Context Labeler starts the CK framework that monitors thecontext data unobtrusively in the background. When the cur-rent activity ends, the user manually stops the data readingusing a specific button, and both the sensed data and theselected label are stored into the device’s hard drive.By using Context Labeler, we collected the context data fromthe following devices: a Nexus 5 with Android 6.0.1, a XiaomiMi 5 with Android 7.1.2, and a Reader P10 with Android 6.0.In addition, to avoid introducing biases during the data acqui-sition, we did not define any constraints for the user behaviorduring the experiment. On the contrary, we encouraged thevolunteers to use their smartphones without worrying aboutthe positions of the device (e.g., trousers’ pockets, or hand).

Dataset GenerationDifferent sensors or events monitored by CK may have dif-ferent sampling rates. Therefore, even if two different sen-sor data refer to the same situation, they may have differ-ent timestamps. Moreover, each label collected by ContextLabeler is stored, together with its duration, in a separatedlog file. In order to generate the data samples required forthe context reasoning phase, we process the log files as de-picted in Fig. 4. First, we use a sliding window to split theduration of each activity into slots of 1 second each. Sec-ond, for every time slot, we fetch from the log files only thesensor data with the closest reading timestamp to the start-

Figure 4: Scheme of the data processing used to generate thefinal dataset.

ing time of the current slot. Then, we enrich the raw featureswith additional categorical information. For example, usingthe Foursquare APIs (https://developer.foursquare.com), we ex-tend the location features retrieving the category of the mostprobable venue according to the GPS coordinates. Finally,we represent the categorical features (e.g., location cate-gory) using the well-known One Hot Encoding technique,and we combine them with the continuous features derivedfrom physical sensor values, by associating the correspond-ing situation’s label. The resulting dataset contains 36354labeled samples, with 1331 features per sample.

EvaluationThe main goal of the experimental evaluation is to find acombination of classifier and DR technique that can rapidlydetect the user physical context with a high accuracy, whileperforming the entire computation on the local device. Tothis aim, we run four different experiments. In the first exper-iment, we measure the classification accuracy of the threeclassifiers. We initially calculate the accuracy by using the

1314

Page 7: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

raw feature vectors. Then, we examine the accuracy of theclassifiers after the DR techniques application to automati-cally select the most relevant features and reduce the sizeof the data samples. In the second experiment, we measurethe time each DR technique needs to reduce the dimensionsof all the data samples in the dataset. Then, we calculatethe time required to train and test each classifier by usingthe DR techniques and the raw data. Finally, we performa subject-independent cross-validation, in which the trainingset consists of the dataset samples generated by users notincluded in the test set [32].

100

6001K

6K

12K

Hom

e

Work

ing

Sleep

Restau

rant

Break

Lunch

Free tim

e

Shoppin

g

# o

f S

ample

s

Figure 5: Distribution of thelabels in our dataset.

1K

2K

5K

10K

Hom

e

Work

ing

Sleep

Restau

rant

Break

Lunch

Free tim

e

Shoppin

g

# o

f S

ample

s

Train SetTest Set

Figure 6: Distribution of the trainand the test labels after theoversampling.

Dataset balanceSince we are proposing a supervised approach, we first pro-cess the collected dataset to produce the train and test sets.Fig. 5 shows the labels distribution of the data samples inour dataset. It is worth noting that the distribution is highlyskewed, where some classes appear more frequently thanothers. This problem is a well-studied phenomenon in theliterature, known as the “Imbalanced dataset problem” and itappears in many real-world datasets [30]. Imbalanced datasetscan negatively influence the generalization and reliability ofsupervised learning algorithms, since the resulting classi-fiers may be biased by the majority classes. In order tobalance our dataset, we employ the SMOTE algorithm [14],an oversampling technique that creates new synthetic datasamples in the minority classes, varying the features valuesof the existing data points based on their k nearest neigh-bors in the feature space. After the dataset balancing, werandomly split the dataset in training (80%, 78841 samples)and test (20%, 19711 samples) sets. Fig. 6 shows the distri-butions of the train and test sets after the oversampling.

Classification Accuracy In the first experiment we comparethe six DR techniques, in terms of classification accuracy,when used as preprocessing step on the three selected clas-

sifiers. As a first step, we calculate the accuracy level ob-tained by raw features and we note that all classifiers reachabout 99% accuracy by using the raw data.Then, we test the combination of our models with the six DRapproaches in order to evaluate the impact of using latentfeatures on the overall accuracy.Fig. 7 shows the classification accuracy of each classifier fora different number of latent features produced by the six DRtechniques. It is worth noting that k-NN and CART achievesimilar results to those obtained with raw data by employinga limited number of latent features produced by DR tech-niques, while SVM performs at least 10% worse.

DR Time PerformanceContinuing the previous experiment we examine the timeneeded by six DR techniques to produce the latent featuresby using all the samples in our dataset. According to the re-sults depicted in Fig. 8, we can classify the DR techniques inthree categories: i) SRP and GRP run in milliseconds, ii) AEand PCA in a few seconds, and iii) FA and NMF in minutes. Itis worth noting that the time needed by NMF increases withthe number of latent features, while the others have nearly aconstant execution time.

Classification Time PerformanceBased on the results obtained in the first experiment, we se-lect for each DR technique the number of features which al-lows each classifier to obtain the best classification accuracy.For instance, the number of latent features for CART andAE is 25, with 97% of classification accuracy. Then, by us-ing these values, we compared the three classifiers in termsof execution times for both the train and test phases. Wepresent the produced results in Fig. 9. As expected, the clas-sifiers have their worst performance on the raw data (with k-NN requiring more than 16 minutes for testing) since they areconsidering more features. k-NN maintains the higher execu-

1315

Page 8: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

tion times (less than 1 minute) for the test phase, while per-forming better in the training phase. Instead, CART achievesthe best performance in testing even though it requires moretime for training, but still in the order of few seconds.

0.86

0.88

0.9

0.92

0.94

0.96

0.98

1

0 10 20 30 40 50 60 70 80 90 100

k-NN

Acc

ura

cy

# of latent features

PCANMFGRP

SRPFAAE

RAW

0.86

0.88

0.9

0.92

0.94

0.96

0.98

1

0 10 20 30 40 50 60 70 80 90 100

CARTAcc

ura

cy

# of latent features

0.4

0.5

0.6

0.7

0.8

0.9

1

0 10 20 30 40 50 60 70 80 90 100

SVM

Acc

ura

cy

# of latent features

Figure 7: Classificationaccuracy with raw and latentfeatures.

0.01

0.1

1

10

50

500

0 10 20 30 40 50 60 70 80 90 100

Tim

e (

seconds)

# of latent features

PCANMF

GRPSRP

FAAE

Figure 8: Dimensionalityreduction execution time.

Subject-Independent Cross-Validation AccuracyThe main goal of this experiment is to evaluate the expres-sive power of the latent features. In other words, we wantto test if the latent features extracted by the DR techniquesare able to generalize the different contexts, independentlyof the user who generated the training data. To this aim, thetraining set is made of dataset samples generated by usersnot included in the test set [32]. From the results depicted inFig. 10 is evident the accuracy reduction with respect to thefirst experiment due to the characteristics of the supervisedlearning approach. However, even though all classifiers havelost about 50% of accuracy, they still perform approximately3 times better than a Random Guesser (i.e., a classifier whorandomly predicts the label). Interestingly, in this experimentall the classifiers perform better using the latent features in-stead of the raw data. This proves the capability of the DRtechniques to infer a set of features able to correctly repre-sent single situations independently of the behavioral pat-terns of the specific users.

Conclusions and future workIn this work, we present a new framework to collect physicaland virtual sensor data from personal mobile devices. Wehave used the framework to collect a real dataset composedof more 36K samples and 1331 features. Based on thisdataset, we have conducted four experiments to evaluate alightweight approach to model the user context and speed upthe context reasoning process. Experimental results showthat the entire context reasoning process can be performedon the local mobile device by appropriately selecting a clas-sifier and dimensionality reduction techniques. We are plan-

0.001

0.01

0.1

1

10

100

1000

RAW AE NMF FA PCA SRP GRP

Tim

e (

seconds)

k-NN (tr)k-NN (t)

SVM (tr)SVM (t)

CART (tr)CART (t)

Figure 9: Classifiers execution times.

0

0.1

0.2

0.3

0.4

0.5

RAW AE NMF FA PCA SRP GRP

Random Guesser

Acc

ura

cy

k-NN SVM CART

Figure 10: Subject-Independent Classification accuracy.

ning to integrate the proposed approach in a middleware so-lution we defined for the development of context-aware rec-ommender systems in mobile opportunistic environments [4,11, 12, 13]. Here, mobile systems and applications can relyonly on the local information provided by user mobile devicesand intermittent wireless connectivity among them. There-fore, users’ context is highly dynamic and wireless communi-cations among mobile devices to exchange and share dataare limited in time due to users’ mobility. In this scenario, alightweight modeling of user physical context will improve thepersonalization of recommendations.

AcknowledgementsThe authors would like to thank Reza Hadi Mogavi for hisuseful suggestions related to the machine learning techniquesused in this work. This research was carried out in the frame-work of the INTESA project (CUP CIPE D78I16000010008),co-funded by the Tuscany Region (Italy) and MIUR under theProgramme FAR FAS 2007-2013, and by projects 26211515and 16214817 from the Research Grants Council of HongKong.

1316

Page 9: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

REFERENCES1. Saeed Abdullah, Nicholas D Lane, and Tanzeem

Choudhury. 2012. Towards Population Scale ActivityRecognition: A Framework for Handling Data Diversity..In AAAI.

2. Gediminas Adomavicius and Alexander Tuzhilin. 2015.Context-Aware Recommender Systems. Springer US,Boston, MA, 191–226. DOI:http://dx.doi.org/10.1007/978-1-4899-7637-6_6

3. Nadav Aharony, Wei Pan, Cory Ip, Inas Khayal, andAlex Pentland. 2011. Social fMRI: Investigating andShaping Social Mechanisms in the Real World.Pervasive Mob. Comput. 7, 6 (Dec. 2011), 643–659.DOI:http://dx.doi.org/10.1016/j.pmcj.2011.09.004

4. Valerio Arnaboldi, Mattia G. Campana, FrancaDelmastro, and Elena Pagani. 2017. A personalizedrecommender system for pervasive social networks.Pervasive and Mobile Computing 36 (2017), 3 – 24.DOI:http://dx.doi.org/https://doi.org/10.1016/j.pmcj.2016.08.010 SpecialIssue on Pervasive Social Computing.

5. Yoshua Bengio. 2013. Deep learning ofrepresentations: Looking forward. In InternationalConference on Statistical Language and SpeechProcessing. Springer, 1–37.

6. Claudio Bettini, Oliver Brdiczka, Karen Henricksen,Jadwiga Indulska, Daniela Nicklas, AnandRanganathan, and Daniele Riboni. 2010. A survey ofcontext modelling and reasoning techniques. Pervasiveand Mobile Computing 6, 2 (2010), 161–180.

7. Ella Bingham and Heikki Mannila. 2001. RandomProjection in Dimensionality Reduction: Applications to

Image and Text Data. In Proceedings of the SeventhACM SIGKDD International Conference on KnowledgeDiscovery and Data Mining (KDD ’01). ACM, New York,NY, USA, 245–250. DOI:http://dx.doi.org/10.1145/502512.502546

8. Tjeerd W Boonstra, Mark E Larsen, and HelenChristensen. 2015. Mapping dynamic social networksin real life using participants’ own smartphones. Heliyon1, 3 (2015), e00037.

9. Leo Breiman. 2017. Classification and regression trees.Routledge.

10. Eduardo Casilari, Jose Antonio Santoyo-Ramón, andJose Manuel Cano-García. 2016. Analysis of asmartphone-based architecture with multiple mobilitysensors for fall detection. PLoS one 11, 12 (2016),e0168069.

11. D. Chatzopoulos, M. Ahmadi, S. Kosta, and P. Hui.2016. OPENRP: a reputation middleware foropportunistic crowd computing. IEEE CommunicationsMagazine 54, 7 (July 2016), 115–121. DOI:http://dx.doi.org/10.1109/MCOM.2016.7509388

12. D. Chatzopoulos, M. Ahmadi, S. Kosta, and P. Hui.2018. FlopCoin: A Cryptocurrency for ComputationOffloading. IEEE Transactions on Mobile Computing17, 5 (May 2018), 1062–1075. DOI:http://dx.doi.org/10.1109/TMC.2017.2748133

13. Dimitris Chatzopoulos and Pan Hui. 2016. ReadMe: AReal-Time Recommendation System for MobileAugmented Reality Ecosystems. In Proceedings of the2016 ACM on Multimedia Conference (MM ’16). ACM,New York, NY, USA, 312–316. DOI:http://dx.doi.org/10.1145/2964284.2967233

1317

Page 10: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

14. Nitesh V Chawla, Kevin W Bowyer, Lawrence O Hall,and W Philip Kegelmeyer. 2002. SMOTE: syntheticminority over-sampling technique. Journal of artificialintelligence research 16 (2002), 321–357.

15. Deyan Chen and Hong Zhao. 2012. Data security andprivacy protection issues in cloud computing. InComputer Science and Electronics Engineering(ICCSEE), 2012 International Conference on, Vol. 1.IEEE, 647–651.

16. Yohan Chon, Nicholas D Lane, Fan Li, Hojung Cha, andFeng Zhao. 2012. Automatically characterizing placeswith opportunistic crowdsensing using smartphones. InProceedings of the 2012 ACM Conference onUbiquitous Computing. ACM, 481–490.

17. P. M. Ciarelli and E. Oliveira. 2009. Agglomeration andElimination of Terms for Dimensionality Reduction. In2009 Ninth International Conference on IntelligentSystems Design and Applications. 547–552. DOI:http://dx.doi.org/10.1109/ISDA.2009.9

18. T. Cover and P. Hart. 1967. Nearest neighbor patternclassification. IEEE Transactions on Information Theory13, 1 (January 1967), 21–27. DOI:http://dx.doi.org/10.1109/TIT.1967.1053964

19. Manlio De Domenico, Antonio Lima, and MircoMusolesi. 2013. Interdependence and predictability ofhuman mobility and social interactions. Pervasive andMobile Computing 9, 6 (2013), 798–807.

20. Anind K Dey. 2001. Understanding and using context.Personal and ubiquitous computing 5, 1 (2001), 4–7.

21. Jari Forstadius, Ora Lassila, and Tapio Seppanen.2005. RDF-based model for context-aware reasoning inrich service environment. In Pervasive Computing andCommunications Workshops, 2005. PerCom 2005

Workshops. Third IEEE International Conference on.IEEE, 15–19.

22. Terry Halpin. 2010. Object-role modeling: Principlesand benefits. International Journal of InformationSystem Modeling and Design (IJISMD) 1, 1 (2010),33–57.

23. M. A. Hearst, S. T. Dumais, E. Osuna, J. Platt, and B.Scholkopf. 1998. Support vector machines. IEEEIntelligent Systems and their Applications 13, 4 (July1998), 18–28. DOI:http://dx.doi.org/10.1109/5254.708428

24. Karen Henricksen, Jadwiga Indulska, and AndryRakotonirainy. 2003. Generating context managementinfrastructure from high-level context models. In In 4thInternational Conference on Mobile Data Management(MDM)-Industrial Track. Citeseer.

25. Geoffrey E Hinton and Ruslan R Salakhutdinov. 2006.Reducing the dimensionality of data with neuralnetworks. science 313, 5786 (2006), 504–507.

26. Thang Hoang, Thuc Dinh Nguyen, Chuyen Luong, SonDo, and Deokjai Choi. 2013. Adaptive Cross-DeviceGait Recognition Using a Mobile Accelerometer. JIPS9, 2 (2013), 333.

27. Kejun Huang, Nicholas D Sidiropoulos, and AnanthramSwami. 2014. Non-negative matrix factorizationrevisited: Uniqueness and algorithm for symmetricdecomposition. IEEE Transactions on SignalProcessing 62, 1 (2014), 211–224.

28. Kleomenis Katevas, Hamed Haddadi, and LaurissaTokarchuk. 2014. Poster: SensingKit: A Multi-platformMobile Sensing Framework for Large-scaleExperiments. In Proceedings of the 20th AnnualInternational Conference on Mobile Computing and

1318

Page 11: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

Networking (MobiCom ’14). ACM, New York, NY, USA,375–378. DOI:http://dx.doi.org/10.1145/2639108.2642910

29. Michael Knappmeyer, Saad Liaquat Kiani, Cristina Frà,Boris Moltchanov, and Nigel Baker. 2010. Contextml: Alight-weight context representation and contextmanagement schema. In Wireless PervasiveComputing (ISWPC), 2010 5th IEEE InternationalSymposium on. IEEE, 367–372.

30. Bartosz Krawczyk. 2016. Learning from imbalanceddata: open challenges and future directions. Progressin Artificial Intelligence 5, 4 (01 Nov 2016), 221–232.DOI:http://dx.doi.org/10.1007/s13748-016-0094-0

31. Rischan Mafrur, I. Gde Dharma Nugraha, and DeokjaiChoi. 2015. Modeling and discovering human behaviorfrom smartphone sensing life-log data for identificationpurpose. Human-centric Computing and InformationSciences 5, 1 (12 Oct 2015), 31. DOI:http://dx.doi.org/10.1186/s13673-015-0049-7

32. Daniela Micucci, Marco Mobilio, and Paolo Napoletano.2017. UniMiB SHAR: A Dataset for Human ActivityRecognition Using Acceleration Data fromSmartphones. Applied Sciences 7, 10 (2017). DOI:http://dx.doi.org/10.3390/app7101101

33. David J. Olive. 2017. Principal Component Analysis.Springer International Publishing, Cham, 189–217.DOI:http://dx.doi.org/10.1007/978-3-319-68253-2_6

34. Veljko Pejovic and Mirco Musolesi. 2015. Anticipatorymobile computing: A survey of the state of the art andresearch challenges. ACM Computing Surveys (CSUR)47, 3 (2015), 47.

35. Charith Perera, Arkady Zaslavsky, Peter Christen, andDimitrios Georgakopoulos. 2014. Context awarecomputing for the internet of things: A survey. IEEEcommunications surveys & tutorials 16, 1 (2014),414–454.

36. Paola Pierleoni, Luca Pernini, Alberto Belli, andLorenzo Palma. 2014. An android-based heartmonitoring system for the elderly and for patients withheart disease. International journal of telemedicine andapplications 2014 (2014), 10.

37. Mark D Ryan. 2011. Cloud computing privacy concernson our doorstep. Commun. ACM 54, 1 (2011), 36–38.

38. Yu Sun, Nicholas Jing Yuan, Yingzi Wang, Xing Xie,Kieran McDonald, and Rui Zhang. 2016. Contextualintent tracking for personal assistants. In Proceedingsof the 22nd ACM SIGKDD International Conference onKnowledge Discovery and Data Mining. ACM, 273–282.

39. Timo Sztyler and Heiner Stuckenschmidt. 2016.On-body localization of wearable devices: Aninvestigation of position-aware activity recognition. InPervasive Computing and Communications (PerCom),2016 IEEE International Conference on. IEEE, 1–9.

40. Hamed Vahdat-Nejad, Azam Ramazani, TaherehMohammadi, and Wathiq Mansoor. 2016. A survey oncontext-aware vehicular network applications. VehicularCommunications 3 (2016), 43 – 57. DOI:http://dx.doi.org/https://doi.org/10.1016/j.vehcom.2016.01.002

41. Xiao Hang Wang, D Qing Zhang, Tao Gu, andHung Keng Pung. 2004. Ontology based contextmodeling and reasoning using OWL. In PervasiveComputing and Communications Workshops, 2004.Proceedings of the Second IEEE Annual Conferenceon. Ieee, 18–22.

1319

Page 12: Lightweight Modeling of User Context Combining Physical ... · m.campana@iit.cnr.it Franca Delmastro IIT-CNR Pisa, Italy f.delmastro@iit.cnr.it Dimitris Chatzopoulos HKUST Hong Kong

42. Özgür Yürür, Chi Harold Liu, Zhengguo Sheng,Victor CM Leung, Wilfrido Moreno, and Kin K Leung.2016. Context-awareness for mobile sensing: A surveyand future directions. IEEE Communications Surveys &Tutorials 18, 1 (2016), 68–93.

43. Kai Zhan, Steven Faux, and Fabio Ramos. 2014.Multi-scale conditional random fields for first-personactivity recognition. In Pervasive Computing andCommunications (PerCom), 2014 IEEE InternationalConference on. IEEE, 51–59.

1320