Today's internet is made up of nearly half a million different networks. In any network connection, identifying the attacks by their types is a difficult task as different attacks may have various connections, and their number may vary from a few to hundreds of network connections. To solve this problem, IDS-based on machine learning (ML) has been developed to monitor and analyze data packets to detect abnormal behaviors and new attacks. Security in cyberspace is currently receiving more and more attention. Making efficient defenses against many sorts of network attacks, as well as making sure that network equipment is safe and information is secure, has grown to be a major issue. Network intrusion detection systems (NIDSs) are critical components of the architecture for network security protection because they detect harmful attack behaviors by examining the network traffic of key nodes in a network [1, 2]. Intrusion detection systems (IDSs) can be classified as signature-based, and anomaly-based methods [3]. Signature-based IDS (SIDS), often referred to as Rule-based or Misuse IDS, perform ongoing network traffic monitoring and look for sequences or patterns of incoming network data that resemble an attack signature. By keeping error rates low, they are able to identify potential invasions with high accuracy rates. One of the weaknesses of these systems is the demand for an updated database that contains the attack signatures. Anomaly-based intrusion detection systems (AIDS), also known as behavior-based detection, examine the typical behavior of networks by keeping an eye on network traffic for signs of anomalous activity. AIDS can be taught using anomaly detection algorithms or self-taught using self-learning algorithms, allowing them to recognize new kinds of intrusions. Anomaly-based approach distinguishes itself significantly from the signature-based approach when it comes to recognizing new attacks. Essence to develop an efficient NIDS The majority of the most recent IDSs rely on machine learning and deep learning techniques [4-6].