# Cyber-Physical-Social Model for Service Recommendation in the Internet of Things

Authors: Zhijun Gao; Zhenyu Liu; Jingmin An
Journal: Mathematical Problems in Engineering
 (2022)

---

## Abstract

The services in the Internet of Things (IoT) are the key components to realize the value of IoT. The entity-oriented services are discovered from data. However, a large number of heterogeneous data and entities in IoT increase the difficulty of service development. For this, we propose a cyber-physical-social model to recommend services in IoT. The model consists of four layers: in the physical layer, the individual behavior pattern is defined. The system layer is responsible for handling interaction data to solve the heterogeneous data problem. The cyber layer is the agent layer, where we use the defined agents to establish service logic, shielding the entity heterogeneous problem. In the social layer, we explore the behavior similarity between individual users, achieving entity interaction in different scenes. In experiments, we obtain the data from 5 scenes, and the data is used for 6 experiments. In terms of accuracy and response time, our model has outstanding advantages compared with the previous methods.


---

## Body

## 1. Introduction

Since IoT is put forward, it has been a concern by all sectors of society and has become a hot issue. The core idea of IoT is to build an intelligent society with higher service quality, and scholars have done lots of work on it, so far. However, the various heterogeneous problems in IoT hinder its rapid development. Currently, the researchers pay more attention to overcoming the heterogeneous problem for the event-based service recommendation [1–3].The heterogeneous problem in IoT is multidimensional, i.e., the entity heterogeneous problem and the data heterogeneous problem. The former causes difficulty in entity management, and the latter increases difficulty in data interaction. A pioneering technique used on this problem is the semantic technique, consisting of semantic annotation, knowledge representation, and inference. In this way, the entity or data can be expressed in a unified form, so that their readability and usability are increased. Recently, a few methods have been proposed to settle the heterogeneous problem in IoT, such as semantic-aware framework [4–8] and machine learning-based methods [9–16].Constructing a semantic-aware framework has been a general method for heterogeneous problems. The semantic-annotated entity and data can be captured by the awareness framework, and they are represented by a unified knowledge form, i.e., RDF. These methods can perform the service recommendation via mining information from the represented knowledge form. Recently, the machine learning-based method is receiving more and more attention. The researchers adopt embedding learning to represent the heterogeneous relationship between entities. In this case, the service recommendation is achieved in a quantitative way.


### 1.1. Motivation

The existing methods have made outstanding contributions to solving heterogeneous problems and recommending services. Nevertheless, they still exhibit two significant limitations. On the one hand, existing methods fail to fully consider the heterogeneous problems in IoT. That is, Xiao et al. [8] investigate an enabling semantic interaction between heterogeneous entities for ambient assisted living service in IoT. They introduce the Entity Device Collocating (EDC) Platform to evolve the interoperability between the virtual and real worlds. These interactions are created upon entity mirrors mapping entities from the physical world to the virtual world. This method only addresses the entity heterogeneous problem. Yao et al. [13] focus on mining the user interests or needs from heterogeneous relationships embedded in interactions. They propose a unified probabilistic factor-based framework by fusing relationships across heterogeneous entities of IoT, including the user-thing relationship, the user-user relationship, and the thing-thing relationship, during which they consider various context factors. This method only considers the data heterogeneous problem. Chen et al. [15] emphasize the role of heterogeneous social relationships in calculating the similarity between heterogeneous objects. They learn the user preference over time by a latent probabilistic model. Jointly considering the similarity and the user preference, they propose a smart object recommendation model in an IoT environment. This method only addresses the data heterogeneous problem. Mahajan et al. [16] focus on solving the impact of heterogeneous data on a recommendation. They believe heterogeneous data factors make it challenging for estimating user and smart object representations, and they derive transition probabilities among objects and users to achieve the user preference learning. However, they ignore the impact of the entity heterogeneous problem.On the other hand, these existing methods, such as [8, 13, 15] and [16], ignore the service conflict problem. For example, if user I1 is using object O1, and simultaneously, the recommender explores the optimal service O1 for user I2, then O1 can not be recommended to I2, due to the fact that O1 is in use. These existing methods fail to consider the above conflict, which reduces accuracy in practice.


### 1.2. Contribution

The contribution of our work is to propose an agent-based cyber-physical-social model (CPSM). The model contains four layers. In the physical layer, we build the individual behavior pattern for data collection. In the system layer, we propose a unified data form, which is used to calculate the user-object relationship by a conditional probability, for the data heterogeneous problem. In the cyber layer, we adopt agents as actuators and propose an algorithm for mapping entities to agents, for the entity heterogeneous problem. In the social layer, we develop a behavior pattern-based user similarity measurement for predicting the interests of different users. Besides, when performing CPSM, we propose two-type service allocation strategies to address the service conflict. In the end, CPSM can perform a complete set of information processing, from data collection to service recommendation, as described.It is worthy to highlight several aspects of our method as follows.(i)
More fully considering the heterogeneous problem compared with existing methods. We design a novel recommender system with multiple hierarchical functions. The recommender can address both the data heterogeneous problem and the entity heterogeneous problem.(ii)
Better responding to the service conflict compared with existing methods. We propose two-type service allocation strategies corresponding to the individual user service recommendation and the multiuser service recommendation.(iii)
Empirical experiment evaluations. We implement experiments on datasets of 6 real-world scenes. The outstanding results of CPSM are achieved in comparison with the state-of-the-art methods.


## 1.1. Motivation

The existing methods have made outstanding contributions to solving heterogeneous problems and recommending services. Nevertheless, they still exhibit two significant limitations. On the one hand, existing methods fail to fully consider the heterogeneous problems in IoT. That is, Xiao et al. [8] investigate an enabling semantic interaction between heterogeneous entities for ambient assisted living service in IoT. They introduce the Entity Device Collocating (EDC) Platform to evolve the interoperability between the virtual and real worlds. These interactions are created upon entity mirrors mapping entities from the physical world to the virtual world. This method only addresses the entity heterogeneous problem. Yao et al. [13] focus on mining the user interests or needs from heterogeneous relationships embedded in interactions. They propose a unified probabilistic factor-based framework by fusing relationships across heterogeneous entities of IoT, including the user-thing relationship, the user-user relationship, and the thing-thing relationship, during which they consider various context factors. This method only considers the data heterogeneous problem. Chen et al. [15] emphasize the role of heterogeneous social relationships in calculating the similarity between heterogeneous objects. They learn the user preference over time by a latent probabilistic model. Jointly considering the similarity and the user preference, they propose a smart object recommendation model in an IoT environment. This method only addresses the data heterogeneous problem. Mahajan et al. [16] focus on solving the impact of heterogeneous data on a recommendation. They believe heterogeneous data factors make it challenging for estimating user and smart object representations, and they derive transition probabilities among objects and users to achieve the user preference learning. However, they ignore the impact of the entity heterogeneous problem.On the other hand, these existing methods, such as [8, 13, 15] and [16], ignore the service conflict problem. For example, if user I1 is using object O1, and simultaneously, the recommender explores the optimal service O1 for user I2, then O1 can not be recommended to I2, due to the fact that O1 is in use. These existing methods fail to consider the above conflict, which reduces accuracy in practice.


## 1.2. Contribution

The contribution of our work is to propose an agent-based cyber-physical-social model (CPSM). The model contains four layers. In the physical layer, we build the individual behavior pattern for data collection. In the system layer, we propose a unified data form, which is used to calculate the user-object relationship by a conditional probability, for the data heterogeneous problem. In the cyber layer, we adopt agents as actuators and propose an algorithm for mapping entities to agents, for the entity heterogeneous problem. In the social layer, we develop a behavior pattern-based user similarity measurement for predicting the interests of different users. Besides, when performing CPSM, we propose two-type service allocation strategies to address the service conflict. In the end, CPSM can perform a complete set of information processing, from data collection to service recommendation, as described.It is worthy to highlight several aspects of our method as follows.(i)
More fully considering the heterogeneous problem compared with existing methods. We design a novel recommender system with multiple hierarchical functions. The recommender can address both the data heterogeneous problem and the entity heterogeneous problem.(ii)
Better responding to the service conflict compared with existing methods. We propose two-type service allocation strategies corresponding to the individual user service recommendation and the multiuser service recommendation.(iii)
Empirical experiment evaluations. We implement experiments on datasets of 6 real-world scenes. The outstanding results of CPSM are achieved in comparison with the state-of-the-art methods.


## 2. Related Work

In this section, we will briefly review the research studies related to our work, namely, the semantic-based service recommendation in IoT and the machine learning-based service recommendation in IoT.


### 2.1. Semantic-Based Service Recommendation in IoT

In the early research studies, service recommendation is realized by raw data [11, 17], where distributed sensor data is collected, shared, and interacted. However, with the increase of devices and data in IoT, the heterogeneous problems of entity and data are emerging. In this case, the performance of models would be impacted, and then researchers focus on rising semantic technology. Currently, more and more semantic-based methods are proposed. On the one hand, Bermudez-Edo et al. [4] propose the IoT-Lite based on semantic sensor network ontology, which makes semantic descriptions widely adopted, allowing interoperability. Xu et al. [5] consider that users’ needs could not be satisfied due to the larger and larger scale of semantic link network (SLN) and provide rule-based faceted navigation for users to freely browse resources in different facets from an SLN. After analyzing the characteristics of interactions and services in IoT, Ahmed et al. [18] integrate multiple QoS requirements and allow partially matched services into IoT service ranking and selection algorithm for improving the accuracy and performance. Beltran et al. [19] adopt the RESTful standard to manage the configuration profile of objects in IoT, and they apply the ontology base to recommend possible automatic operations. Considering the profile of devices, Felfernig et al. [20] employ content-based collaborative filtering to predict user needs on specific devices. The scale of objects in IoT is increasing, which impacts object retrieval efficiency. To address this problem, I. Mashal et al. [21] propose an object clustering by measuring the semantic similarity between two objects. On the other hand, the enabling interactions between heterogeneous IoT entities for ambient assisted living services [8, 9, 22–24] are also paid more attention. For example, Hussein et al. [24] designed a context-aware recommendation model in a smart home. Xiao et al. [8] create entity mirrors as actuators mapping entities from the physical world to the virtual world, during which interactions continue to evolve based on service semantic logic. Furthermore, in [7], Meditskos et al. present an ontology-driven situational awareness for activity recognition, providing the models for the semantic enrichment and fusion of heterogeneous multisensory descriptors. Ali et al. [25] propose an ontology knowledge-based health-center recommendation system using user preference. These methods have made a breakthrough in performance. However, the above models can only be applied to handle static data, and there is still a lack of an effective method for adapting to the dynamic scenario.Our CPSM is different from the above methods in that we integrate machine learning into it to address this problem. In the CPSM system layer, the weights of interactive relationships based onL, T, and F are regarded as the main service logic. The service response is performed with quantitative calculation in probability, and it can be updated in real time. Compared to using semantic rules, the running time is less.


### 2.2. Machine Learning-Based Service Recommendation in IoT

The applications of machine learning in IoT services are rising in recent years, and this is a new perspective to deal with the heterogeneous problem in IoT. In [26], Assem et al. expound on the significance and applied value of machine learning in IoT services because of big data. And IoT should be a wide application of ambient intelligence that is a user-centric paradigm offering self-adaptive environments and tailor-made services [27]. Typically, Yao et al. [12, 13] attempt to discover underlying connections of things via mining the content embodied in human-object interactions based on a graph model, realizing service recommendations in terms of user interests. Similarly, Saleem et al. [28] consider both the people-object relationship and the object-object relationship to recommend smart objects in IoT. Restrepo et al. [29] present a multiagent-based mathematical model for service allocation with a heuristic, probabilistic search algorithm. Kamara-Esteban et al. [9] present an agent-based simulator for emulating human activities within intelligent environments from a single-user and multiple-user point of view, enhancing the interactions between humans and the environment. Hu et al. [14] propose a novel data representation method tailored to IoT by graph representation learning to further improve the semantic expressive ability of data in IoT. Yin et al. [30] focus on the recommendation for an IoT edge environment, and they utilize the convolution neural network to learn the deep features of users and objects. In addition, some work addresses the temporal influence in IoT recommendation. G. White et al. [31] propose a matrix factorization-based collaborative filtering framework, where they execute paths to dynamic adaptation via QoS prediction for time awareness. Huang et al. [32] propose a time-aware service ranking prediction in IoT, which generates the global ranking of IoT objects from the collection of partial rankings for the recommendation. Urbieta et al. [33] give a time-aware object recommendation supporting dynamic reasoning, which applies an abstract service model to represent objects and user tasks via fusing their profiles and the temporal factor. Recently, Chen et al. [15] establish the heterogeneous social relationship to calculate the similarity between heterogeneous objects, and they learn the user preference over time by a latent probabilistic model. Jointly considering both, they propose a smart object recommendation model in an IoT environment. Mahajan et al. [16] believe heterogeneous data factors make it challenging for estimating user and smart object representations, and they derive transition probabilities among objects to achieve the smart object recommendation with contextual factors. However, these methods almost consider the data heterogeneous problem while ignoring the entity heterogeneous problem. None of them mention the service conflict impact. Simultaneously, in these methods, the setting parameter is static. Therefore, there is still a lack of overall consideration of the above-mentioned shortcomings.Our work integrates semantic techniques and machine learning. We use a semantic similarity-based entity-agent mapping algorithm for shielding the entity heterogeneous problem and use machine learning to mine entity relationships via the contexts embedded in interactions to solve the data heterogeneous problem. The parameters are set based on existing data captured from interactions, and they can automatically be updated according to the generated data. And on service allocation, we design the individual user-centric allocation method with a bipartite graph model. Furthermore, for multiple-user interaction scenes, we utilize behavior semantic similarities between different users to establish a social-relationship network.


## 2.1. Semantic-Based Service Recommendation in IoT

In the early research studies, service recommendation is realized by raw data [11, 17], where distributed sensor data is collected, shared, and interacted. However, with the increase of devices and data in IoT, the heterogeneous problems of entity and data are emerging. In this case, the performance of models would be impacted, and then researchers focus on rising semantic technology. Currently, more and more semantic-based methods are proposed. On the one hand, Bermudez-Edo et al. [4] propose the IoT-Lite based on semantic sensor network ontology, which makes semantic descriptions widely adopted, allowing interoperability. Xu et al. [5] consider that users’ needs could not be satisfied due to the larger and larger scale of semantic link network (SLN) and provide rule-based faceted navigation for users to freely browse resources in different facets from an SLN. After analyzing the characteristics of interactions and services in IoT, Ahmed et al. [18] integrate multiple QoS requirements and allow partially matched services into IoT service ranking and selection algorithm for improving the accuracy and performance. Beltran et al. [19] adopt the RESTful standard to manage the configuration profile of objects in IoT, and they apply the ontology base to recommend possible automatic operations. Considering the profile of devices, Felfernig et al. [20] employ content-based collaborative filtering to predict user needs on specific devices. The scale of objects in IoT is increasing, which impacts object retrieval efficiency. To address this problem, I. Mashal et al. [21] propose an object clustering by measuring the semantic similarity between two objects. On the other hand, the enabling interactions between heterogeneous IoT entities for ambient assisted living services [8, 9, 22–24] are also paid more attention. For example, Hussein et al. [24] designed a context-aware recommendation model in a smart home. Xiao et al. [8] create entity mirrors as actuators mapping entities from the physical world to the virtual world, during which interactions continue to evolve based on service semantic logic. Furthermore, in [7], Meditskos et al. present an ontology-driven situational awareness for activity recognition, providing the models for the semantic enrichment and fusion of heterogeneous multisensory descriptors. Ali et al. [25] propose an ontology knowledge-based health-center recommendation system using user preference. These methods have made a breakthrough in performance. However, the above models can only be applied to handle static data, and there is still a lack of an effective method for adapting to the dynamic scenario.Our CPSM is different from the above methods in that we integrate machine learning into it to address this problem. In the CPSM system layer, the weights of interactive relationships based onL, T, and F are regarded as the main service logic. The service response is performed with quantitative calculation in probability, and it can be updated in real time. Compared to using semantic rules, the running time is less.


## 2.2. Machine Learning-Based Service Recommendation in IoT

The applications of machine learning in IoT services are rising in recent years, and this is a new perspective to deal with the heterogeneous problem in IoT. In [26], Assem et al. expound on the significance and applied value of machine learning in IoT services because of big data. And IoT should be a wide application of ambient intelligence that is a user-centric paradigm offering self-adaptive environments and tailor-made services [27]. Typically, Yao et al. [12, 13] attempt to discover underlying connections of things via mining the content embodied in human-object interactions based on a graph model, realizing service recommendations in terms of user interests. Similarly, Saleem et al. [28] consider both the people-object relationship and the object-object relationship to recommend smart objects in IoT. Restrepo et al. [29] present a multiagent-based mathematical model for service allocation with a heuristic, probabilistic search algorithm. Kamara-Esteban et al. [9] present an agent-based simulator for emulating human activities within intelligent environments from a single-user and multiple-user point of view, enhancing the interactions between humans and the environment. Hu et al. [14] propose a novel data representation method tailored to IoT by graph representation learning to further improve the semantic expressive ability of data in IoT. Yin et al. [30] focus on the recommendation for an IoT edge environment, and they utilize the convolution neural network to learn the deep features of users and objects. In addition, some work addresses the temporal influence in IoT recommendation. G. White et al. [31] propose a matrix factorization-based collaborative filtering framework, where they execute paths to dynamic adaptation via QoS prediction for time awareness. Huang et al. [32] propose a time-aware service ranking prediction in IoT, which generates the global ranking of IoT objects from the collection of partial rankings for the recommendation. Urbieta et al. [33] give a time-aware object recommendation supporting dynamic reasoning, which applies an abstract service model to represent objects and user tasks via fusing their profiles and the temporal factor. Recently, Chen et al. [15] establish the heterogeneous social relationship to calculate the similarity between heterogeneous objects, and they learn the user preference over time by a latent probabilistic model. Jointly considering both, they propose a smart object recommendation model in an IoT environment. Mahajan et al. [16] believe heterogeneous data factors make it challenging for estimating user and smart object representations, and they derive transition probabilities among objects to achieve the smart object recommendation with contextual factors. However, these methods almost consider the data heterogeneous problem while ignoring the entity heterogeneous problem. None of them mention the service conflict impact. Simultaneously, in these methods, the setting parameter is static. Therefore, there is still a lack of overall consideration of the above-mentioned shortcomings.Our work integrates semantic techniques and machine learning. We use a semantic similarity-based entity-agent mapping algorithm for shielding the entity heterogeneous problem and use machine learning to mine entity relationships via the contexts embedded in interactions to solve the data heterogeneous problem. The parameters are set based on existing data captured from interactions, and they can automatically be updated according to the generated data. And on service allocation, we design the individual user-centric allocation method with a bipartite graph model. Furthermore, for multiple-user interaction scenes, we utilize behavior semantic similarities between different users to establish a social-relationship network.


## 3. Model Framework

In this section, we present the framework of CPSM based on the idea of unit-IoT. IoT centered on individual users consists of multiple individual user-based units, which are called niches in this paper.Definition 1 Niche= (I, I_E, B, O, S).
Here,I is an individual user in the IoT environment and it is also the core element in the niche; I_E represents the intelligent environment, which indicates I's daily life in IoT; B is the behavior of I in the niche. Each Bi contains multiple I–O interaction actions (Act), Bi = {Act1, Act2, …, Actk, …, Actn}; O is an object in IoT; S indicates the sensor and other equipment in I_E, which is used to upload the contexts generated by I–O interactions to the network.Lemma 1 (service logic).
I–O interactions are expressed as follows: I⊗O1⟶ActI,O1  = Act1, I⊗O2⟶ActI,O2  = Act2, ……, I⊗On⟶ActI,On  = Actn. Herein, for I, some implicit relationships are embedded in interobject interactions, such as O1⊗O2⟶R, …,O1⊗On⟶RO1,On, which are regarded as service logic for I in our method.(i)
The service logic in individual user scenes. In a mirror,I uses the object Oj, the recommender recommends the next object that he/she may be interested in or need based on the created service logic.(ii)
The service logic in multiple-user scenes. In one or more mirrors, the recommender recommends different objects to each user corresponding to their own service logic.(iii)
The advantage against service conflicts. The service logic is essential in IoT service applications because the service recommendation in IoT is almost an entity recommendation, which is easy to make service conflicts in multiple-user scenes. For example, in an IoT scenario,I1 is interacting with Oj, while the recommender explores that I2 also interests Oj at the moment and recommends it to I2 in general. However, Oj is in use by I1 and unavailable to I2. Then, the recommender needs to realize this problem and should recommend another object that is similar to Oj to I2. The adopted service logic can overcome the conflict using the mined relationship sequence.
As illustrated in Figure1, (a) is responsible for mining service logic from heterogeneous entities and data. (b) uses the logic to allocate services for individual users (AI) based on a bipartite graph. In (a), we take each niche as a data generating unit in real living and design a mirror for it in cyberspace. We emphasize system processing, during which an entity-agent mapping algorithm and implicit relationship mining are implemented via the captured data. These mined relationships are used to build the service logic in the mirrors. In (b), there are two service allocation schemes. The first one is the individual service allocation within each mirror, and the second one is a multiuser allocation between different mirrors. The specific details will be introduced in Section 3.3.Figure 1
An illustration of the workflow of the proposed model.
(a)(b)


### 3.1. Agent Representation for Heterogeneous Entity

It is an indisputable fact that the entity in IoT is different and heterogeneous, which makes it very difficult to study the interentity information exchange and apply the implicit entity relationship in IoT. Considering the potential relationship is of great value to IoT services, we propose to design a corresponding mirror (agent) for each entity in the cyberspace of niche to shield the entity heterogeneous problem and realize the unified management. In this way, theI–O interaction is performed by agents.Definition 2.
The agent is an actuator. AgentA≜ (entity, Act), and entity = {I, O}, where A = {AI, AO}, AI≜ (I, Act), AO≜ (O, Act). Based on this condition, the context (Ctx), Act, and B are expressed as follows: Bi = {Acti(Ctxi) = Ctxi+1, Acti+1 (Ctxi+1) = Ctxi+2, …, Acti + n(Ctxi + n) = Ctxi + n+1}, which is an action sequence of an agent.
For accurately identifying the entity, we present an algorithm for mapping an entity to an agent, as Algorithm 1. In Algorithm 1, the semantic similarity of both identities is considered, such asSim(Etyi, Ai). When Sim(Etyi, Ai) = 1, the mapping is successful.
Sim(Etyi, Ai) is divided into two parts. One is the string matching of identity as equation (1). CEtyi and CAi are vectors extracted from the concept of identity, and D(CEtyi, CAi) is an edit distance between the concepts.(1)SimzEtyi,Ai=maxminCEtyi,CAi−DCEtyi,CAiminCEtyi,CAi.
The other is the WordNet-based semantic similarity as equation (2). depth(CEtyi) and depth(CAi) represent depths of both in the semantic tree, and lso(CEtyi, CAi) is the nearest common ancestor concept of both in the semantic tree.(2)SimwEtyi,Ai2∗depthlsoEtyi,AidepthcEtyi+depthcAi.
Algorithm 1: Entity-agent mapping algorithm.
inputCtx;outputentity-agent mapping result;(1)
Extract identities of entities from contextEtyi.Identity ←Ctxi(2)
Repeati from 1 to n(3)
Repeatj from 1 to mIF Simz(Etyi, Aj) = 1;Visit WordNet Semantic tree: Simw(Etyi, Aj);Else Continue;IF Simw(Etyi, Aj) = 1;Return (Etyi, Aj); Break;Else Continue;(4)
EndReturn False;(5)
End


### 3.2. Mining Entity Relationships via I–O Interactions

When it comes to the entity relationship, our research work is from a single-user and multiple-user point of view. From a single-user point of view, we mine interobject relationships for an individual user in a niche. From a multiple-user point of view, we emphasize the behavior similarity between different users in multiple niches.


#### 3.2.1. Interobject Relationship for an Individual User

The relationship mining is based on the contents embedded inI–O interactions, namely, contexts. Through analysis of user-object interaction features, we give some main factors for a unified data representation.Definition 3.
ContextCtx = (I, Act, O, L, T, F). As we mentioned, the Ctx is an I–O interaction content. Here, Act is the I–O interaction action, L and T are where and when Act takes place, respectively, and F represents the frequency of action during this interaction.
In the system layer, we discuss the interobject relationship based onL, T, and F. ωRij is the relationship value between Oi and Oj, computed as (3)ωRij=αRijL+βRijT+γRijF.Herein RijL, RijT, and RijF are relationship values between Oi and Oj based on L, T, and F, respectively. α, β, and γ are weighs corresponding to them, and α+β+λ=1.
(1) L-Based Relationship Values. Generally, the distance between relative locations of entities is an important influence factor for entity interactions. Therefore, we take the distance into account in computing L-based relationship values. As shown in equation (4), RijL is posed via using the spatial distance attenuation function [34].(4)RijL=kpipjdij−θ,where k is a constant coefficient, both pi and pj are the sizes of objects (the number of objects whose locations are the same as ones of Oi and Oj), dij is the actual distance between objects, and θ  = 1.5 (i≠j).
Considering the location is made up of latitude and longitude in a niche, we use the haversine formula [35] to compute dij, as (5)dij=2r⋅arcsinsin2φj−φi2+cosφicosφjsin2λj−λi21/2,where r denotes the radius of the Earth, and φi and λi are the latitude and the longitude of Oi, respectively.
(2) T-Based Relationship Values. The object is static in the niche, and their interaction actions are determined by individual users. The interaction time is a one-time interval when Oi and Oj are used simultaneously. For example, t(Oi) is the time when Oi executes an action, and t(Oj) is the time when Oj executes an action; meanwhile, t(Oi||Oj) is the cumulative time when Oi and Oj execute actions in the same time interval. The T-based relationship values are represented by P(t(Aj)|t(Ai)) in (6)RijT=PtOj|tOi=PtOiOjPtOi≈tOiOjtOi.
(3) F-Based Relationship Values. In this part, the method is similar to equation (6). f(Oi) is the frequency where Ai executes an action, f(Oj) is the frequency where Oj executes an action, and f(Oi||Oj) is the cumulative frequency where Oi and Oj execute actions at the same time. The F-based relationship values are represented by P(f(Oj)| f(Oi)) in (7)RijF=PfOj|fOi=PfOiOjPfOi≈fOiOjfOi.
(4) The Settings of Weights. Considering that L, T, and F are the main factors influencing quantitative analysis, which are dynamic factors rather than static ones; the settings of weights should be objective instead of artificial. So, we dynamically generate impact weights using both acquired and forthcoming data on the issue.
dij, t(Oi), and f(Oi) are counted into sets. The distance set between Oi and Oj is dij = {d1ij, d2ij, …, dnij}, the time set is t(Oi||Oj) = { t1(Oi||Oj), t2(Oi||Oj), …, tn(Oi||Oj)}, and the frequency set is f(Oi||Oj) = { f1(Oi||Oj), f2(Oi||Oj), …, fn(Oi||Oj)}. In equation (8), the data in sets is standardized:(8)XLij∗=dijk−mindijmaxdij−mindij,XTij∗=tkOiOj−mintOiOjmaxtOiOj−mintOiOj,XFij∗=fkOiOj−minfOiOjmaxfOiOj−minfOiOj.
The range of standardized values is [0, 1], and the average values are normalized in(9)α=XLij∗¯XLij∗¯+XTij∗¯+XFij∗¯,β=XTij∗¯XLij∗¯+XTij∗¯+XFij∗¯,γ=XFij∗¯XLij∗¯+XTij∗¯+XFij∗¯.


#### 3.2.2. Behavior Similarity between Different Users in Multiple Niches

From a single-user point of view, our main work focuses on service recommendations for an individual user. However, different niches are intersected, because multiple individual users are interacting with each other dynamically. Based on the behavior similarity mining between different users, we can achieve the multiuser service recommendation in multiple niches.In this section, the behavior similarity is expressed by the semantic distance of behaviors, including two parts. One is the action adjacency distance computing with the action vectors. The other is the semantic distance computing for the action label text based onEMD [36].In equation (10), we use Euclidean Distance Formula to gain adjacency distance between Acti and Actj.(10)dadjActi,Actj=vActi−vActj2,where v (Acti) is an action vector learned from contexts by the Continuous Bag-of-Word Model (CBOW). ||x|| represents the Euclidean Distance of x. dadj is the adjacency distance between v (Acti) and v (Actj).Definition 4.
Actil and Actjl are the action text labels, and here, Actil = {(wp1Cp1), (wp2, cp2), …, (wpm, cpm)} and Actjl = {(wq1, cq1), (wq2, cq2), …, (wqn, cqn)}. ci is the normalized frequency of wi (wi is a word from the action vector.)
Actil and Actjl are composed of multiple sets of words, and we employ EMD to compute the semantic distance between them. As shown in (11)daltActi,Actj=EMDActi,Actj=min∑i=1m∑j=1nfijdij∑i=1m∑j=1nfij.(12)s.t.fij⩾0;∑j=1nfij⩽cpi,1⩽i⩽m;∑i=1mfij⩽cqj,1⩽j⩽n;∑i=1m∑j=1nfij=min∑i=1mcpi,∑j=1ncqj;dij=vwpi−vwqj2,where dalt is the semantic distance between Actil and Actjl, and fij is the consumption of conversion from wqi to wqj. The semantic distance between Acti and Actj is a linear combination of the adjacency relationship and the action label text semantic, as equation (12):(13)dasActi,Actj=λdadj′Acti,Actj+1−λdalt′Acti,Actj.(14)d′Acti,Actj=dActi,Actj1+dActi,Actj,Acti≠φandActj≠φ,1,Acti=φorActj=φ,0,Acti=φandActj=φ,where dasACTi,ACTj is the action semantic distance, and d`ACTi,ACTj is the normalized result on dACTi,ACTj, which is one of the dadjACTi,ACTj or daltACTi,ACTj. φ represents the empty action, and λ∈ (0,1).
The behavior is represented by an action sequence, which emerges the living state of an individual user over a period of time. Multiple behaviors compose behavior patterns in a niche.Definition 6.
Behavior pattern in a niche.Sp and Sq are the behavior patterns in different niches, respectively. Sp∷  = {(Bp1, cp1), (Bp2, cp2), … , (Bpm, cpm)} and Sq∷ = {(Bq1, cq1), (Bq2, cq2), … , (Bqn, cqn)}, where ci is the normalized frequency of Bi, and the distance between Bpm and Bqn is calculated by equation (13). The | Bi | is the length of the action sequence, and min(•) indicates the minimum of the consumption conserved from Actpi to Actqj via dynamic programming.(15)dtBpm,Bqn=2×min∑i=1m∑j=1ndasActpi,ActqjBpm+Bqn+min∑i=1m∑j=1ndasActpi,Actqj.
The behavior similarity between multiple users is performed with the distance of different behavior patterns in niches. We utilize the capacity scaling algorithm [37] to solve the semantic distance of behavior patterns, as Algorithm 2.
Algorithm 2: The semantic distance solving algorithm for behavior patterns of individual users in niches.
Input:Sp, SqOutput: the behavior pattern matrix [Upq]Begin:(1)
Searchρ , making ρci∈ Z+(2)
Repeatcpm←ρ cpm; cqn←ρ cqn;(3)
End(4)
RepeatEstablish nodes withBpm, Bpm∈Sp;(5)
RepeatEstablish nodesBqn, and edge (Bpm, Bqn), meeting the consumption dmn←dt (Bpm, Bqn);(6)
End(7)
End(8)
ArraybT←T≤ [ cp1, cp2, … , cpm, -cq1, -cq2, … , -cqn]; bmax← { cpm, cqn }; T← 2log(bmax); fmn = 0;(9)
RepeatIf:b! = 0 doIf:SelectBpm∈Sp, meeting b[m] ≥T;SelectBqn∈Sq, meeting b[m + n-1] ≤-T;doSearch the edge needing minimum consumption in graph;b[m] ←b[m] −T; b[m + n-1] ←b[m + n-1]+ T; fmn←fmn+ T;Else:Goto row 11;Else:Goto row 12;(10)
End(11)
If: = 1 doGoto row 12;ElseT←T/2; goto row 9;(12)
RepeatUpq←∑p=1m∑q=1nfmndmn/ρ;(13)
End(14)
Return [Upq];
In Algorithm 2, the main processing includes two parts. One is that regarding action sequences as nodes, the directed edge between any action sequences inSp and Sq is established (row 4∼row7). In this part, the time complexity is O(mn). The other is solving the minimum consumption path (row 9∼row10), and its time complexity is O(K2(K+2log2K)log(2+bmax)), K = max{m, n}.


### 3.3. Service Allocation Strategy

In this section, we perform to solve the service allocation in two scenarios. One is to provide service for the individual user in fixed scenarios. The other is to provide service for different users in cross scenarios. As illustrated in Figure2, in (a), when CPSM captures the action context of Ii (AiI) in nichei (mirrori), the service logic is dynamically generated with a bipartite graph based on the relationship sequence of Oi (AiO). In (b), when CPSM captures the action context of various users in cross niches (mirrors) simultaneously, we adopt the optimal relationship sequence to generate service logic based on the behavior semantic distance between users in [Upq].Figure 2
The service allocation processing diagram. (a) is service allocation for the individual user in fixed scenarios, and (b) is service allocations for different users in cross scenarios. The relationship sequence ofOi (AiO) is a result sorted in the relationship values (ωRij) order.
(a)(b)


## 3.1. Agent Representation for Heterogeneous Entity

It is an indisputable fact that the entity in IoT is different and heterogeneous, which makes it very difficult to study the interentity information exchange and apply the implicit entity relationship in IoT. Considering the potential relationship is of great value to IoT services, we propose to design a corresponding mirror (agent) for each entity in the cyberspace of niche to shield the entity heterogeneous problem and realize the unified management. In this way, theI–O interaction is performed by agents.Definition 2.
The agent is an actuator. AgentA≜ (entity, Act), and entity = {I, O}, where A = {AI, AO}, AI≜ (I, Act), AO≜ (O, Act). Based on this condition, the context (Ctx), Act, and B are expressed as follows: Bi = {Acti(Ctxi) = Ctxi+1, Acti+1 (Ctxi+1) = Ctxi+2, …, Acti + n(Ctxi + n) = Ctxi + n+1}, which is an action sequence of an agent.
For accurately identifying the entity, we present an algorithm for mapping an entity to an agent, as Algorithm 1. In Algorithm 1, the semantic similarity of both identities is considered, such asSim(Etyi, Ai). When Sim(Etyi, Ai) = 1, the mapping is successful.
Sim(Etyi, Ai) is divided into two parts. One is the string matching of identity as equation (1). CEtyi and CAi are vectors extracted from the concept of identity, and D(CEtyi, CAi) is an edit distance between the concepts.(1)SimzEtyi,Ai=maxminCEtyi,CAi−DCEtyi,CAiminCEtyi,CAi.
The other is the WordNet-based semantic similarity as equation (2). depth(CEtyi) and depth(CAi) represent depths of both in the semantic tree, and lso(CEtyi, CAi) is the nearest common ancestor concept of both in the semantic tree.(2)SimwEtyi,Ai2∗depthlsoEtyi,AidepthcEtyi+depthcAi.
Algorithm 1: Entity-agent mapping algorithm.
inputCtx;outputentity-agent mapping result;(1)
Extract identities of entities from contextEtyi.Identity ←Ctxi(2)
Repeati from 1 to n(3)
Repeatj from 1 to mIF Simz(Etyi, Aj) = 1;Visit WordNet Semantic tree: Simw(Etyi, Aj);Else Continue;IF Simw(Etyi, Aj) = 1;Return (Etyi, Aj); Break;Else Continue;(4)
EndReturn False;(5)
End


## 3.2. Mining Entity Relationships via I–O Interactions

When it comes to the entity relationship, our research work is from a single-user and multiple-user point of view. From a single-user point of view, we mine interobject relationships for an individual user in a niche. From a multiple-user point of view, we emphasize the behavior similarity between different users in multiple niches.


### 3.2.1. Interobject Relationship for an Individual User

The relationship mining is based on the contents embedded inI–O interactions, namely, contexts. Through analysis of user-object interaction features, we give some main factors for a unified data representation.Definition 3.
ContextCtx = (I, Act, O, L, T, F). As we mentioned, the Ctx is an I–O interaction content. Here, Act is the I–O interaction action, L and T are where and when Act takes place, respectively, and F represents the frequency of action during this interaction.
In the system layer, we discuss the interobject relationship based onL, T, and F. ωRij is the relationship value between Oi and Oj, computed as (3)ωRij=αRijL+βRijT+γRijF.Herein RijL, RijT, and RijF are relationship values between Oi and Oj based on L, T, and F, respectively. α, β, and γ are weighs corresponding to them, and α+β+λ=1.
(1) L-Based Relationship Values. Generally, the distance between relative locations of entities is an important influence factor for entity interactions. Therefore, we take the distance into account in computing L-based relationship values. As shown in equation (4), RijL is posed via using the spatial distance attenuation function [34].(4)RijL=kpipjdij−θ,where k is a constant coefficient, both pi and pj are the sizes of objects (the number of objects whose locations are the same as ones of Oi and Oj), dij is the actual distance between objects, and θ  = 1.5 (i≠j).
Considering the location is made up of latitude and longitude in a niche, we use the haversine formula [35] to compute dij, as (5)dij=2r⋅arcsinsin2φj−φi2+cosφicosφjsin2λj−λi21/2,where r denotes the radius of the Earth, and φi and λi are the latitude and the longitude of Oi, respectively.
(2) T-Based Relationship Values. The object is static in the niche, and their interaction actions are determined by individual users. The interaction time is a one-time interval when Oi and Oj are used simultaneously. For example, t(Oi) is the time when Oi executes an action, and t(Oj) is the time when Oj executes an action; meanwhile, t(Oi||Oj) is the cumulative time when Oi and Oj execute actions in the same time interval. The T-based relationship values are represented by P(t(Aj)|t(Ai)) in (6)RijT=PtOj|tOi=PtOiOjPtOi≈tOiOjtOi.
(3) F-Based Relationship Values. In this part, the method is similar to equation (6). f(Oi) is the frequency where Ai executes an action, f(Oj) is the frequency where Oj executes an action, and f(Oi||Oj) is the cumulative frequency where Oi and Oj execute actions at the same time. The F-based relationship values are represented by P(f(Oj)| f(Oi)) in (7)RijF=PfOj|fOi=PfOiOjPfOi≈fOiOjfOi.
(4) The Settings of Weights. Considering that L, T, and F are the main factors influencing quantitative analysis, which are dynamic factors rather than static ones; the settings of weights should be objective instead of artificial. So, we dynamically generate impact weights using both acquired and forthcoming data on the issue.
dij, t(Oi), and f(Oi) are counted into sets. The distance set between Oi and Oj is dij = {d1ij, d2ij, …, dnij}, the time set is t(Oi||Oj) = { t1(Oi||Oj), t2(Oi||Oj), …, tn(Oi||Oj)}, and the frequency set is f(Oi||Oj) = { f1(Oi||Oj), f2(Oi||Oj), …, fn(Oi||Oj)}. In equation (8), the data in sets is standardized:(8)XLij∗=dijk−mindijmaxdij−mindij,XTij∗=tkOiOj−mintOiOjmaxtOiOj−mintOiOj,XFij∗=fkOiOj−minfOiOjmaxfOiOj−minfOiOj.
The range of standardized values is [0, 1], and the average values are normalized in(9)α=XLij∗¯XLij∗¯+XTij∗¯+XFij∗¯,β=XTij∗¯XLij∗¯+XTij∗¯+XFij∗¯,γ=XFij∗¯XLij∗¯+XTij∗¯+XFij∗¯.


### 3.2.2. Behavior Similarity between Different Users in Multiple Niches

From a single-user point of view, our main work focuses on service recommendations for an individual user. However, different niches are intersected, because multiple individual users are interacting with each other dynamically. Based on the behavior similarity mining between different users, we can achieve the multiuser service recommendation in multiple niches.In this section, the behavior similarity is expressed by the semantic distance of behaviors, including two parts. One is the action adjacency distance computing with the action vectors. The other is the semantic distance computing for the action label text based onEMD [36].In equation (10), we use Euclidean Distance Formula to gain adjacency distance between Acti and Actj.(10)dadjActi,Actj=vActi−vActj2,where v (Acti) is an action vector learned from contexts by the Continuous Bag-of-Word Model (CBOW). ||x|| represents the Euclidean Distance of x. dadj is the adjacency distance between v (Acti) and v (Actj).Definition 4.
Actil and Actjl are the action text labels, and here, Actil = {(wp1Cp1), (wp2, cp2), …, (wpm, cpm)} and Actjl = {(wq1, cq1), (wq2, cq2), …, (wqn, cqn)}. ci is the normalized frequency of wi (wi is a word from the action vector.)
Actil and Actjl are composed of multiple sets of words, and we employ EMD to compute the semantic distance between them. As shown in (11)daltActi,Actj=EMDActi,Actj=min∑i=1m∑j=1nfijdij∑i=1m∑j=1nfij.(12)s.t.fij⩾0;∑j=1nfij⩽cpi,1⩽i⩽m;∑i=1mfij⩽cqj,1⩽j⩽n;∑i=1m∑j=1nfij=min∑i=1mcpi,∑j=1ncqj;dij=vwpi−vwqj2,where dalt is the semantic distance between Actil and Actjl, and fij is the consumption of conversion from wqi to wqj. The semantic distance between Acti and Actj is a linear combination of the adjacency relationship and the action label text semantic, as equation (12):(13)dasActi,Actj=λdadj′Acti,Actj+1−λdalt′Acti,Actj.(14)d′Acti,Actj=dActi,Actj1+dActi,Actj,Acti≠φandActj≠φ,1,Acti=φorActj=φ,0,Acti=φandActj=φ,where dasACTi,ACTj is the action semantic distance, and d`ACTi,ACTj is the normalized result on dACTi,ACTj, which is one of the dadjACTi,ACTj or daltACTi,ACTj. φ represents the empty action, and λ∈ (0,1).
The behavior is represented by an action sequence, which emerges the living state of an individual user over a period of time. Multiple behaviors compose behavior patterns in a niche.Definition 6.
Behavior pattern in a niche.Sp and Sq are the behavior patterns in different niches, respectively. Sp∷  = {(Bp1, cp1), (Bp2, cp2), … , (Bpm, cpm)} and Sq∷ = {(Bq1, cq1), (Bq2, cq2), … , (Bqn, cqn)}, where ci is the normalized frequency of Bi, and the distance between Bpm and Bqn is calculated by equation (13). The | Bi | is the length of the action sequence, and min(•) indicates the minimum of the consumption conserved from Actpi to Actqj via dynamic programming.(15)dtBpm,Bqn=2×min∑i=1m∑j=1ndasActpi,ActqjBpm+Bqn+min∑i=1m∑j=1ndasActpi,Actqj.
The behavior similarity between multiple users is performed with the distance of different behavior patterns in niches. We utilize the capacity scaling algorithm [37] to solve the semantic distance of behavior patterns, as Algorithm 2.
Algorithm 2: The semantic distance solving algorithm for behavior patterns of individual users in niches.
Input:Sp, SqOutput: the behavior pattern matrix [Upq]Begin:(1)
Searchρ , making ρci∈ Z+(2)
Repeatcpm←ρ cpm; cqn←ρ cqn;(3)
End(4)
RepeatEstablish nodes withBpm, Bpm∈Sp;(5)
RepeatEstablish nodesBqn, and edge (Bpm, Bqn), meeting the consumption dmn←dt (Bpm, Bqn);(6)
End(7)
End(8)
ArraybT←T≤ [ cp1, cp2, … , cpm, -cq1, -cq2, … , -cqn]; bmax← { cpm, cqn }; T← 2log(bmax); fmn = 0;(9)
RepeatIf:b! = 0 doIf:SelectBpm∈Sp, meeting b[m] ≥T;SelectBqn∈Sq, meeting b[m + n-1] ≤-T;doSearch the edge needing minimum consumption in graph;b[m] ←b[m] −T; b[m + n-1] ←b[m + n-1]+ T; fmn←fmn+ T;Else:Goto row 11;Else:Goto row 12;(10)
End(11)
If: = 1 doGoto row 12;ElseT←T/2; goto row 9;(12)
RepeatUpq←∑p=1m∑q=1nfmndmn/ρ;(13)
End(14)
Return [Upq];
In Algorithm 2, the main processing includes two parts. One is that regarding action sequences as nodes, the directed edge between any action sequences inSp and Sq is established (row 4∼row7). In this part, the time complexity is O(mn). The other is solving the minimum consumption path (row 9∼row10), and its time complexity is O(K2(K+2log2K)log(2+bmax)), K = max{m, n}.


## 3.2.1. Interobject Relationship for an Individual User

The relationship mining is based on the contents embedded inI–O interactions, namely, contexts. Through analysis of user-object interaction features, we give some main factors for a unified data representation.Definition 3.
ContextCtx = (I, Act, O, L, T, F). As we mentioned, the Ctx is an I–O interaction content. Here, Act is the I–O interaction action, L and T are where and when Act takes place, respectively, and F represents the frequency of action during this interaction.
In the system layer, we discuss the interobject relationship based onL, T, and F. ωRij is the relationship value between Oi and Oj, computed as (3)ωRij=αRijL+βRijT+γRijF.Herein RijL, RijT, and RijF are relationship values between Oi and Oj based on L, T, and F, respectively. α, β, and γ are weighs corresponding to them, and α+β+λ=1.
(1) L-Based Relationship Values. Generally, the distance between relative locations of entities is an important influence factor for entity interactions. Therefore, we take the distance into account in computing L-based relationship values. As shown in equation (4), RijL is posed via using the spatial distance attenuation function [34].(4)RijL=kpipjdij−θ,where k is a constant coefficient, both pi and pj are the sizes of objects (the number of objects whose locations are the same as ones of Oi and Oj), dij is the actual distance between objects, and θ  = 1.5 (i≠j).
Considering the location is made up of latitude and longitude in a niche, we use the haversine formula [35] to compute dij, as (5)dij=2r⋅arcsinsin2φj−φi2+cosφicosφjsin2λj−λi21/2,where r denotes the radius of the Earth, and φi and λi are the latitude and the longitude of Oi, respectively.
(2) T-Based Relationship Values. The object is static in the niche, and their interaction actions are determined by individual users. The interaction time is a one-time interval when Oi and Oj are used simultaneously. For example, t(Oi) is the time when Oi executes an action, and t(Oj) is the time when Oj executes an action; meanwhile, t(Oi||Oj) is the cumulative time when Oi and Oj execute actions in the same time interval. The T-based relationship values are represented by P(t(Aj)|t(Ai)) in (6)RijT=PtOj|tOi=PtOiOjPtOi≈tOiOjtOi.
(3) F-Based Relationship Values. In this part, the method is similar to equation (6). f(Oi) is the frequency where Ai executes an action, f(Oj) is the frequency where Oj executes an action, and f(Oi||Oj) is the cumulative frequency where Oi and Oj execute actions at the same time. The F-based relationship values are represented by P(f(Oj)| f(Oi)) in (7)RijF=PfOj|fOi=PfOiOjPfOi≈fOiOjfOi.
(4) The Settings of Weights. Considering that L, T, and F are the main factors influencing quantitative analysis, which are dynamic factors rather than static ones; the settings of weights should be objective instead of artificial. So, we dynamically generate impact weights using both acquired and forthcoming data on the issue.
dij, t(Oi), and f(Oi) are counted into sets. The distance set between Oi and Oj is dij = {d1ij, d2ij, …, dnij}, the time set is t(Oi||Oj) = { t1(Oi||Oj), t2(Oi||Oj), …, tn(Oi||Oj)}, and the frequency set is f(Oi||Oj) = { f1(Oi||Oj), f2(Oi||Oj), …, fn(Oi||Oj)}. In equation (8), the data in sets is standardized:(8)XLij∗=dijk−mindijmaxdij−mindij,XTij∗=tkOiOj−mintOiOjmaxtOiOj−mintOiOj,XFij∗=fkOiOj−minfOiOjmaxfOiOj−minfOiOj.
The range of standardized values is [0, 1], and the average values are normalized in(9)α=XLij∗¯XLij∗¯+XTij∗¯+XFij∗¯,β=XTij∗¯XLij∗¯+XTij∗¯+XFij∗¯,γ=XFij∗¯XLij∗¯+XTij∗¯+XFij∗¯.


## 3.2.2. Behavior Similarity between Different Users in Multiple Niches

From a single-user point of view, our main work focuses on service recommendations for an individual user. However, different niches are intersected, because multiple individual users are interacting with each other dynamically. Based on the behavior similarity mining between different users, we can achieve the multiuser service recommendation in multiple niches.In this section, the behavior similarity is expressed by the semantic distance of behaviors, including two parts. One is the action adjacency distance computing with the action vectors. The other is the semantic distance computing for the action label text based onEMD [36].In equation (10), we use Euclidean Distance Formula to gain adjacency distance between Acti and Actj.(10)dadjActi,Actj=vActi−vActj2,where v (Acti) is an action vector learned from contexts by the Continuous Bag-of-Word Model (CBOW). ||x|| represents the Euclidean Distance of x. dadj is the adjacency distance between v (Acti) and v (Actj).Definition 4.
Actil and Actjl are the action text labels, and here, Actil = {(wp1Cp1), (wp2, cp2), …, (wpm, cpm)} and Actjl = {(wq1, cq1), (wq2, cq2), …, (wqn, cqn)}. ci is the normalized frequency of wi (wi is a word from the action vector.)
Actil and Actjl are composed of multiple sets of words, and we employ EMD to compute the semantic distance between them. As shown in (11)daltActi,Actj=EMDActi,Actj=min∑i=1m∑j=1nfijdij∑i=1m∑j=1nfij.(12)s.t.fij⩾0;∑j=1nfij⩽cpi,1⩽i⩽m;∑i=1mfij⩽cqj,1⩽j⩽n;∑i=1m∑j=1nfij=min∑i=1mcpi,∑j=1ncqj;dij=vwpi−vwqj2,where dalt is the semantic distance between Actil and Actjl, and fij is the consumption of conversion from wqi to wqj. The semantic distance between Acti and Actj is a linear combination of the adjacency relationship and the action label text semantic, as equation (12):(13)dasActi,Actj=λdadj′Acti,Actj+1−λdalt′Acti,Actj.(14)d′Acti,Actj=dActi,Actj1+dActi,Actj,Acti≠φandActj≠φ,1,Acti=φorActj=φ,0,Acti=φandActj=φ,where dasACTi,ACTj is the action semantic distance, and d`ACTi,ACTj is the normalized result on dACTi,ACTj, which is one of the dadjACTi,ACTj or daltACTi,ACTj. φ represents the empty action, and λ∈ (0,1).
The behavior is represented by an action sequence, which emerges the living state of an individual user over a period of time. Multiple behaviors compose behavior patterns in a niche.Definition 6.
Behavior pattern in a niche.Sp and Sq are the behavior patterns in different niches, respectively. Sp∷  = {(Bp1, cp1), (Bp2, cp2), … , (Bpm, cpm)} and Sq∷ = {(Bq1, cq1), (Bq2, cq2), … , (Bqn, cqn)}, where ci is the normalized frequency of Bi, and the distance between Bpm and Bqn is calculated by equation (13). The | Bi | is the length of the action sequence, and min(•) indicates the minimum of the consumption conserved from Actpi to Actqj via dynamic programming.(15)dtBpm,Bqn=2×min∑i=1m∑j=1ndasActpi,ActqjBpm+Bqn+min∑i=1m∑j=1ndasActpi,Actqj.
The behavior similarity between multiple users is performed with the distance of different behavior patterns in niches. We utilize the capacity scaling algorithm [37] to solve the semantic distance of behavior patterns, as Algorithm 2.
Algorithm 2: The semantic distance solving algorithm for behavior patterns of individual users in niches.
Input:Sp, SqOutput: the behavior pattern matrix [Upq]Begin:(1)
Searchρ , making ρci∈ Z+(2)
Repeatcpm←ρ cpm; cqn←ρ cqn;(3)
End(4)
RepeatEstablish nodes withBpm, Bpm∈Sp;(5)
RepeatEstablish nodesBqn, and edge (Bpm, Bqn), meeting the consumption dmn←dt (Bpm, Bqn);(6)
End(7)
End(8)
ArraybT←T≤ [ cp1, cp2, … , cpm, -cq1, -cq2, … , -cqn]; bmax← { cpm, cqn }; T← 2log(bmax); fmn = 0;(9)
RepeatIf:b! = 0 doIf:SelectBpm∈Sp, meeting b[m] ≥T;SelectBqn∈Sq, meeting b[m + n-1] ≤-T;doSearch the edge needing minimum consumption in graph;b[m] ←b[m] −T; b[m + n-1] ←b[m + n-1]+ T; fmn←fmn+ T;Else:Goto row 11;Else:Goto row 12;(10)
End(11)
If: = 1 doGoto row 12;ElseT←T/2; goto row 9;(12)
RepeatUpq←∑p=1m∑q=1nfmndmn/ρ;(13)
End(14)
Return [Upq];
In Algorithm 2, the main processing includes two parts. One is that regarding action sequences as nodes, the directed edge between any action sequences inSp and Sq is established (row 4∼row7). In this part, the time complexity is O(mn). The other is solving the minimum consumption path (row 9∼row10), and its time complexity is O(K2(K+2log2K)log(2+bmax)), K = max{m, n}.


## 3.3. Service Allocation Strategy

In this section, we perform to solve the service allocation in two scenarios. One is to provide service for the individual user in fixed scenarios. The other is to provide service for different users in cross scenarios. As illustrated in Figure2, in (a), when CPSM captures the action context of Ii (AiI) in nichei (mirrori), the service logic is dynamically generated with a bipartite graph based on the relationship sequence of Oi (AiO). In (b), when CPSM captures the action context of various users in cross niches (mirrors) simultaneously, we adopt the optimal relationship sequence to generate service logic based on the behavior semantic distance between users in [Upq].Figure 2
The service allocation processing diagram. (a) is service allocation for the individual user in fixed scenarios, and (b) is service allocations for different users in cross scenarios. The relationship sequence ofOi (AiO) is a result sorted in the relationship values (ωRij) order.
(a)(b)


## 4. Experiment

In this section, we conduct 6 experiments on 5 real-world data sets to validate the performance of our proposed model CPSM.


### 4.1. Experimental Environment and Dataset

Based on WIN 10 OS, we use Microsoft.NET Framework and SQL Server 2012 database to build the experimental platform, where the programs are running on a PC with 3.80 GHz and 32 GB memory.In order to verify the effectiveness of our proposed model, we adopt the dataset CASAS (http://ailab.wsu.edu/casas/datasets/) collected from a smart home environment. In CASAS, there are five scenarios, including entertainment place, office, kitchen, transportation, medical place, and home application environment. As shown in Table 1, it is easy to see that the numbers of the marked object and collected Ctx are different between scenarios, because the active frequency of the individual user in each scenario is different. The collected data comes from the behavior records of 100 users within two months.Table 1
Experimental data set.
No.Scenarios|Object||Tag||Ctx|1Entertainment7926778712Office7253104573Kitchen67103110784Medical place172830855Home application10324515123


### 4.2. Evaluation Methodology

In recent years, some related works have proved the advantages of their methods for service recommendations in IoT. To test the significance of CPSM, we adopt the following methods as baselines.(i)
B.Xiao’s logical object-oriented entity interaction method (EDC) [8].This method proposes a semantic logic-based framework, where it constructs the mirrors as actuators instead of entities.(ii)
L.Yao’s implicit relationship mining method based on the graph model (FST) [12].This method mines the potential interests of individual users based on heterogeneous relationships for service recommendations.(iii)
Y.Y. Chen’s time-aware smart object recommendation method (TSItemCF) [15].This method proposes an object social relationship learning framework, where the similarity between objects can be calculated. Jointly considering the user preference and the object similarity, it leverages collaborative filtering to achieve object recommendations in IoT.(iv)
P. Mahajan’s smart object recommendation architecture (SORec) [16].This method proposes a smart object recommendation model, which derives the transition probabilities among objects with contextual factors. It utilizes the probabilities to mine the user preference object.(v)
Our proposed model CPSM.We evaluate the five methods in accuracy and response time. We vary the training set percentage from 20% to 60% for cross-validation. The corresponding test data is randomly divided into 4 groups. We explore the results through six tests, including simulations from five single scene data validations and one multiple scene data validation.For the evaluation of accuracy, we consider the service conflict in IoT; namely, one service sometimes may not meet the needs of more than one user at the same time. Therefore, we propose a new metric to calculate the accuracy, as follows:(16)Accuracy=PS−CSPS+ES,where PS is the optimal service recommended to the user, ES is the service that fails to meet user needs, and CS is the conflicting service in PS.For the evaluation of response time, we measure the running time of each one in the case of the five methods running with the same amount of data.


### 4.3. Experimental Results

Tables2–4 show the accuracy based on cross-validation on 6 types of data sets. As we can see, CPSM outperforms the other baselines. On the other hand, with the increase in training set scale, CPSM has an advantage over the others, and the detailed observations are revealed as follows.(i)
When the training set is less than 30%, the semantic logic-based algorithm (EDC) is superior to the machine learning-based algorithms (FST, TSItemCF, SORec, and CPSM) in general. With the increase of the training set, the performance of FST, TSItemCF, SORec, and CPSM is gradually showing up. The reason is that these methods exploit the mined implicit entity interactions and potential interests, which would help them to provide the more needed services for individual users. Among them, CPSM has the best performance. This is because CPSM combines both machine learning and semantic techniques against data heterogeneous and entity heterogeneous problems in real IoT applications, and it considers service conflicts in recommendations. Machine learning is able to mine the interobject relationship for an individual user, and on this basis, semantic similarity is used to explore the interindividual behavior relationship. The adopted service logic can handle the service conflict for the user’s real-time demand.(ii)
Further, we carry out a second experiment to verify the parameter setting impacts on FST, TSItemCF, SORec, and CPSM in terms of the training set of 60%. In the experiment, we randomly divide the test data from each scenario into four groups to run, and the results are shown in Figure3. As we expected, CPSM is superior to the other baselines in the performance stability; namely, the performance of CPSM is less influenced by parameter settings. In FST, TSItemCF, and SORec, the parameters in the solutions of the entity relationship mining are set manually, and on the contrary, CPSM will automatically generate these parameters in the processing of the solutions based on the real dataset. In our work, the parameters are obtained by automatic generation, which is closer to the actual demands.(iii)
The response time is one of the most important criteria to measure the performance of baselines. We first analyze the time complexity for all methods from the theoretical point of view, as shown in Table5. EDC performs service recommendations using the established various semantic logics, which consume a lot of time. The time consumption for the other machine learning-based models is similar. Furthermore, we implement experiments on 6 types of datasets to measure the running time. The results are illustrated in Figure 4, which shows that FST, TSItemCF, SORec, and CPSM spend less running time than EDC.Table 2
The accuracy (%) based on cross-validations on the entertainment dataset and office dataset.
Training set (%)EntertainmentOfficeEDCFSTTSItemCFSORecCPSMEDCFSTTSItemCFSORecCPSM2028.3223.7426.2826.8727.0332.1227.0429.1630.0531.303035.2734.1935.7536.2937.1638.4737.8938.7738.9640.864047.4556.9658.8259.1362.1152.6560.0261.2761.9863.215062.6170.5875.5576.0878.2564.3173.7875.1675.7877.736073.0882.6683.2583.9286.5176.4784.5485.3186.1988.63Table 3
The accuracy (%) based on cross-validations on the kitchen dataset and medical place dataset.
Training set (%)KitchenMedical placeEDCFSTTSItemCFSORecCPSMEDCFSTTSItemCFSORecCPSM2032.6527.1329.8330.0531.3125.6221.4623.2323.7624.783038.1536.9438.6438.8940.6531.4230.4930.3231.1832.714052.6359.9961.8562.7164.9247.6954.9557.6758.2361.225064.4373.6275.1775.6878.0561.7870.0874.1175.0977.566074.6985.1087.1687.8989.3373.1081.6284.1685.1087.54Table 4
The accuracy (%) based on cross-validations on the home application dataset and mixed dataset.
Training set (%)Home applicationMixed datasetEDCFSTTSItemCFSORecCPSMEDCFSTTSItemCFSORecCPSM2032.8728.5630.0630.4531.1230.1425.7027.1828.6829.343039.6239.0440.1240.6541.8236.4934.9036.8937.1438.074053.6060.7764.3265.0766.2349.8051.8353.5654.0656.395066.1075.0276.1576.9579.8262.4069.6973.3574.1175.546077.9086.3288.1788.8990.0674.5082.7783.8184.2286.83Table 5
The time complexity comparison of different models.
ModelsTime complexityEDCO(n4)FSTO(n3 + n2)TSItemCFO(n3 + n2)SORecO(n3 + n2)CPSMO(n3 + n2)Figure 3
The comparisons of the accuracy based on grouping experiments.
(a)(b)(c)(d)(e)(f)Figure 4
The comparison of the response time.To evaluate the contributions ofL, T, and F to CPSM, we implement an ablation experiment. CPSM/L indicates the model that only considers the location factor. CPSM/T is the model that only considers the time factor. CPSM/F is the model that only considers the frequency factor. The results are shown in Figure 5. CPSM outperforms all of CPSM/L, CPSM/T, and CPSM/F, which denotes that each factor plays a role. Among them, the performance ranking is that CPSM/L > CPSM/F > CPSM/T, which implies that the location factor is the most important for the user, and the user intends to use the object nearby them.Figure 5
The influence of different factors on CPSM.


## 4.1. Experimental Environment and Dataset

Based on WIN 10 OS, we use Microsoft.NET Framework and SQL Server 2012 database to build the experimental platform, where the programs are running on a PC with 3.80 GHz and 32 GB memory.In order to verify the effectiveness of our proposed model, we adopt the dataset CASAS (http://ailab.wsu.edu/casas/datasets/) collected from a smart home environment. In CASAS, there are five scenarios, including entertainment place, office, kitchen, transportation, medical place, and home application environment. As shown in Table 1, it is easy to see that the numbers of the marked object and collected Ctx are different between scenarios, because the active frequency of the individual user in each scenario is different. The collected data comes from the behavior records of 100 users within two months.Table 1
Experimental data set.
No.Scenarios|Object||Tag||Ctx|1Entertainment7926778712Office7253104573Kitchen67103110784Medical place172830855Home application10324515123


## 4.2. Evaluation Methodology

In recent years, some related works have proved the advantages of their methods for service recommendations in IoT. To test the significance of CPSM, we adopt the following methods as baselines.(i)
B.Xiao’s logical object-oriented entity interaction method (EDC) [8].This method proposes a semantic logic-based framework, where it constructs the mirrors as actuators instead of entities.(ii)
L.Yao’s implicit relationship mining method based on the graph model (FST) [12].This method mines the potential interests of individual users based on heterogeneous relationships for service recommendations.(iii)
Y.Y. Chen’s time-aware smart object recommendation method (TSItemCF) [15].This method proposes an object social relationship learning framework, where the similarity between objects can be calculated. Jointly considering the user preference and the object similarity, it leverages collaborative filtering to achieve object recommendations in IoT.(iv)
P. Mahajan’s smart object recommendation architecture (SORec) [16].This method proposes a smart object recommendation model, which derives the transition probabilities among objects with contextual factors. It utilizes the probabilities to mine the user preference object.(v)
Our proposed model CPSM.We evaluate the five methods in accuracy and response time. We vary the training set percentage from 20% to 60% for cross-validation. The corresponding test data is randomly divided into 4 groups. We explore the results through six tests, including simulations from five single scene data validations and one multiple scene data validation.For the evaluation of accuracy, we consider the service conflict in IoT; namely, one service sometimes may not meet the needs of more than one user at the same time. Therefore, we propose a new metric to calculate the accuracy, as follows:(16)Accuracy=PS−CSPS+ES,where PS is the optimal service recommended to the user, ES is the service that fails to meet user needs, and CS is the conflicting service in PS.For the evaluation of response time, we measure the running time of each one in the case of the five methods running with the same amount of data.


## 4.3. Experimental Results

Tables2–4 show the accuracy based on cross-validation on 6 types of data sets. As we can see, CPSM outperforms the other baselines. On the other hand, with the increase in training set scale, CPSM has an advantage over the others, and the detailed observations are revealed as follows.(i)
When the training set is less than 30%, the semantic logic-based algorithm (EDC) is superior to the machine learning-based algorithms (FST, TSItemCF, SORec, and CPSM) in general. With the increase of the training set, the performance of FST, TSItemCF, SORec, and CPSM is gradually showing up. The reason is that these methods exploit the mined implicit entity interactions and potential interests, which would help them to provide the more needed services for individual users. Among them, CPSM has the best performance. This is because CPSM combines both machine learning and semantic techniques against data heterogeneous and entity heterogeneous problems in real IoT applications, and it considers service conflicts in recommendations. Machine learning is able to mine the interobject relationship for an individual user, and on this basis, semantic similarity is used to explore the interindividual behavior relationship. The adopted service logic can handle the service conflict for the user’s real-time demand.(ii)
Further, we carry out a second experiment to verify the parameter setting impacts on FST, TSItemCF, SORec, and CPSM in terms of the training set of 60%. In the experiment, we randomly divide the test data from each scenario into four groups to run, and the results are shown in Figure3. As we expected, CPSM is superior to the other baselines in the performance stability; namely, the performance of CPSM is less influenced by parameter settings. In FST, TSItemCF, and SORec, the parameters in the solutions of the entity relationship mining are set manually, and on the contrary, CPSM will automatically generate these parameters in the processing of the solutions based on the real dataset. In our work, the parameters are obtained by automatic generation, which is closer to the actual demands.(iii)
The response time is one of the most important criteria to measure the performance of baselines. We first analyze the time complexity for all methods from the theoretical point of view, as shown in Table5. EDC performs service recommendations using the established various semantic logics, which consume a lot of time. The time consumption for the other machine learning-based models is similar. Furthermore, we implement experiments on 6 types of datasets to measure the running time. The results are illustrated in Figure 4, which shows that FST, TSItemCF, SORec, and CPSM spend less running time than EDC.Table 2
The accuracy (%) based on cross-validations on the entertainment dataset and office dataset.
Training set (%)EntertainmentOfficeEDCFSTTSItemCFSORecCPSMEDCFSTTSItemCFSORecCPSM2028.3223.7426.2826.8727.0332.1227.0429.1630.0531.303035.2734.1935.7536.2937.1638.4737.8938.7738.9640.864047.4556.9658.8259.1362.1152.6560.0261.2761.9863.215062.6170.5875.5576.0878.2564.3173.7875.1675.7877.736073.0882.6683.2583.9286.5176.4784.5485.3186.1988.63Table 3
The accuracy (%) based on cross-validations on the kitchen dataset and medical place dataset.
Training set (%)KitchenMedical placeEDCFSTTSItemCFSORecCPSMEDCFSTTSItemCFSORecCPSM2032.6527.1329.8330.0531.3125.6221.4623.2323.7624.783038.1536.9438.6438.8940.6531.4230.4930.3231.1832.714052.6359.9961.8562.7164.9247.6954.9557.6758.2361.225064.4373.6275.1775.6878.0561.7870.0874.1175.0977.566074.6985.1087.1687.8989.3373.1081.6284.1685.1087.54Table 4
The accuracy (%) based on cross-validations on the home application dataset and mixed dataset.
Training set (%)Home applicationMixed datasetEDCFSTTSItemCFSORecCPSMEDCFSTTSItemCFSORecCPSM2032.8728.5630.0630.4531.1230.1425.7027.1828.6829.343039.6239.0440.1240.6541.8236.4934.9036.8937.1438.074053.6060.7764.3265.0766.2349.8051.8353.5654.0656.395066.1075.0276.1576.9579.8262.4069.6973.3574.1175.546077.9086.3288.1788.8990.0674.5082.7783.8184.2286.83Table 5
The time complexity comparison of different models.
ModelsTime complexityEDCO(n4)FSTO(n3 + n2)TSItemCFO(n3 + n2)SORecO(n3 + n2)CPSMO(n3 + n2)Figure 3
The comparisons of the accuracy based on grouping experiments.
(a)(b)(c)(d)(e)(f)Figure 4
The comparison of the response time.To evaluate the contributions ofL, T, and F to CPSM, we implement an ablation experiment. CPSM/L indicates the model that only considers the location factor. CPSM/T is the model that only considers the time factor. CPSM/F is the model that only considers the frequency factor. The results are shown in Figure 5. CPSM outperforms all of CPSM/L, CPSM/T, and CPSM/F, which denotes that each factor plays a role. Among them, the performance ranking is that CPSM/L > CPSM/F > CPSM/T, which implies that the location factor is the most important for the user, and the user intends to use the object nearby them.Figure 5
The influence of different factors on CPSM.


## 5. Conclusion

In this paper, we propose an oriented-IoT novel service recommendation method, which shields the multidimensional heterogeneous problems in IoT. To address the entity heterogeneous problem, we propose an entity-agent mapping algorithm for agent representation corresponding to the entity. To solve the data heterogeneous problem, we use the location factor, the time factor, and the frequency factor to learn the entity relationship embedded in user-object interactions. To emphasize service conflict, we propose two-type service allocation optimization strategies for the individual user and multiple users. We use real-world datasets to evaluate the empirical performance of CPSM. The final results indicate that CPSM outperforms state-of-the-art methods in both accuracy and response time.



---

*Source: 9523984-2022-05-10.xml*