Instructions to use dev9269/malware-detector-rf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use dev9269/malware-detector-rf with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("dev9269/malware-detector-rf", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Add model file + comprehensive model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: sklearn
|
| 4 |
+
tags:
|
| 5 |
+
- malware-detection
|
| 6 |
+
- cybersecurity
|
| 7 |
+
- random-forest
|
| 8 |
+
- pe-files
|
| 9 |
+
- security
|
| 10 |
+
datasets:
|
| 11 |
+
- dev9269/darkweb-slang-dictionary
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Malware Detector - Random Forest
|
| 15 |
+
|
| 16 |
+
A Random Forest classifier for PE (Portable Executable) malware detection, trained on the EMBER dataset.
|
| 17 |
+
|
| 18 |
+
## Model Details
|
| 19 |
+
|
| 20 |
+
- **Model Type**: Random Forest Classifier (scikit-learn)
|
| 21 |
+
- **Training Data**: EMBER dataset (features from PE file headers, sections, imports, exports, etc.)
|
| 22 |
+
- **Framework**: scikit-learn (LightGBM backend)
|
| 23 |
+
- **Input**: Extracted PE feature vector (2381 dimensions)
|
| 24 |
+
- **Output**: Malicious / Benign classification with confidence score
|
| 25 |
+
|
| 26 |
+
## Usage
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
import joblib
|
| 30 |
+
import numpy as np
|
| 31 |
+
|
| 32 |
+
model = joblib.load("model.pkl")
|
| 33 |
+
features = np.load("sample_features.npy") # 2381-dim feature vector
|
| 34 |
+
prediction = model.predict([features])[0]
|
| 35 |
+
confidence = model.predict_proba([features])[0]
|
| 36 |
+
|
| 37 |
+
print(f"Malicious: {bool(prediction)}")
|
| 38 |
+
print(f"Confidence: {max(confidence):.2%}")
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
## Performance
|
| 42 |
+
|
| 43 |
+
| Metric | Score |
|
| 44 |
+
|--------|-------|
|
| 45 |
+
| Accuracy | ~96% |
|
| 46 |
+
| Precision | ~0.95 |
|
| 47 |
+
| Recall | ~0.94 |
|
| 48 |
+
| F1 Score | ~0.94 |
|
| 49 |
+
|
| 50 |
+
## Related Models
|
| 51 |
+
|
| 52 |
+
- [ember-malware-rf](https://huggingface.co/dev9269/ember-malware-rf) - EMBER-trained variant
|
| 53 |
+
- [malware-detector-demo](https://huggingface.co/spaces/dev9269/malware-detector-demo) - Interactive demo Space
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f16366728343c7c6fb09fc89e34ab6fa9a19cf0ab740cfdd3f767649cde86f8a
|
| 3 |
+
size 17082089
|