| --- |
| license: mit |
| language: |
| - en |
| tags: |
| - intrusion-detection |
| - network-logs |
| - cybersecurity |
| pretty_name: Network Traffic Dataset |
| --- |
| |
| # Network Traffic Detection Dataset |
|
|
| A curated dataset for **network traffic anomaly detection**, derived from the **[BCCC-CSE-CIC-IDS2018](https://www.yorku.ca/research/bccc/ucs-technical/cybersecurity-datasets-cds/large-scale-intrusion-detection-dataset-bccc-cse-cic-ids2018/)** intrusion detection dataset, which itself is an enhanced version of [CSE-CIC-IDS2018](https://www.unb.ca/cic/datasets/ids-2018.html) |
| This dataset is restructured for modern machine learning and deep learning research on **network security** and **intrusion detection**. |
|
|
| > [!IMPORTANT] |
| > The raw dataset (~90GB) was fragmented across 34 `.csv` files. To optimize for ML workflows, the data was merged and compressed into `.parquet` chunks using the `polars` Python library. |
| > During the merge, 18 columns exhibited data-type mismatches (e.g., containing both `float64` values and strings like *"not a complete handshake"*). To resolve this, these specific columns were type-cast to `Utf8`. |
| > - [View Schema Comparison Output](https://huggingface.co/datasets/init5iv3/network-traffic-detection/raw/main/schema_comparison_output.txt) |
| > - [View Merge Script](https://huggingface.co/datasets/init5iv3/network-traffic-detection/raw/main/merge-upload.py) |
|
|
| ## Usage |
|
|
| > [!IMPORTANT] |
| > This dataset is large (~90GB uncompressed). \ |
| > Attempting to load the entire dataset into memory at once (e.g., via `pd.read_parquet()` or `dataset.to_pandas()`) will cause Out-of-Memory (OOM) crashes on some machines. \ |
| > To safely use this dataset, separate the download step from the ingestion step, and process the data using lazy evaluation or batching. |
|
|
| ### Accessing & Downloading the Data |
| Choose the method that best fits your system's constraints: \ |
| _Hugging Face docs on [downloading datasets](https://huggingface.co/docs/hub/datasets-downloading)_ |
|
|
| [datasets](https://huggingface.co/docs/hub/datasets-usage) \ |
| _downloads the dataset using Apache Arrow_ |
| ```python |
| from datasets import load_dataset |
| |
| dataset = load_dataset("init5iv3/network-traffic-detection", split="train") |
| ``` |
|
|
| [streaming with datasets](https://huggingface.co/docs/datasets/v4.8.4/en/stream) \ |
| _Iterate through the data over the network without downloading the entire dataset to disk_ |
| ```python |
| from datasets import load_dataset |
| |
| dataset = load_dataset("init5iv3/network-traffic-detection", split="train", streaming=True) |
| ``` |
|
|
| local download via [CLI](https://huggingface.co/docs/hub/datasets-downloading#using-the-hugging-face-client-library) \ |
| _download `.parquet` files to a local directory_ |
| ```bash |
| hf download --quiet init5iv3/network-traffic-detection --repo-type dataset --local-dir /path/to/dir |
| ``` |
|
|
| local download via [snapshot_download](https://huggingface.co/docs/huggingface_hub/en/guides/download#download-an-entire-repository) \ |
| _download `.parquet` files to a local directory_ |
| ```python |
| from huggingface_hub import snapshot_download |
| |
| snapshot_download( |
| repo_id="init5iv3/network-traffic-detection", |
| repo_type="dataset", |
| local_dir="/path/to/dir", |
| allow_patterns="*.parquet", |
| resume_download=True |
| ) |
| ``` |
|
|
| virtual mounting with [hf-mount](https://github.com/huggingface/hf-mount) |
| ```bash |
| hf-mount start repo init5iv3/network-traffic-detection /path/to/local/mount |
| ``` |
|
|
| ### Ingesting/Processing |
|
|
| [polars](https://huggingface.co/docs/datasets/use_with_polars) \ |
| _if the dataset was downloaded locally, `polars` can lazily scan the fragmented `.parquet` files in chunks_ |
| ```python |
| import polars as pl |
| |
| df_lazy = pl.scan_parquet("/path/to/dir/**/*.parquet") |
| |
| label_counts = df_lazy.select("label").value_counts().collect() |
| ``` |
|
|
| batch-processing with `datasets` library |
| ```python |
| from datasets import load_dataset |
| |
| dataset = load_dataset("init5iv3/network-traffic-detection", split="train") |
| |
| for batch in dataset.iter(batch_size=10000): |
| # process features here. |
| pass |
| ``` |
|
|
|
|
| ## Overview |
|
|
| Raw intrusion detection datasets like BCCC-CSE-CIC-IDS2018 are large, fragmented across multiple files, and often difficult to use directly for ML experiments. \ |
| This dataset was created to provide an ML-ready format to the raw data, containing over 300 network flow features extracted via [NTLFlowLyzer](https://github.com/ahlashkari/NTLFlowLyzer). \ |
| It is suitable for binary and multi-class classification. |
|
|
| ## Labels |
|
|
| ### Binary Classification |
| 1. **Benign** |
| 2. **Non-benign:** Aggregated from all specific attack classes below |
|
|
| ### Multi‑Class Classification |
| - Benign |
| - DoS-Hulk |
| - DoS-Slowhttptest |
| - DoS-GoldenEye |
| - DoS-Slowloris |
| - DDoS-LOIC |
| - DDoS-HOIC |
| - Brute-Force-XSS |
| - Brute-Force-Web |
| - Brute-Force-FTP |
| - Brute-Force-SSH |
| - SQL-Injection |
| - Botnet |
| - Infiltration |
|
|
| ## Citation |
|
|
| If you use this dataset, please cite both this repository and the original source: |
|
|
| ### This dataset |
|
|
| ```bibtex |
| @misc{init5iv32026networktraffic, |
| title={Network Traffic Dataset}, |
| author={init5iv3}, |
| year={2026}, |
| publisher={Hugging Face}, |
| url={https://huggingface.co/datasets/init5iv3/network-traffic-detection} |
| } |
| ``` |
|
|
| ### Original dataset (BCCC-CSE-CIC-IDS2018) and paper |
|
|
| ```bibtex |
| @misc{bccc_cse_cic_ids2018_dataset, |
| title={BCCC-CSE-CIC-IDS2018: Large-Scale Intrusion Detection Dataset}, |
| author={Shafi, MohammadMoein and Lashkari, Arash Habibi and Roudsari, Arousha Haghighian}, |
| year={2025}, |
| publisher={Behaviour-Centric Cybersecurity Center - York University}, |
| url={https://www.yorku.ca/research/bccc/ucs-technical/cybersecurity-datasets-cds/large-scale-intrusion-detection-dataset-bccc-cse-cic-ids2018/} |
| } |
| |
| @article{shafi2025toward, |
| title={Toward Generating a Large Scale Intrusion Detection Dataset and Intruders Behavioral Profiling Using Network and Transportation Layers Traffic Flow Analyzer (NTLFlowLyzer)}, |
| author={Shafi, MohammadMoein and Lashkari, Arash Habibi and Roudsari, Arousha Haghighian}, |
| journal={Journal of Network and Systems Management}, |
| volume={33}, |
| number={44}, |
| year={2025}, |
| publisher={Springer} |
| } |
| ``` |
|
|
| ## License |
|
|
| This dataset is released under the **MIT License**. |
| The original **BCCC-CSE-CIC-IDS2018** dataset is subject to its own licensing terms. |
|
|
| ## Contributions |
|
|
| Feedback is welcome via the [community page](https://huggingface.co/datasets/init5iv3/network-traffic-detection/discussions) |