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 | |
| Model Format | Joblib |
Selected Features
The model uses the following ten features selected through permutation feature importance:
Init_Win_bytes_forwardflow_finInit_Win_bytes_backwardmax_fpktlmax_flowpktldurationtotal_fpktlavgPacketSizedownUpRatiomean_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.
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.