This repository contains a comprehensive project focused on detecting network intrusions using various machine learning models. The project includes data preprocessing, exploratory data analysis, feature selection, model training, and evaluation to build robust classifiers for identifying potential network threats accurately.
- Project Overview
- Dataset
- Requirements
- Installation
- Usage
- Models and Optimization
- Results
- Contributing
- License
The objective of this project is to develop machine learning models capable of detecting network intrusions. The steps involved in the project are:
- Data Loading and Initial Inspection
- Exploratory Data Analysis (EDA)
- Data Preprocessing
- Feature Selection
- Model Training and Evaluation
- Model Optimization
- Performance Comparison
The dataset used in this project is divided into training and testing sets:
- Train_data.csv: Contains the training data.
- Test_data.csv: Contains the testing data.
Both files are located in the Dataset
directory.
The project requires the following Python libraries:
To install the required libraries, you can use the following command:
pip install numpy pandas seaborn matplotlib optuna scikit-learn lightgbm catboost xgboost tabulate
To run the project, follow these steps:
Clone the repository:
git clone https://github.com/FouadHellal/network-intrusion-detection.git
cd network-intrusion-detection
Run the Python script:
python intrusion_detection.py
The project includes the following machine learning models:
- K-Nearest Neighbors (KNN)
- Logistic Regression
- Decision Tree
- Random Forest
- Gradient Boosting
- XGBoost
- LightGBM
- AdaBoost
- CatBoost
- Naive Bayes
- Voting Classifier
- Support Vector Machine (SVM)
- Hyperparameter optimization is performed using Optuna for models like KNN, Decision Tree, Random Forest, and SVM.
The results of the models are summarized in a tabular format, showing both train and test accuracies. The confusion matrix of the best model (XGBoost) is also displayed to visualize the classification performance.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch.
- Make your changes and commit them.
- Push your changes to your fork.
- Submit a pull request.
This project is licensed under the MIT License.