## 1 Introduction  
A wireless sensor network (WSN) [1, 2], which is made up of different kinds of sensors with limited resources, is an important part of monitoring an environment and sending important data to a designated node, also called a sink, through different communication protocols. These data are then relayed to a base station for meticulous analysis and processing, catered to the specific demands of contemporary applications. Renowned for their efficacy in remote monitoring, WSNs have a promising future, finding applicability in critical domains such as border surveillance, industrial inspection, commercial utilities, health monitoring, and environmental and infrastructure surveillance [3].  
Conversely, the Internet of Things (IoT) [4, 5] embodies an intricate network of interconnected smart devices tasked with the collection, processing, optimization, and dissemination of valuable data through internet channels. Each device, identifiable by a unique IP address or identifier, facilitates autonomous data exchange, enhancing the convenience and efficiency of daily activities through technological advancements [6; 7; 8]. However, this burgeoning development is not devoid of challenges, predominantly concerning security [9].  
The extensive integration of IoT into daily life and the surge in remote device operations necessitate a unified platform facilitating seamless communication amongst a diverse array of devices [10; 11; 12]. This prerequisite has spurred the creation of specific IoT frameworks, outlining the architectural blueprint for selected applications and thus working towards standardizing IoT security protocols.  
WSN and IoT [13; 14] stand as potent forces capable of spearheading a societal transformation towards a smarter, more connected world. Despite their distinctive characteristics, they are occasionally utilized interchangeably owing to similarities in their processing power, memory storage, and communication capabilities. Both networks hold remarkable potential in real-time applications [15; 16; 17], yet they suffer from persistent security challenges at the device level [18].  
In this context, the adoption of lightweight, low-power security mechanisms is crucial, aiming to enhance network longevity by minimizing power consumption during the intrusion detection phase [19; 20; 21]. Traditional methods have endeavored to address security concerns using minimal power consumption strategies, albeit with varying degrees of success. As the IoT landscape expands, so does its vulnerability to external threats, making the development of robust security infrastructure imperative.  
Current classifiers have trouble differentiating normal and unusual system behaviors because there are so many network traffic data, which have different features [22]. The presence of irrelevant features and network communication disturbances further exacerbate this challenge, leading to increased resource expenditure and diminished detection rates. Therefore, the nuanced selection of features has emerged as a vital aspect of machine learning designed to accurately encapsulate object properties while eliminating redundant data [2].  
Existing research has extensively explored the potential of feature selection and machine learning algorithms in network security and traffic monitoring. Nevertheless, conventional intrusion detection approaches exhibit significant limitations, including increased computation time, reduced reliability, and heightened complexity. So, the goal of this study is to develop a new Intrusion Detection System (IDS) framework to protect WSN-IoT networks as shown in Figure 1. This was achieved by using new feature optimization and classification strategies to improve accuracy and detection rates while cutting down on time [23].  
Figure 1: Security properties of WSN-IoT systems.