Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: clearn
|
| 3 |
+
tags:
|
| 4 |
+
- continual-learning
|
| 5 |
+
- catastrophic-forgetting
|
| 6 |
+
- ewc
|
| 7 |
+
- pytorch
|
| 8 |
+
license: mit
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# clearn Demo: EWC Continual Learning
|
| 12 |
+
|
| 13 |
+
This model was trained with [clearn](https://github.com/itisrmk/clearn) β a continual learning library for PyTorch.
|
| 14 |
+
|
| 15 |
+
## What is this?
|
| 16 |
+
|
| 17 |
+
A simple MLP trained on **3 sequential fraud detection tasks** using Elastic Weight Consolidation (EWC). Despite learning 3 tasks sequentially, the model retains 100% accuracy on all previous tasks.
|
| 18 |
+
|
| 19 |
+
## How to use
|
| 20 |
+
|
| 21 |
+
```bash
|
| 22 |
+
pip install clearn-ai
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
```python
|
| 26 |
+
import clearn
|
| 27 |
+
import torch.nn as nn
|
| 28 |
+
|
| 29 |
+
# Recreate the architecture
|
| 30 |
+
model = nn.Sequential(nn.Linear(128, 256), nn.ReLU(), nn.Linear(256, 10))
|
| 31 |
+
|
| 32 |
+
# Load the continual learning checkpoint
|
| 33 |
+
cl_model = clearn.load("./checkpoint", model=model)
|
| 34 |
+
|
| 35 |
+
# See retention across all tasks
|
| 36 |
+
print(cl_model.diff())
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Retention Report
|
| 40 |
+
|
| 41 |
+
```
|
| 42 |
+
RetentionReport
|
| 43 |
+
βββ fraud_q1: 100.0% retained
|
| 44 |
+
βββ fraud_q2: 100.0% retained
|
| 45 |
+
βββ fraud_q3: 100.0% retained
|
| 46 |
+
βββ plasticity_score: 1.00
|
| 47 |
+
βββ stability_score: 1.00
|
| 48 |
+
βββ recommendation: "stable β no action needed"
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## Strategy
|
| 52 |
+
|
| 53 |
+
- **Strategy**: EWC (Elastic Weight Consolidation)
|
| 54 |
+
- **Lambda**: 5000
|
| 55 |
+
- **Tasks**: 3 sequential fraud detection tasks
|
| 56 |
+
- **Architecture**: MLP (128 β 256 β 10)
|
| 57 |
+
|
| 58 |
+
Built with [clearn](https://github.com/itisrmk/clearn) β *Wrap once. Train forever.*
|