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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- anomaly-detection
|
| 5 |
+
- tabular-data
|
| 6 |
+
- in-context-learning
|
| 7 |
+
- one-class-classification
|
| 8 |
+
- unsupervised-learning
|
| 9 |
+
- semi-supervised-learning
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# ICLAD Pretrained Checkpoints
|
| 13 |
+
|
| 14 |
+
**ICLAD: In-Context Learning for Unified Tabular Anomaly Detection**
|
| 15 |
+
|
| 16 |
+
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.
|
| 17 |
+
|
| 18 |
+
📄 **Paper:** [ICLAD: In-Context Learning for Unified Tabular Anomaly Detection Across Supervision Regimes](https://arxiv.org/abs/2603.19497)
|
| 19 |
+
|
| 20 |
+
## Model Variants
|
| 21 |
+
|
| 22 |
+
### 1. [ICLAD] `iclad_mixedprior_unified.pth` (Default)
|
| 23 |
+
|
| 24 |
+
General use across all anomaly detection scenarios
|
| 25 |
+
|
| 26 |
+
- Trained on **mixed prior** (structural causal models (SCMs) and perturbation noises)
|
| 27 |
+
- Supports all three settings: **one-class**, **unsupervised**, and **semi-supervised**
|
| 28 |
+
- **Recommended as the default choice** for most use cases
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
### 2. [ICLAD_OC] `iclad_mixedprior_oneclass.pth`
|
| 33 |
+
|
| 34 |
+
Used for ablation studies.
|
| 35 |
+
|
| 36 |
+
- Trained on **mixed prior** optimized for **one-class setting only**
|
| 37 |
+
- **Note:** Use `iclad_mixedprior_unified.pth` for general one-class applications
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
### 3. [ICLAD_UNSUP] `iclad_mixedprior_unsup.pth`
|
| 42 |
+
|
| 43 |
+
Used for ablation studies.
|
| 44 |
+
|
| 45 |
+
- Trained on **mixed prior** optimized for **unsupervised setting only**
|
| 46 |
+
- **Note:** Use `iclad_mixedprior_unified.pth` for general unsupervised applications
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
### 4. [ICLAD_SCM] `iclad_scm_unified.pth`
|
| 51 |
+
|
| 52 |
+
Used for ablation studies.
|
| 53 |
+
|
| 54 |
+
- Trained on **SCM-only prior** (no perturbation-based noise)
|
| 55 |
+
- Supports all three settings: **one-class**, **unsupervised**, and **semi-supervised**
|
| 56 |
+
- **Note:** Use `iclad_mixedprior_unified.pth` for general applications
|
| 57 |
+
|
| 58 |
+
---
|
| 59 |
+
|
| 60 |
+
## Usage
|
| 61 |
+
|
| 62 |
+
### ⭐ Recommended: Use the Unified Model
|
| 63 |
+
|
| 64 |
+
**For most applications, use `iclad_mixedprior_unified.pth`** (the default). The other variants are provided for research and paper reproduction purposes.
|
| 65 |
+
|
| 66 |
+
### Option 1: Load from Hugging Face Hub
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
from iclad import ICLAD
|
| 70 |
+
|
| 71 |
+
# Load default unified model (works for all settings)
|
| 72 |
+
model = ICLAD.from_checkpoint("jyiwei/iclad-checkpoints/iclad_mixedprior_unified.pth")
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
### Option 2: Load from Local Checkpoints
|
| 76 |
+
|
| 77 |
+
If you have the checkpoint files in `src/iclad/checkpoints/`, use the built-in names:
|
| 78 |
+
|
| 79 |
+
```python
|
| 80 |
+
from iclad import ICLAD
|
| 81 |
+
|
| 82 |
+
# ⭐ RECOMMENDED: Load default unified model
|
| 83 |
+
model = ICLAD() # Uses iclad_mixedprior_unified by default
|
| 84 |
+
model = ICLAD(model_name="ICLAD")
|
| 85 |
+
|
| 86 |
+
# --- Paper Reproduction Only (below) ---
|
| 87 |
+
|
| 88 |
+
# Load one-class variant
|
| 89 |
+
model = ICLAD(model_name="ICLAD_OC")
|
| 90 |
+
|
| 91 |
+
# Load unsupervised variant
|
| 92 |
+
model = ICLAD(model_name="ICLAD_UNSUP")
|
| 93 |
+
|
| 94 |
+
# Load SCM-only variant
|
| 95 |
+
model = ICLAD(model_name="ICLAD_SCM")
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### Example: Anomaly Detection on Tabular Data
|
| 99 |
+
|
| 100 |
+
```python
|
| 101 |
+
import numpy as np
|
| 102 |
+
from iclad import ICLAD
|
| 103 |
+
|
| 104 |
+
# Initialize model
|
| 105 |
+
model = ICLAD(model_name="ICLAD") # Default unified model
|
| 106 |
+
|
| 107 |
+
# Prepare training and test data
|
| 108 |
+
X_train = np.random.randn(100, 10) # 100 samples, 10 features
|
| 109 |
+
X_test = np.random.randn(50, 10) # Test data
|
| 110 |
+
|
| 111 |
+
# Fit on training data (for unsupervised setting, no labels needed)
|
| 112 |
+
model.fit(X_train)
|
| 113 |
+
|
| 114 |
+
# Get anomaly scores
|
| 115 |
+
scores = model.predict_score(X_test)
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
### One-class Example
|
| 119 |
+
|
| 120 |
+
```python
|
| 121 |
+
# Prepare training and test data
|
| 122 |
+
X_train = np.random.randn(100, 10) # 100 samples, 10 features
|
| 123 |
+
Y_train = np.zeros(X_train.shape[0]) # All normal
|
| 124 |
+
X_test = np.random.randn(50, 10) # Test data
|
| 125 |
+
|
| 126 |
+
# Fit on training data (for unsupervised setting, no labels needed)
|
| 127 |
+
model.fit(X_train, Y_train)
|
| 128 |
+
|
| 129 |
+
# Get anomaly scores
|
| 130 |
+
scores = model.predict_score(X_test)
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
### Semi-Supervised Example
|
| 134 |
+
|
| 135 |
+
```python
|
| 136 |
+
# y_train: 1 for anomaly, -1 for unknown (no support for known normals yet)
|
| 137 |
+
model.fit(X_train, Y_train)
|
| 138 |
+
scores = model.predict_score(X_test)
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
## Citation
|
| 142 |
+
|
| 143 |
+
If you use these pretrained models in your research, please cite:
|
| 144 |
+
|
| 145 |
+
```bibtex
|
| 146 |
+
@misc{wei2026icladincontextlearningunified,
|
| 147 |
+
title={ICLAD: In-Context Learning for Unified Tabular Anomaly Detection Across Supervision Regimes},
|
| 148 |
+
author={Jack Yi Wei and Narges Armanfard},
|
| 149 |
+
year={2026},
|
| 150 |
+
eprint={2603.19497},
|
| 151 |
+
archivePrefix={arXiv},
|
| 152 |
+
primaryClass={cs.LG},
|
| 153 |
+
url={https://arxiv.org/abs/2603.19497},
|
| 154 |
+
}
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
## License
|
| 158 |
+
|
| 159 |
+
The model code is licensed under the **Apache License 2.0**.
|
| 160 |
+
|
| 161 |
+
## Repository
|
| 162 |
+
|
| 163 |
+
For issues, discussions, and more information, please visit the main ICLAD repository.
|
| 164 |
+
|
| 165 |
+
## Contact
|
| 166 |
+
|
| 167 |
+
Jack Wei: yi.wei4@mail.mcgill.ca
|