File size: 4,443 Bytes
2c31a39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bc57842
2c31a39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
---
license: apache-2.0
tags:
- anomaly-detection
- tabular-data
- in-context-learning
- one-class-classification
- unsupervised-learning
- semi-supervised-learning
---

# ICLAD Pretrained Checkpoints

**ICLAD: In-Context Learning for Unified Tabular Anomaly Detection**

This repository contains pretrained model checkpoints for ICLAD, an in-context learning framework for tabular anomaly detection that supports one-class, unsupervised, and semi-supervised settings.

📄 **Paper:** [ICLAD: In-Context Learning for Unified Tabular Anomaly Detection Across Supervision Regimes](https://arxiv.org/abs/2603.19497)

## Model Variants

### 1. [ICLAD]  `iclad_mixedprior_unified.pth` (Default)

General use across all anomaly detection scenarios

- Trained on **mixed prior** (structural causal models (SCMs) and perturbation noises)
- Supports all three settings: **one-class**, **unsupervised**, and **semi-supervised**
- **Recommended as the default choice** for most use cases

---

### 2. [ICLAD_OC]  `iclad_mixedprior_oneclass.pth`

Used for ablation studies.

- Trained on **mixed prior** optimized for **one-class setting only**
- **Note:** Use `iclad_mixedprior_unified.pth` for general one-class applications

---

### 3. [ICLAD_UNSUP]  `iclad_mixedprior_unsup.pth`

Used for ablation studies.

- Trained on **mixed prior** optimized for **unsupervised setting only**
- **Note:** Use `iclad_mixedprior_unified.pth` for general unsupervised applications

---

### 4. [ICLAD_SCM]  `iclad_scm_unified.pth`

Used for ablation studies.

- Trained on **SCM-only prior** (no perturbation-based noise)
- Supports all three settings: **one-class**, **unsupervised**, and **semi-supervised**
- **Note:** Use `iclad_mixedprior_unified.pth` for general applications

---

## Usage

### ⭐ Recommended: Use the Unified Model

**For most applications, use `iclad_mixedprior_unified.pth`** (the default). The other variants are provided for research and paper reproduction purposes.

### Option 1: Load from Hugging Face Hub

```python
from iclad import ICLAD

# Load default unified model (works for all settings)
model = ICLAD.from_checkpoint("jyiwei/iclad-checkpoints/iclad_mixedprior_unified.pth")
```

### Option 2: Load from Local Checkpoints

If you have the checkpoint files in `src/iclad/checkpoints/`, use the built-in names:

```python
from iclad import ICLAD

# ⭐ RECOMMENDED: Load default unified model
model = ICLAD()  # Uses iclad_mixedprior_unified by default
model = ICLAD(model_name="ICLAD")

# --- Paper Reproduction Only (below) ---

# Load one-class variant
model = ICLAD(model_name="ICLAD_OC")

# Load unsupervised variant
model = ICLAD(model_name="ICLAD_UNSUP")

# Load SCM-only variant
model = ICLAD(model_name="ICLAD_SCM")
```

### Example: Anomaly Detection on Tabular Data

```python
import numpy as np
from iclad import ICLAD

# Initialize model
model = ICLAD(model_name="ICLAD")  # Default unified model

# Prepare training and test data
X_train = np.random.randn(100, 10)  # 100 samples, 10 features
X_test = np.random.randn(50, 10)    # Test data

# Fit on training data (for unsupervised setting, no labels needed)
model.fit(X_train)

# Get anomaly scores
scores = model.predict_score(X_test)
```

### One-class Example

```python
# Prepare training and test data
X_train = np.random.randn(100, 10)  # 100 samples, 10 features
Y_train = np.zeros(X_train.shape[0]) # All normal
X_test = np.random.randn(50, 10)    # Test data

# Fit on training data (for one-class setting, all labels should be zero)
model.fit(X_train, Y_train)

# Get anomaly scores
scores = model.predict_score(X_test)
```

### Semi-Supervised Example

```python
# y_train: 1 for anomaly, -1 for unknown (no support for known normals yet)
model.fit(X_train, Y_train)
scores = model.predict_score(X_test)
```

## Citation

If you use these pretrained models in your research, please cite:

```bibtex
@misc{wei2026icladincontextlearningunified,
  title={ICLAD: In-Context Learning for Unified Tabular Anomaly Detection Across Supervision Regimes},
  author={Jack Yi Wei and Narges Armanfard},
  year={2026},
  eprint={2603.19497},
  archivePrefix={arXiv},
  primaryClass={cs.LG},
  url={https://arxiv.org/abs/2603.19497},
}
```

## License

The model code is licensed under the **Apache License 2.0**.

## Repository

For issues, discussions, and more information, please visit the main ICLAD repository.

## Contact

Jack Wei: yi.wei4@mail.mcgill.ca