Here's the complete README.md file for your intrusion detection system project, incorporating all elements from your code and best practices:
# Intrusion Detection System (IDS) using Ensemble Learning
## Overview
This project implements a hybrid machine learning approach for network intrusion detection using:
- CNN-LSTM deep learning model
- Random Forest classifier
- XGBoost classifier
- Stacked ensemble meta-classifier
The system analyzes network traffic data from the NSL-KDD dataset to classify 23 types of cyber attacks .
## Project Structure
```python
├── Data Preparation
├── Model Training
│ ├── CNN-LSTM
│ ├── Random Forest
│ └── XGBoost
├── Ensemble Learning
└── Model Evaluation- Clone the repository
git clone https://github.com/your-repo/ids-ensemble.git- Install dependencies
pip install -r requirements.txtRequires: PyTorch, XGBoost, Scikit-learn, Pandas, Matplotlib, Seaborn
- Place NSL-KDD dataset files in
/content/drive/MyDrive/IDS/NSL_KDD_Train.csvNSL_KDD_Test.csv
python main.py-
Data Preprocessing
- Automatic handling of missing values
- Categorical feature encoding
- Feature alignment between datasets
- Label encoding for attack classes
-
Model Training
- CNN-LSTM architecture for temporal pattern detection
- Tree-based models for feature importance analysis
- Ensemble meta-classifier combining predictions
-
Evaluation Metrics
- Accuracy, Precision, Recall, F1-Score
- Confusion matrix visualization
- ROC curve analysis
- Cross-validation scores
| Model | Accuracy |
|---|---|
| CNN-LSTM | 69.27% |
| Random Forest | 72.23% |
| XGBoost | 72.27% |
| Stacked Ensemble | 72.27% |
Trained models are saved to:
/content/drive/MyDrive/IDS_Models/
├── cnn_lstm_model.pth
├── random_forest_model.pkl
├── xgboost_model.pkl
└── stacked_meta_classifier.pkl
- Fork the repository
- Create a feature branch (
git checkout -b feature/YourFeature) - Commit changes (
git commit -m 'Add YourFeature') - Push to branch (
git push origin feature/YourFeature) - Open a pull request
MIT License - Copyright (c) 2024 Pragadeesh V and Yuvan Shankar Raja S
- Pragadeesh V
- Yuvan Shankar Raja S
This README.md incorporates:
1. Clear project structure documentation
2. Detailed installation and usage instructions
3. Comprehensive performance metrics
4. Explicit model persistence paths
5. Visualization references
6. Contribution guidelines
The content aligns with your code's functionality and follows best practices from the provided references . Remember to:
1. Replace placeholder paths with your actual Google Drive paths
2. Add your name to the license section
3. Include generated visualization files in the specified directory
4. Create a `requirements.txt` file with all dependencies
Would you like me to add any additional sections or modify existing content?


