The utilization of computer systems has rapidly expanded, accompanied by a corresponding rise in security threats such as hackers, viruses, worms, and similar malicious entities spreading at an alarming rate across networks. In response, anomaly intrusion detection methods have been developed to counter these attacks. However, as information systems evolve, certain detection techniques have seen a decline in effectiveness due to the escalating volume of network data traffic and the continuous need for swift responses. Addressing this critical issue, this research proposes a method to enhance the accuracy of feature selection and extraction for intrusion detection and anomaly classification. This is achieved through the integration of optimization and Autoencoder algorithms, evaluating the impact of machine learning and artificial intelligence in network anomaly detection. Utilizing the NSL-KDD dataset, the study begins with data collection and preparation, followed by the application of optimization algorithms such as the Rain Optimization Algorithm (ROA) and Artificial Bee Colony (ABC) in conjunction with various neural network architectures, including Radial Basis Function neural network, decision tree, Support Vector Machine, K-Nearest Neighbors, ensemble network, mountain model, SOM clustering, and ultimately the Hoeffding Tree-based Autoencoder network. Results demonstrate that the proposed approach, leveraging the Rain Optimization Algorithm and Hoeffding Tree-based Autoencoder network, excels in feature selection and extraction during training, effectively detecting and classifying intrusion or anomaly occurrences with high accuracy. Notably, among the algorithms tested, the Hoeffding Tree-based Autoencoder network achieved an accuracy of 98. 74%, indicating commendable performance in classification and result evaluation.