Upload model_card.md
Browse files- model_card.md +68 -0
model_card.md
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- pytorch
|
4 |
+
- anomaly-detection
|
5 |
+
- time-series
|
6 |
+
- gru
|
7 |
+
- sequence-model
|
8 |
+
- binary-classification
|
9 |
+
model-index:
|
10 |
+
- name: GRU Sequence Anomaly Detector
|
11 |
+
results: []
|
12 |
+
---
|
13 |
+
|
14 |
+
# GRU Sequence Anomaly Detector
|
15 |
+
|
16 |
+
This model uses a bidirectional GRU (Gated Recurrent Unit) architecture to detect anomalies in sequential tabular data β such as transaction records, log events, or sensor readings. It's designed for general-purpose anomaly detection and can be fine-tuned on domain-specific datasets.
|
17 |
+
|
18 |
+
## π§ Model Architecture
|
19 |
+
|
20 |
+
- **Type:** Bidirectional GRU
|
21 |
+
- **Input:** Sequence of numerical feature vectors `(batch_size, time_steps, input_dim)`
|
22 |
+
- **Output:** Binary classification (0 = normal, 1 = anomaly)
|
23 |
+
- **Layers:** 2-layer GRU β BatchNorm β Dense β Sigmoid
|
24 |
+
|
25 |
+
## π οΈ Intended Use
|
26 |
+
|
27 |
+
This model is ideal for:
|
28 |
+
- Transaction anomaly detection
|
29 |
+
- Time-series pattern disruption
|
30 |
+
- Sequential event log monitoring
|
31 |
+
|
32 |
+
It is open for fine-tuning using your labeled anomaly dataset via `fine_tune_template.py`.
|
33 |
+
|
34 |
+
## π How to Use
|
35 |
+
|
36 |
+
```python
|
37 |
+
import torch
|
38 |
+
from models.model import TxnAnomalyGRU
|
39 |
+
|
40 |
+
model = TxnAnomalyGRU(input_dim=32)
|
41 |
+
model.load_state_dict(torch.load("models/txn_anomaly_model.pt"))
|
42 |
+
model.eval()
|
43 |
+
```
|
44 |
+
|
45 |
+
Or use the ONNX version with ONNX Runtime:
|
46 |
+
|
47 |
+
```python
|
48 |
+
import onnxruntime
|
49 |
+
session = onnxruntime.InferenceSession("models/txn_anomaly_model.onnx")
|
50 |
+
outputs = session.run(None, {"input": your_input_array})
|
51 |
+
```
|
52 |
+
|
53 |
+
## π Fine-Tuning
|
54 |
+
|
55 |
+
To fine-tune on your own dataset:
|
56 |
+
|
57 |
+
```bash
|
58 |
+
python fine_tune_template.py --data your_dataset.csv
|
59 |
+
```
|
60 |
+
|
61 |
+
Ensure your data is preprocessed into sequences of the same input dimension (`input_dim=32` by default).
|
62 |
+
|
63 |
+
## π¦ Files Included
|
64 |
+
|
65 |
+
- `models/txn_anomaly_model.pt` β Pretrained PyTorch model
|
66 |
+
- `models/txn_anomaly_model.onnx` β ONNX export
|
67 |
+
- `fine_tune_template.py` β Script to fine-tune on your dataset
|
68 |
+
- `pipeline/main.py` β End-to-end pipeline
|