# Blockchain and Machine Learning Inspired Secure Smart Home Communication Network
## 3 Methodology
### The Cloud Layer
#### 3.2.2 The Data Selection for Ranking  
The fuzzy inference engine provided a labeled set based on the evaluated QoS services of the transactions in the blockchain layer. In order to generate a reputation system to assist the blockchain layer, the proposed work utilized the dragonfly algorithm in order to select a data record against its class label. To do so, the proposed work utilized the dragonfly algorithm based on the studied literature that was presented in Section 2. The dragonfly algorithm is a powerful data selection tool that can be used to identify patterns and trends in data sets. It is particularly useful for finding outliers and unusual data points. The algorithm works by partitioning the data set into small subsets and then iteratively selecting the best subset of data points from each subset. The dragonfly algorithm is fast and efficient, and it can be applied to any type of data set [25; 26]. The dragonfly algorithm is a swarm-based algorithm that uses the attraction index for the selection and rejection of the prey. This method is based on the principle of selecting the best data points by considering their distance from the center of the data set. This can be achieved by either using a Euclidean distance or a Manhattan distance [27]. The dragonfly algorithm is able to handle both types of distances, and it also has the ability to consider multiple dimensions when making its calculations [28]. The AI can be calculated using Equation (1). The fuzzy inference engine provides a labeled set based on the evaluated QoS services of the transactions in the blockchain layer. In order to generate a reputation system to assist the blockchain layer, the proposed work utilized the dragonfly algorithm in order to select a data record against its class label. To do so, the proposed work utilized the dragonfly algorithm based on the existing literature [29] to compute the next state of the fly using Equation (1):  
\[\mathrm{x}_{\mathrm{i}}^{\mathrm{t+1}}=\mathrm{x}_{\mathrm{i}}^{\mathrm{t}}+ \beta_{\mathrm{0}}\mathrm{e}^{-\gamma\mathrm{r}_{\mathrm{i}}^{2}}\left( \mathrm{x}_{\mathrm{j}}^{\mathrm{t}}-\mathrm{x}_{\mathrm{i}}^{\mathrm{t}} \right)+\infty \tag{1}\]  
Figure 3: Proposed work model. where \(x_{i}^{t+1}\) is the next state of the firefly, \(x_{i}^{t}\) is the current state of the firefly, \(\propto\) is the randomization parameter [0-1], \(r_{ij}\) is the distance of the distribution \(x_{i}-x_{j}h\); here, i and j are the fireflies, \(\beta\) is the attractive index, and \(\gamma\) is the change in the attraction index. Here, \(x_{g}c^{t}\) is the group centroid of the labeled route. The intended dragonfly algorithms is illustrated in Algorithm 2. The selected dragonflies were passed to the Neural Engine for the purpose of ranking on the basis of their score generated in the training section. After the completion of the training 30% of all the data underwent rigorous testing in which each identity was tested at least once. Once the data were classified, their classification scores were treated as the rank of the transition. A ground truth value found close to the original value in each case is observed as better option. Neural networks are a type of machine learning algorithm inspired by the structure and function of the human brain. They are used in a variety of applications, from image and speech recognition to fraud detection and financial forecasting. In recent years, neural networks have been applied to the field of blockchain to enhance security in smart homes. The training and classification of blockchain comprise three security categories, namely Smart T, Mod T, and Avoid T for smart homes, which can be achieved through a neural network. The neural network is trained using a dataset of examples, and each example is labeled as either Smart T, Mod T, or Avoid T. The neural network learns to recognize patterns in the data that are associated with each of the three categories and then uses this knowledge to classify new examples [30; 31].