Tabular Classification
Scikit-learn
English
stacking-ensemble
xgboost
catboost
lightgbm
adaboost
randomforest
Eval Results (legacy)
Instructions to use mrsindhunugroho/stacking-ensemble-learning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use mrsindhunugroho/stacking-ensemble-learning with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("mrsindhunugroho/stacking-ensemble-learning", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
metrics:
|
| 6 |
+
- accuracy
|
| 7 |
+
pipeline_tag: tabular-classification
|
| 8 |
+
library_name: sklearn
|
| 9 |
+
tags:
|
| 10 |
+
- stacking-ensemble
|
| 11 |
+
- xgboost
|
| 12 |
+
- catboost
|
| 13 |
+
- lightgbm
|
| 14 |
+
- adaboost
|
| 15 |
+
- randomforest
|
| 16 |
+
model-index:
|
| 17 |
+
- name: stacking-ensemble-learning
|
| 18 |
+
results:
|
| 19 |
+
- task:
|
| 20 |
+
type: tabular-classification
|
| 21 |
+
name: Network Intrusion Detection
|
| 22 |
+
dataset:
|
| 23 |
+
name: CSE-CIC-IDS2018 Cleaned
|
| 24 |
+
type: cicids2018
|
| 25 |
+
url: https://www.kaggle.com/datasets/ekkykharismadhany/csecicids2018-cleaned
|
| 26 |
+
metrics:
|
| 27 |
+
- type: accuracy
|
| 28 |
+
value: 1.0
|
| 29 |
+
name: Accuracy (Meta Model)
|
| 30 |
+
- type: f1
|
| 31 |
+
value: 1.0
|
| 32 |
+
name: F1 Score (Meta Model)
|
| 33 |
+
- type: precision
|
| 34 |
+
value: 1.0
|
| 35 |
+
name: Precision (Meta Model)
|
| 36 |
+
- type: recall
|
| 37 |
+
value: 1.0
|
| 38 |
+
name: Recall (Meta Model)
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
# IDS Stacking Ensemble Learning
|
| 42 |
+
|
| 43 |
+
Stacking ensemble (XGBoost + CatBoost + LightGBM + AdaBoost) for base mdoel with Random Forest as meta-model for Network Intrusion Detection System (IDS).
|
| 44 |
+
|
| 45 |
+
## Metrics (test set)
|
| 46 |
+
|
| 47 |
+
| Model | Accuracy | F1 |
|
| 48 |
+
|-------|----------|----|
|
| 49 |
+
| XGBoost | 1.0000 | 1.0000 |
|
| 50 |
+
| CatBoost | 0.9998 | 0.9998 |
|
| 51 |
+
| LightGBM | 0.4441 | 0.5403 |
|
| 52 |
+
| AdaBoost | 0.9911 | 0.9907 |
|
| 53 |
+
|
| 54 |
+
## Requirements
|
| 55 |
+
|
| 56 |
+
```bash
|
| 57 |
+
pip install scikit-learn xgboost catboost lightgbm pandas numpy joblib huggingface_hub
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Usage
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
import joblib
|
| 64 |
+
import numpy as np
|
| 65 |
+
from huggingface_hub import hf_hub_download
|
| 66 |
+
|
| 67 |
+
models = {k: joblib.load(hf_hub_download("mrsindhunugroho/stacking-ensemble-learning", f"models/{k}_model.pkl"))
|
| 68 |
+
for k in ["xgboost", "catboost", "lightgbm", "adaboost"]}
|
| 69 |
+
meta = joblib.load(hf_hub_download("mrsindhunugroho/stacking-ensemble-learning", "models/meta_model.pkl"))
|
| 70 |
+
le = joblib.load(hf_hub_download("mrsindhunugroho/stacking-ensemble-learning", "models/label_encoder.pkl"))
|
| 71 |
+
|
| 72 |
+
base_preds = np.column_stack([m.predict(X) for m in models.values()])
|
| 73 |
+
y_pred = le.inverse_transform(meta.predict(base_preds))
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
## Dataset
|
| 77 |
+
|
| 78 |
+
- **Source:** Kaggle — [CSE-CIC-IDS2018 Cleaned](https://www.kaggle.com/datasets/ekkykharismadhany/csecicids2018-cleaned)
|
| 79 |
+
- **Original:** Canadian Institute for Cybersecurity (CSE-CIC-IDS2018)
|
| 80 |
+
- **Preprocessing:** sampling, label encoding, imputation, feature sanitization
|
| 81 |
+
|
| 82 |
+
## Author
|
| 83 |
+
|
| 84 |
+
Sindhu Nugroho — [ORCID](https://orcid.org/0009-0002-1558-4574)
|