Introduction
In this lab, students will explore how to detect anomalies in network traffic using a Variational Autoencoder (VAE). Anomalies indicate unusual or suspicious patterns that could suggest a security breach or network attack.
Objectives
- Understand how VAEs work for anomaly detection.
- Train the VAE on network traffic data.
- Detect and analyze anomalies in a given dataset.
Lab Steps
1. Dataset Preparation:
- Load the network traffic dataset.
- Preprocess the data (normalize features and encode labels).
2. Train the VAE:
- Train the VAE model using the provided dataset.
- Plot the training and reconstruction loss.
3. Anomaly Detection:
- Use the trained VAE to calculate anomaly scores.
- Compare anomaly scores to a threshold to classify anomalies.
4. Evaluation:
- Analyze the percentage of anomalies detected.
- Visualize results using graphs.
Visualization of expected results: