This project implements a quantum machine learning model for anomaly detection in network traffic using TensorFlow Quantum and Cirq. It demonstrates a Variational Quantum Classifier (VQC) for binary classification of network traffic as normal or anomalous.
TensorFlow Quantum is not supported natively on Apple Silicon (M1/M2/M3) Macs.
- If you are using an Apple Silicon Mac, you will not be able to install TensorFlow Quantum directly via pip.
- The recommended way to run this project is via Google Colab, which provides a compatible environment and free access to GPUs.
-
Open Google Colab:
-
Upload the Project Files:
- Click on the folder icon in the left sidebar.
- Click the upload icon and upload
main.py
andrequirements.txt
from this repository.
-
Install Dependencies:
- At the top of your Colab notebook, run the following cell to install all required packages:
!pip install -r requirements.txt
- At the top of your Colab notebook, run the following cell to install all required packages:
-
Run the Main Script:
- In a new cell, run:
!python main.py
- In a new cell, run:
-
(Optional) Edit and Experiment:
- You can edit
main.py
directly in Colab or upload new versions as needed.
- You can edit
main.py
— Main script containing the quantum anomaly detection pipeline.requirements.txt
— List of required Python packages.
- The script will generate a synthetic sample dataset (
CICIDS2017_sample.csv
) if not present. Request are required https://www.yorku.ca/research/bccc/ucs-technical/cybersecurity-datasets-cds/ https://www.unb.ca/cic/datasets/ids-2017.html
MIT