{'fraction_non_alphanumeric': 0.030788353970454655, 'fraction_numerical': 0.005593536357986327, 'mean_word_length': 4.9190718732314656, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Trust Computational Heuristic for Social Internet of Things: A Machine Learning-based Approach

The Internet of Things (IoT) is an evolving network of billions of interconnected physical objects, such as numerous sensors, smartphones, wearables, and embedded devices. These physical objects, generally referred to as the smart objects, when deployed in the real-world aggregates useful information from their surrounding environment. As-of-late, this notion of IoT has been extended to incorporate the social networking facets which have led to the promising paradigm of the `Social Internet of Things' (SIoT). In SIoT, the devices operate as an autonomous agent and provide an exchange of information and service discovery in an intelligent manner by establishing social relationships among them with respect to their owners. Trust plays an important role in establishing trustworthy relationships among the physical objects and reduces probable risks in the decision-making process. In this paper, a trust computational model is proposed to extract individual trust features in a SIoT environment. Furthermore, a machine learning-based heuristic is used to aggregate all the trust features in order to ascertain an aggregate trust score. Simulation results illustrate that the proposed trust-based model isolates the trustworthy and untrustworthy nodes within the network in an efficient manner.


I. INTRODUCTION
Over the past decade, the notion of Internet of Things (IoT) has evolved as a new generation of a network of billions of devices seamlessly connected over the Internet. These devices are regularly outfitted with sensors which monitor different aspects of human life for supporting numerous beneficial applications and services [1]. A big value of the IoT resides on its ability to create a network of resources, i.e., by making resources social, where social relationships facilitate the discovery of resources that have the capabilities required to solve a particular task. To accomplish this goal, IoT should be endowed with the ability to define and manage social relationships between resources in every aspect [2]. The promising paradigm of Social Internet of Things (SIoT) has transpired recently which can be seen as the combination of social networks and IoT, wherein every object is capable of establishing social relationship autonomously with the other objects depending on the rules set by their respective owners [3]. Nevertheless, the convergence of physical objects, humans, and cyber components in SIoT presents new concerns for risk, privacy, and security. As the intent of SIoT services is to make decisions autonomously without the need for any human intervention, the notion of trust is recognized as *Corresponding Authors: (subhash.sagar, adnan.mahmood)@mq.edu.au a prospective solution for supporting both humans and services in order to overcome the perception of insecurity and minimize the risks when making a decision.
The paradigm of trust has been used in several disciplines, including but not limited to, psychology, sociology, and computer science [4], [5]. In terms of SIoT, trust can be referred to as a notion of 'belief' or 'confidence' of a trustor in a trustee to perform a specific task for satisfying a trustor's expectations in a specific context within a particular period of time [6]. As depicted in Fig. 1, if a node A (trustor) needs to compute the trust value for node B (trustee), it computes the direct trust on its own and requests the mutual friends (e.g., nodes C, D, and E) to provide their recommendations for the same. Finally, the combination of direct and indirect trust provides an aggregate trust score. The main reason for providing the trust management system for SIoT is apparent since there are misbehaving nodes which may perform different types of attacks (such as ballot-stuffing attack, bad-mouthing attack, self-promoting and whitewashing attack) based on their social relationships with other nodes for their malicious advantages at the expense of other IoT devices which provide similar SIoT services.
A number of trust management schemes have been proposed in recent years. The authors in [7] delineated a subjective and objective trustworthiness scheme in order to ascertain trust in a SIoT environment, wherein trust of any particular node was evaluated by aggregating three salient features, i.e., centrality, opinions from its common friends, and the direct experiences. Nevertheless, the influence of each of these features on the trust aggregation process was ascertained by certain weighting factors that are themselves extremely difficult to figure primarily owing to the reason that trust depends on several complex parameters, i.e., context, time, resources, and the environment. Similarly, the authors in [8] proposed an adaptive trust protocol for a SIoT system. It employs direct monitoring and indirect observations from users with similar social activity metrices, i.e., social contacts, honesty, and communities-of-interest, to ascertain overall trust. Furthermore, in order to aggregate the same, an adaptive filtering method was designed to integrate direct and indirect observations with weighting parameters for each observation. However, the authors did not validated their envisaged protocol on a wide range of dynamic environmental scenarios, wherein assigning the weighting parameters is itself a complicated chore. In [9], the authors employed communityof-interest as a social trust metric to envisage a trust management mechanism for purposes of IoT, wherein a Kalman filter was used as a tool to estimate the trust value of a node before interaction. However, the aggregate trust value was calculated using a linear equation with weighting factors for both direct and indirect trust.
In [10], the authors presented a subjective trust model employing the social features of similarity in respect of common interests, honesty, and cooperativeness for evaluating the trust score of a particular node. To obtain the direct trust, a weighted sum metric was used to aggregate both the current as well as past experiences. Nevertheless, the model did not account for the indirect observations or recommendations from other nodes in the network which is essential for the IoT services delivery. Moreover, in [11], a context-based social trust model has been developed for IoT purposes by considering social relationships amongst nodes. For computing the trust score of a node, both direct and indirect observations with a transaction context was used. However, to obtain a single trust score, a weighted sum metric was used for aggregation. Recently, the authors in [12] suggested a trust framework model based on the social profile of a node, wherein different social features were accumulated to ascertain the trust score of a node. In addition, a machine learning-based algorithm was exploited to aggregate only the direct trust metric and which is not sufficient enough to decide whether a node is trustworthy or not.
In this research work, we have computed trust based on both the direct observation as well as the indirect recommendations. Our primary contributions in this paper are threefold: • A comprehensive trust model for the SIoT environment has been envisaged which specifies the formation of trust via both direct and indirect observation of the nodes; • A Machine Learning (ML)-based aggregation scheme has been envisaged in contrast to the conventional trust-based heuristics to aggregate the trust attributes for obtaining a single trust score; and • Performance evaluation of the proposed model has been comprehensively carried out in a simulation environment.
II. TRUST COMPUTATION MODEL This section presents the details of the computational model for an efficient and flexible trust management scheme in a SIoT environment. Our trust model in this paper comprises of two metrics, Direct Trust Metric (DTM) and Indirect Trust Metric (ITM), as depicted in Fig. 2, where DTM gives the notion of direct observation while ITM provides the reputation of nodes in the network. The trust assessment for node i (trustor) towards node j (trustee) is denoted by T X (i, j) where X denotes the social attributes like F riendship Similarity, Community − of − Interest, Reward, and Cooperativeness. The range of T X (i, j) varies from [0, 1] where values nearer to 0 indicate untrustworthiness while values around 1 indicate trustworthiness. After aggregating all the features T X (i, j) from the direct interaction via ML-based algorithm, the result is stored in the repository and is used as a direct trust score. For indirect trust (recommendations), the node (trustor) requests the direct trust from the other nodes. Subsequently, Algorithm 1 is utilized to combine both the results (trusts) to obtain the final trust score.

A. Direct Trust Metric (DTM)
DTM is used to provide direct observation of a trustee prior to interaction. Although a trustee can be assessed via numerous different attributes, in this paper, we have employed four main attributes for the assessment of any trustee with respect to the trustor and which are elaborated as follows: 1) Friendship Similarity (FS): Friendship similarity represents social relationship in terms of interaction among participating objects. It measures the importance of an object among other objects with reference to a specific task and context. This property of an object is ascertained as: where, F i and F j refers to a set of friends of node i and node j respectively and |.| shows the cardinality of a set.
2) Community-of-Interest (CoI): This kind of attribute represents the similarity of nodes with respect to the social interest communities or groups. Therefore, nodes with high CoI have more chances of interacting with each other in order to develop a trustworthy relationship. CoI-based trust between two nodes is computed as: where, C i and C j represents set of communities of node i and node j respectively.

3) Cooperativeness (CoP):
CoP manifests whether a trustee is socially cooperative with a trustor or not. Since CoP refers to a measure of balance in the interaction between the nodes, we can employ the entropy function delineated in [13] to calculate CoP-based trust as: where, T p represents fraction of messages during the interaction. 4) Reward/Punishment: In order to maintain both trustworthy relationships and punish misbehaving nodes, we utilize an exponential downgrading formula to provide the incentive to honest nodes and penalties to misbehaving nodes as: here, Int highlights the total number of interactions and Int U refers to the count for the number of unsuccessful interactions between node i and node j. Traditionally, to aggregate the overall trust, a linear equation with the weighting factor is used as shown in Eq. (5), however, this approach has numerous disadvantages and challenges (as discussed in Section I) while determining the appropriate value of weights.
Therefore, to overcome this drawback, we hereby propose a new machine learning-based approach which combines direct and indirect trust to ascertain an overall trust value. Additionally, this approach also identifies the impact of each of these features on the aggregated trust value.

B. Indirect Trust Metric (ITM)
A reputation metric (ITM) is employed in order to ascertain the trustee based on the opinion of other nodes in the network. Nevertheless, the reputation of objects vary from node to node, and therefore, it is not optimal to take account of all the nodes in the network for computing the reputation of a trustee. Thus, in this paper, reputation value is requested from nodes having at least a single friend in common between trustor and trustee.
Finally, in order to ascertain a single trust value, we develop an algorithm (i.e., Algorithm 1) so as to aggregate both direct and indirect trust. The said algorithm takes into consideration both of the direct trust and recommendations as an input, and accordingly, provides a single trust of a node, i.e., trustworthy or untrustworthy. Our trust score estimation algorithm depends more on direct trust as can be noticed from lines 13-16. If the direct trust is 0 or untrustworthy and more recommendations are untrustworthy (|U |) or neutral (|N |), the node is marked as untrustworthy. Here, neutral manifests that the node is neither trustworthy nor untrustworthy. Furthermore, if the direct trust  ) is computed, and if P T is greater than threshold (θ), which in our case is 70% or 0.7, then the node is marked as trustworthy (lines 17-22). The value of θ totally depends on an individual application and the reason for such a high value of θ in our case is to accord higher authority to the trustor node rather than the recommendations from other nodes in the network to cope with the issue of good mouthing and ballot-stuffing attack. Similarly, this algorithm follows the lines 24-34 provided that the direct trust is 1 or trustworthy. At the end, if a direct trust score is 2 or neutral, it implies that the trustor node does not possess its own observation for the trustee and the trustworthiness of a node is decided on the basis of recommendations. If |T | > |U |, then node is marked as trustworthy, otherwise, it is untrustworthy.

III. SIMULATION SETUP
To ascertain the aforementioned trust features, i.e., T F = {F S, CoI, Reward, CoP }, to be employed for our ML-based model, we have used sigcomm-2009 1 dataset which comprises the traces that could be mapped in the form of the promising paradigm of SIoT. These traces contain the social information of device/user (i.e., friendships and interested groups information, activities, and messages logs), which have been utilized for computing the trust features mentioned in Section II. This dataset comprises 76 nodes and 18, 226 interactions for over a period of four days. The trust features are ascertained for each pair of nodes with at least one interaction between them and there are 5, 776 pair of nodes in total.
Subsequent to obtaining of the trust features T F , an unsupervised learning algorithm (i.e., k-means clustering) is employed so as to label the features in different classes [14]. The primary reason to use the k-means clustering is due to the unavailability of the labeled training set. The k-means algorithm requires two inputs: initial centroid points (C) and the number of clusters (C k ). Initially, we have allocated random centroid positions to all the clusters (C k , k = 1 to 4) and executed the algorithm until the convergence. For the proposed model, we needed two clusters, namely trustworthy or untrustworthy, nevertheless, we used the elbow method to acquire the optimized cluster (C opt ) size with lower k-means cost function, which in our case is, C opt = 3. This implies that the k-means algorithm segregates the data in three clusters -trustworthy, untrustworthy, and neutral, wherein neutral means that the node is neither trustworthy nor untrustworthy and nodes with values near the origin (0, 0) are marked as untrustworthy.
In order to train the model subsequent to clustering process, we employed the multi-class random forest classification algorithms [15] to identify the best decision boundary which segregates the trustworthy and untrustworthy interactions. Random forest is fairly suitable for feature engineering, i.e, to identify the most important features amongst all the available features in the dataset, and in our case, it is extremely indispensable to know the more imperious features as well as the weightage of each feature during aggregation of the overall trust. In addition, random forest avoids overfitting problem by constructing multiple decision trees on the same dataset with random selection. For training and testing purposes, 5, 776 samples were utilized which represents the interaction between each pair of nodes. Out of the same, 80% of them were used for training purposes, whereas, 20% of them were used to evaluate the accuracy of the proposed model.

IV. RESULTS AND DISCUSSION
As deliberated in Section III, k-means clustering has been employed in order to classify the trustworthy and untrustworthy relationships. Nevertheless, it is the elbow method which categorizes the data into three clusters instead of the two, i.e., trustworthy, untrustworthy, and neutral, as portrayed in Fig. 3. For demonstration purposes, we only took into consideration the pairs of trust features for clustering instead of employing all the features at once since it is not feasible to visualize all of them together. However, we can use the Principle Component Analysis (PCA) technique for dimension reduction, e.g., from four to two in our case, to ascertain the results for visualizing all the features at once [16]. As can be clearly observed from Fig. 3a and 3b,  Furthermore, all other subfigures reflect a mutual contribution to the overall trust score as depicted in Fig. 3c-3f.
With successful investigation of the labels, the next step is to train our model to identify whether the futuristic interactions of SIoT nodes are trustworthy or not. After applying a supervised learning algorithm (random forest), Fig. 4 portrays the decision boundary to successfully classify the nodes with minimal error. It is quite evident from Fig. 4 that our model is fully capable of classifying the futuristic interactions as trustworthy, neutral, or untrustworthy. Fig. 5 manifests the accuracy of the classification algorithm (98.7%) and the significance (i.e., weightage) of each individual feature ascertained after applying our model on the dataset. It can be easily observed that CoI (47.42%) and Reward (34.18%) have more impact on the overall trust score followed by CoP (15.21%) and F S (3.18%). The key reason for such a higher weightage of CoI is owing to the fact that the objects belonging to the same group tends to be more trustworthy and interact more frequently. Similarly, the Reward feature shows that more unsuccessful interactions lead to untrustworthiness making it an important factor in calculating the trust score.
As we have identified three categories of nodes, i.e., trustworthy, untrustworthy, and neutral, nevertheless, by and large, we only need to identify a node as either a trustworthy one or an untrustworthy one. To cope with the issue of neutral nodes, we applied our trust score estimation algorithm, i.e., Algorithm 1, on the results obtained from the k-means clustering so as to aggregate the direct trust with the recommendations (indirect trust) and accordingly reduced the size of the clusters to two to be useful for real-world applications. We used a percentage threshold (θ) to combine the trust score, if and when, there is a conflict of interest between the trustor and the other nodes in the network. For instance, if direct trust = trustworthy and the number of untrustworthy recommendations (|U |) are more than trustworthy recommendations (|T |), then our algorithm investigates the percentage of untrustworthy recommendations (P U ). If P U > θ, then the node is marked as untrustworthy. To ascertain the optimum value of θ, we compared different thresholds, and when θ = 70%, our algorithm manifests the maximum accuracy of 89.7% as depicted in Fig. 6. However, the accuracy of our algorithm after combining both direct and indirect trust is bit lower than the accuracy of the model when only the direct trust has been taken into contemplation. This is primarily owing to the fact that there had been no previous history of interactions between the nodes which led to higher trust values at the start. Thus, to avoid such circumstances, recommendations are always employed to ascertain the concrete results which lowers the overall accuracy.

V. CONCLUSION AND FUTURE WORK
In this paper, we have proposed a machine learning-based trust aggregation scheme in contrast to the traditional weighted heuristics to ascertain a single trust score for each SIoT node. A trust computational model has been accordingly envisaged to extract key trust features with respect to the SIoT domain. Subsequently, in order to aggregate the trust, the data is labeled by using the k-means clustering for identifying the trustworthy and untrustworthy interactions. A trust prediction scheme has been further proposed for identifying the decision boundaries and to learn the impact of individual features on the aggregated trust score. Our simulation results demonstrate higher accuracy in ascertaining the trustworthy interactions.
In near future, we intend to incorporate experience as a trust attribute for the computation of direct and indirect trust so as to accumulate the previous interaction history of the target nodes coupled with few other social features, i.e., social relationships in terms of co-location and co-work. This could result in more precise determination of trustworthy nodes in a SIoT network.