The task of ensuring cyber-security has grown increasingly challenging as the alarming expansion of computer connectivity and the large number of computer-related applications has expanded recently. It also requires a sufficient protection system against a variety of cyberattacks. Detecting discrepancies and risks in a computer network, as well as creating intrusion detection systems (IDS) to aid in cyber-security. Artificial intelligence (AI), specifically machine learning (ML) approaches, were used to create a practical data-driven intrusion detection system. Two alternative intrusion detection (ID) classification approaches were compared in this study, each with its own set of use cases. Before using the two classifiers for classification, the Particle Swarm Optimization (PSO) approach was used to reduce dimensionality. The classification approaches used to characterise network anomalies were studied in this study. PSO + ANN (Artificial neural network), PSO + Decision Tree (PSO+DT) and PSO + K-Nearest Neighbor (PSO+KNN) are the three classifiers used. The detection approaches' results were confirmed using the KDD-CUP 99 dataset. On the result of the implementation, success indicators like as specificity, recall, f1-score, accuracy, precision, and consistency were used on cyber-security databases for different types of cyber-attacks. The accuracy, detection rate (DR), and false-positive rate of the two classifiers were also compared to see which one outperforms the other (FPR). Finally, the system was compared to the IDS that was already in place. In terms of detecting network anomalies, the results reveal that PSO+ANN outperforms the PSO+KNN and PSO+DT classifier algorithms.