Views
No views yet
Input Features
│
┌───▼───┐
│ Input │
│Project │
└───┬───┘
│
┌───▼───────────┐ ┌──────────────────┐
│ Multi-Scale │────▶│ CNN Context │
│ CNN Extractor │ │ (3 scales: 1,3,5) │
└───┬───────────┘ └──────┬───────────┘
│ │
│ ┌───────────────────┘
│ │
┌───▼────▼───────────┐
│ Hybrid Attention │ × N layers
│ ┌─────────────────┐│
│ │Self-Attn + RoPE ││
│ ├─────────────────┤│
│ │Gated Cross-Attn ││
│ ├─────────────────┤│
│ │SwiGLU FFN ││
│ └─────────────────┘│
└────────┬───────────┘
│
┌────────▼───────────┐
│ Attention Pooling │
└────────┬───────────┘
│
┌────────▼───────────┐
│ MoE Classifier │
│ (4 experts + gate) │
└────────┬───────────┘
│
Predictions| Metric | Score |
|---|---|
| Accuracy | 77.52% |
| F1-Macro | 74.61% |
| F1-Weighted | 76.14% |
| Precision | 80.75% |
| Recall | 73.83% |
| AUC-ROC | 88.39% |
| Metric | Score |
|---|---|
| Accuracy | 98.77% |
| F1-Macro | 97.03% |
| F1-Weighted | 98.80% |
| Precision | 95.02% |
| Recall | 99.31% |
| AUC-ROC | 99.94% |
1import torch
2from model import CyberHybridNet
3
4# Load model
5model = CyberHybridNet(
6 input_dim=78, # CICIDS2017 features
7 num_classes=3, # BENIGN, ATTACK, UNKNOWN
8 hidden_dim=128,
9 num_layers=4,
10 num_heads=8,
11 num_experts=4,
12)
13model.load_state_dict(torch.load("model.pt"))
14model.eval()
15
16# Predict
17with torch.no_grad():
18 features = torch.randn(1, 78) # Your preprocessed features
19 logits, gate_probs = model(features)
20 prediction = logits.argmax(dim=-1)