Downloads · 30 days
0
netgoat-ai/koda-nids
koda-nids is a machine learning model from netgoat-ai. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for xgboost. The card lists the license as mit.
Koda-NIDS is a high-performance gradient-boosted decision tree classifier designed to identify malicious network activity. Built on the UNSW-NB15 dataset, it provides a robust defense mechanism for identifying various…
Downloads · 30 days
0
Access
Public
Updated Apr 4, 2026
Repo size
1.5 KB
Likes
0
Public
Click a slice to open those files.
.json1.4 MB · 100%
From the Hugging Face model README
Koda-NIDS is a high-performance gradient-boosted decision tree classifier designed to identify malicious network activity. Built on the UNSW-NB15 dataset, it provides a robust defense mechanism for identifying various network attacks through behavioral flow analysis.
| Field | Value |
|---|---|
| Model Name | Koda-NIDS |
| Model Type | XGBoost Classifier |
| Task | Binary Network Intrusion Detection (NIDS) |
| Input Features | 42 network flow features (duration, protocols, TTL, etc.) |
| Target | label — 0: Normal, 1: Attack |
Evaluated on UNSW_NB15_testing-set.csv (175,341 samples), Koda-NIDS demonstrates strong generalization and exceptional precision in identifying threats.
| Metric | Value |
|---|---|
| Test Accuracy | 89.54% |
| Macro Avg Precision | 0.88 |
| Macro Avg Recall | 0.92 |
| Macro Avg F1-Score | 0.89 |
| Weighted Avg F1-Score | 0.90 |
| Class | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
0 Normal | 0.76 | 0.98 | 0.86 | 56,000 |
1 Attack | 0.99 | 0.86 | 0.92 | 119,341 |
| Rank | Feature | Importance | Description |
|---|---|---|---|
| 1 | sttl | 34.2% | Source Time-to-Live — high importance in identifying packet origin anomalies |
| 2 | ct_dst_sport_ltm | 10.7% | Concentration of connections to the same destination and source port |
| 3 | tcprtt | 9.1% | TCP round-trip time metrics |
| 4 | ct_dst_src_ltm | 5.5% | Density of connections between specific host pairs |
| 5 | synack | 5.3% | Timing of the TCP three-way handshake |
To deploy Koda-NIDS, ensure you have both the model weights (xgb_intrusion_model.json) and the associated label encoders (label_encoders.pkl).
import xgboost as xgb
import pickle
import pandas as pd
# 1. Load the Koda-NIDS brain
model = xgb.XGBClassifier()
model.load_model("xgb_intrusion_model.json")
# 2. Load the specific encoders for proto, service, and state
with open("label_encoders.pkl", "rb") as f:
encoders = pickle.load(f)
# 3. Predict
# Ensure your input data is preprocessed using the exact same logic
# found in the training pipeline.
The model expects raw network features to be cleaned as follows:
proto, service, state) must be lowercased and stripped of whitespace.label_encoders.pkl.0. Unseen categorical labels should be mapped to the missing category defined during training..pcap files directly without a feature extraction layer.If you use Koda-NIDS in your research, please cite the underlying dataset:
Moustafa, Nour, and Jill Slay. "UNSW-NB15: a comprehensive data set for network intrusion detection systems (UNSW-NB15 network data set)." Military Communications and Information Systems Conference (MilCIS), 2015.