File size: 1,377 Bytes
5c07971
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
library_name: sklearn
tags:
  - malware-detection
  - cybersecurity
  - random-forest
  - pe-files
  - security
datasets:
  - dev9269/darkweb-slang-dictionary
---

# Malware Detector - Random Forest

A Random Forest classifier for PE (Portable Executable) malware detection, trained on the EMBER dataset.

## Model Details

- **Model Type**: Random Forest Classifier (scikit-learn)
- **Training Data**: EMBER dataset (features from PE file headers, sections, imports, exports, etc.)
- **Framework**: scikit-learn (LightGBM backend)
- **Input**: Extracted PE feature vector (2381 dimensions)
- **Output**: Malicious / Benign classification with confidence score

## Usage

```python
import joblib
import numpy as np

model = joblib.load("model.pkl")
features = np.load("sample_features.npy")  # 2381-dim feature vector
prediction = model.predict([features])[0]
confidence = model.predict_proba([features])[0]

print(f"Malicious: {bool(prediction)}")
print(f"Confidence: {max(confidence):.2%}")
```

## Performance

| Metric | Score |
|--------|-------|
| Accuracy | ~96% |
| Precision | ~0.95 |
| Recall | ~0.94 |
| F1 Score | ~0.94 |

## Related Models

- [ember-malware-rf](https://huggingface.co/dev9269/ember-malware-rf) - EMBER-trained variant
- [malware-detector-demo](https://huggingface.co/spaces/dev9269/malware-detector-demo) - Interactive demo Space