## 1 Introduction  
Wireless network technology is at the heart of the growth of the Internet of Things (IoT). This is because wireless networks are critical for transmitting interactive data from devices to humans, as well as between devices [1]. These devices are part of automation and control systems, embedded systems, Wireless Sensor Networks (WSNs), and other systems that exchange data in a variety of environments without requiring human intervention. Most applications that use these devices are made up of perception, network, and application layers [2]. The application and network layers are mostly executed in high-powered devices, while the perception layer is mostly executed in low-powered devices to keep them running as long as possible, particularly when using systems with limited battery life. Since perception devices depend on public wireless networks, the perception layer is considered one of the most sensitive topics in need of attention, particularly to protection against attack [3]. Accreditation within this layer contributes to many issues in WSNarchitecture. One of these issues applies to security, privacy, and availability within the perception layer [4]. Attackers can listen in on radio transmissions, send fake messages over communication channels, and alter received data packets [5; 6]. Moreover, they can use compromised WSN nodes with similar hardware resources to legitimate network nodes [7]. In addition, an attacker might be capable of stopping WSN node services by using various attacks such as sinkhole, wormhole, hello flood, Sybil, and Denial of Service (DoS) [8]. DoS and Distributed DoS (DDoS) attacks are one of the most common and dangerous threats to WSN security, as they occur when several compromised WSN nodes are infected by malicious WSN nodes at the same time under the control of a single attacker by overwhelming the target WSN nodes with bogus requests. This depletes their resources and forces them to refuse services to legitimate WSN nodes [9]. Therefore, in this paper, we will focus on slowing down DoS and DDoS attacks in WSNs with minimum power consumption and good detection accuracy. Due to the inability to prevent or completely stop such types of attacks, Intrusion Detection Systems (IDS) are used to discover suspicious or abnormal activities and alert the WSN nodes [10]. Signature-based and anomaly-based intrusion detection are the two types of intrusion detection. In an anomaly pattern, the system must regularly track network access and compare ongoing WSN operations to normal traffic patterns [10; 11]. However, the anomaly detection technique needs to examine and analyze each transmission packet in detail. Thus, it consumes energy and CPU, which are weaknesses of WSN nodes. As a result, a variety of techniques have been used to boost DoS detection efficiency using both active and passive methods. Supervised machine learning algorithms are one such technique used to predict and classify DoS and DDoS attacks [12; 13; 14; 15]. Decision Tree (DT), Support Vector Machine (SVM), K-Nearest Neighbours (KNN), Deep-Learning (DL) classifier, and Naive Bayes (NB) are common algorithms for this purpose [16]. The authors in [1; 2; 9; 12; 14; 17; 18] used various deep learning mechanisms, and their results in terms of detection precision, mean squared error, and sensitivity were satisfactory, but none of them addressed the impact of their proposals on WSNs, such as node power consumption and network lifetime. The problem with these techniques is the amount of data they require for the training and testing process, and WSN nodes' inability to manage such a huge number of dimension records. Therefore, another technology can be used in conjunction with machine learning classifiers is a feature selection algorithm. This is used to determine which data features are most important in the IDS process [19], and helps in understanding data, minimizing computation requirements, and improving prediction performance.