File size: 3,964 Bytes
83dbdd2 0090f24 83dbdd2 0090f24 b17f28f 0917441 b17f28f 0917441 b17f28f 0090f24 0917441 0090f24 0917441 0090f24 0917441 0090f24 0917441 0090f24 f04a745 0090f24 0917441 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | ---
license: apache-2.0
library_name: scikit-learn
tags:
- android-malware-detection
- network-traffic-classification
- random-forest
- cybersecurity
- machine-learning
---
# Android Malware Traffic Classification Model
## Overview
This repository contains a trained Random Forest machine learning model developed to classify Android-related network traffic as either benign or malicious (Asware).
The model was developed using network traffic features and a supervised machine learning approach.
## Model Details
|Property |Description |
|------------------------------------|--------------------------|
| Model | Random Forest Classifier |
| Task | Binary Classification |
| Benign Class | 0 |
| Malicious Class | 1 (Asware) |
| Number of Selected Features | 10 |
| Number of Trees | 200 |
| Maximum Depth | None |
| Minimum Samples per Leaf | 2 |
| Class Weight | Balanced |
| Decision Threshold | |0.473 |
| Model Format | Joblib |
## Selected Features
The model uses the following ten features selected through permutation feature importance:
1. `Init_Win_bytes_forward`
2. `flow_fin`
3. `Init_Win_bytes_backward`
4. `max_fpktl`
5. `max_flowpktl`
6. `duration`
7. `total_fpktl`
8. `avgPacketSize`
9. `downUpRatio`
10. `mean_fpktl`
## Model Performance
The model was evaluated on a held-out test dataset containing 53,995 observations.
| Evaluation Metric | Score |
|---------------------|-------:|
| Accuracy | 93.96% |
| Malicious Precision | 91.02% |
| Malicious Recall | 91.42% |
| Malicious F1-Score | 91.22% |
| Specificity | 95.28% |
| ROC-AUC | 0.982 |
The decision threshold of 0.473 was selected using validation data and applied unchanged during final test evaluation.
## Decision Threshold
The model uses a threshold of `0.473` to classify network traffic:
- Probability greater than or equal to `0.473`: Malicious (Asware).
- Probability below `0.473`: Benign.
## Loading the Model
The trained model was saved using Joblib.
```python
import joblib
# Load the trained model artifact
model_artifacts = joblib.load("android_malware_model.joblib")
# Extract the fitted pipeline
model = model_artifacts["model"]
# Extract the decision threshold
threshold = model_artifacts["threshold"]
# Extract the selected features
features = model_artifacts["features"]
# Extract the class mapping
class_mapping = model_artifacts["class_mapping"]
```
The model artifact contains the fitted preprocessing and classification pipeline, decision threshold, selected features, and class mapping.
## Usage
Input data must contain the ten selected features with the same names and compatible data types used during model training.
For predictions, use the prediction function provided in the associated GitHub project.
## Limitations
- Performance on independently collected network traffic may differ.
- Changes in malware prevalence and network traffic characteristics may affect prediction performance.
- Further evaluation using representative operational data is recommended before real-world deployment.
## Related Project
The source code, notebooks, data preparation procedures, and project documentation are maintained in the associated GitHub repository.
**GitHub Repository:** https://github.com/aquarmbrightseventyseven/android-malware-traffic-classification
## License
This model repository is distributed under the Apache License 2.0, subject to the licensing conditions of any third-party materials incorporated into the model or project. |