Network Traffic Prediction System

Machine learning models for predicting network traffic metrics from Wireshark packet data.

Models

This repository contains three Gradient Boosting regression models:

  • Throughput/Bandwidth β€” predicts throughput in Mbps
  • Packet Count β€” predicts packets per second
  • Link Utilization β€” predicts link utilization percentage

Model Performance

Model RΒ² MAE RMSE
Throughput 1.0000 91.9503 Mbps 686.6935
Packet Count 0.9999 0.0776 pkt/s 2.0357
Link Utilization 0.9927 0.0517% 0.3974

⚠️ Note on Model Performance

The near-perfect RΒ² scores shown above (particularly for Throughput and Packet Count) result from the current feature set including the target variable itself as an input feature. This means these two models are not true forward-forecasting models in their current form β€” they reflect a strong correlation/reconstruction task rather than genuine prediction from independent inputs.

The Link Utilization model is less affected, though it is derived from throughput and may carry a similar effect.

This is disclosed for transparency. A corrected version would exclude the target column from its own feature set during training.

Input Features

The models use these features:

fwd_packets
bwd_packets
fwd_bytes
bwd_bytes
fwd_pkt_len_mean
bwd_pkt_len_mean
iat_mean
throughput_mbps
packet_count

Framework

  • Python
  • scikit-learn
  • NumPy
  • Pandas
  • Joblib

Model Files

The trained models, scalers, feature definitions, metrics, and feature-importance plots are available in the kaggle_models/ directory.

Predicted Outputs

  • Throughput/Bandwidth β€” "At 3:00 PM tomorrow, the incoming traffic will be X Gbps."
  • Packet Count β€” "We expect X,XXX packets per second during the next 10-minute window."
  • Link Utilization β€” "The backbone link will be at X% capacity between T1 and T2."

Quick Start

1. Install dependencies

pip install -r requirements.txt

2. Run with your Wireshark data

Hex-dump .txt file (from Wireshark Edit β†’ Export β†’ as Plain Text):

python run.py your_capture.txt

pcapng file:

python run.py your_capture.pcapng

Demo mode (no file needed):

python run.py

3. Options

--window N      Aggregation window in seconds (default: 1)
--model-dir     Directory to save trained models (default: models/)
--output-dir    Directory for reports/charts (default: output/)
--no-plots      Skip matplotlib chart generation

Output Files

output/
β”œβ”€β”€ prediction_output.txt       ← Human-readable report
β”œβ”€β”€ prediction_report.json      ← Machine-readable JSON
└── plots/
    β”œβ”€β”€ dashboard.png           ← Full prediction dashboard
    β”œβ”€β”€ protocol_distribution.png
    └── traffic_timeseries.png

models/
β”œβ”€β”€ throughput_mbps_model.pkl
β”œβ”€β”€ throughput_mbps_scaler.pkl
β”œβ”€β”€ packet_count_model.pkl
β”œβ”€β”€ packet_count_scaler.pkl
β”œβ”€β”€ link_util_pct_model.pkl
└── link_util_pct_scaler.pkl

Supported File Formats

Format Description
.txt Wireshark hex-dump text export
.pcapng Wireshark native capture format

How to export hex dump from Wireshark

  1. Open your .pcapng in Wireshark
  2. Go to File β†’ Export Packet Dissections β†’ As Plain Text
  3. Check Packet bytes option
  4. Save as .txt

Architecture

Raw Packets (.txt / .pcapng)
        β”‚
        β–Ό
  Parser (Layer 2/3/4 decode)
        β”‚
        β–Ό
  Feature Engineering (1s windows)
  β€’ packet_count, total_bytes, throughput
  β€’ protocol mix, unique IPs
  β€’ lag features (1,2,3,5 steps)
  β€’ rolling averages (3,5,10 windows)
        β”‚
        β–Ό
  Gradient Boosting Regressor (Γ—3)
  β€’ Model 1 β†’ Throughput (Mbps)
  β€’ Model 2 β†’ Packet Count (pkt/s)
  β€’ Model 3 β†’ Link Utilization (%)
        β”‚
        β–Ό
  Predictions + Report + Charts

No Paid APIs

Everything runs 100% locally using free open-source libraries:

  • scikit-learn (ML)
  • pandas / numpy (data)
  • matplotlib (charts)
  • joblib (model persistence)
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support