# Applying Machine Learning to DEEC Protocol: Improved Cluster Formation in Wireless Sensor Networks  
[PERSON]  
1  
[PERSON]  
operation. By addressing the challenges of energy efficiency and adaptive clustering, this work aims to contribute solutions that are directly applicable to these rapidly evolving and practically significant areas.  
Each cluster is presided over by a cluster head (CH), and each CH is responsible for collecting the data from the nodes and transmitting it to the base station, thus reducing the energy consumption by reducing the amount of communication. In this paper, a protocol called DEEC is used for clustering, and this protocol is suitable for various types of WSNs and helps prolong a network's lifetime.  
For example, DEEC selects CHs by the residual energy of nodes, so nodes with higher residual energy are selected as CHs, and this can balance the energy consumption of nodes and avoid the premature death of nodes. However, traditional clustering algorithms such as DEEC cannot always achieve the best performance under any scenario, so ML can be used to solve this problem and the K-NN and K-Means algorithms can be introduced to optimise the clustering algorithm and achieve better performance. The K-NN algorithm can determine whether nodes belong to the same cluster according to the similarity between nodes and their \(k\)-nearest neighbouring nodes, and the K-NN algorithm can be used to select CHs and detect abnormal behaviour. The K-Means algorithm can classify nodes based on location or other attributes, thus resulting in better quality and more evenly distributed clusters [3; 4].  
Clustering is an essential technique for WSNs to achieve optimal performance and energy consumption, and integrating ML with clustering is a promising research direction. This can solve issues and lead to new applications for WSNs; thus, this can help in opening new avenues for research and development in the field of WSNs [5]. However, DEEC suffers from several technical shortcomings, including static cluster formation, extended operational longevity, overloaded cluster heads, and energy consumption across a network. These issues can lead to premature node failures and a reduced network lifetime. The proposed DEEC-K-NN and DEEC-K-Means methods specifically target these limitations by introducing adaptive and data-driven cluster head selection mechanisms. The novelty of this work lies in the integration of unsupervised ML algorithms (K-NN and K-Means) with the DEEC protocol for adaptive cluster head selection in heterogeneous WSNs. Our simulation results show that these methods significantly outperform the original DEEC protocol in terms of packet delivery, network stability, and energy efficiency.  
The key contributions of this article are as follows: (1) We propose two novel modifications to the DEEC protocol by integrating K-NN and K-Means algorithms for adaptive cluster head selection. (2) We present a comprehensive simulation-based evaluation demonstrating significant improvements in network lifetime, energy efficiency, and packet delivery. (3) We provide a comparative analysis of the original and modified protocols, highlighting the advantages of ML-based clustering in WSNs.