pyCLAD - Python Continual Lifelong Anomaly Detection
What is pyCLAD?
pyCLAD is a unified framework for continual anomaly detection. Its main goal is to foster successful scientific development in continual anomaly detection by providing robust implementations of strategies, models, scenarios, and metrics, complemented with code examples and user documentation. pyCLAD also facilitates the design and implementation of experimental pipelines, providing a streamlined, unified, and fully reproducible execution workflow. pyCLAD is built following a component-oriented design approach. As a result, it provides an extensible approach, where users are not required to reimplement foundational aspects of the code, and can just focus on extending specific classes.
How to use pyCLAD?
Installation
pyCLAD is provided as a Pyton package available in pypi. Therefore, you can install it as a package using tools such
as pip and conda, for example:
pip install pyclad.
Moreover, the source code is available in the GitHub repository.
Optional dependencies
Depending on the anomaly detection models you want to use, you may need to install additional packages,
such as tensorflow and pytorch.
We do not include them in default installation to avoid putting heavy dependencies for the core installation.
pyCLAD supports the use of any model from pyOD library, some of which may require installation of additional packages (
see pyOD docs.
Getting started
There are a few valuable resources supporting getting started with pyCLAD:
pyCLAD is built upon a few core concepts:
- Scenario: a continual scenario defines the data stream so that it reflects different real-life conditions and what are the challenges faced by continual strategy.
- Strategy: a strategy is a way to manage model updates. Continual strategy is responsible for how, when, and with which data models should be updated. Its aim is to introduce knowledge retention while keeping the ability to adapt.
- Model: a model is a machine learning model used for anomaly detection. Models are often leveraged by continual strategies that add additional layer of managing model's updates.
- Dataset: a dataset is a collection of data used for training and evaluation of the model.
- Metrics: a metric is a way to evaluate the performance of the model.
- Callbacks: a callback is a function that is called at specific points during the scenario. Callbacks are useful for monitoring the process, calculating metrics, and more.
Quick example
# Prepare random data for 3 concepts
concept1_train = Concept("concept1", data=np.random.rand(100, 10))
concept1_test = Concept("concept1", data=np.random.rand(100, 10), labels=np.random.randint(0, 2, 100))
concept2_train = Concept("concept2", data=np.random.rand(100, 10))
concept2_test = Concept("concept2", data=np.random.rand(100, 10), labels=np.random.randint(0, 2, 100))
concept3_train = Concept("concept3", data=np.random.rand(100, 10))
concept3_test = Concept("concept3", data=np.random.rand(100, 10), labels=np.random.randint(0, 2, 100))
# Build a dataset based on the previously created concepts
dataset = ConceptsDataset(
name="GeneratedDataset",
train_concepts=[concept1_train, concept2_train, concept3_train],
test_concepts=[concept1_test, concept2_test, concept3_test],
)
# Define model, strategy, and callbacks
model = OneClassSVMAdapter()
strategy = CumulativeStrategy(model)
callbacks = [
ConceptMetricCallback(
base_metric=RocAuc(),
metrics=[ContinualAverage(), BackwardTransfer(), ForwardTransfer()],
),
TimeEvaluationCallback(),
]
# Execute the concept agnostic scenario
scenario = ConceptAgnosticScenario(dataset=dataset, strategy=strategy, callbacks=callbacks)
scenario.run()
# Save the results
output_writer = JsonOutputWriter(pathlib.Path("output.json"))
output_writer.write([model, dataset, strategy, *callbacks])
Citing pyCLAD
A paper describing pyCLAD is published in SoftwareX Journal - click here. If you use pyCLAD in your research, please cite:
@article{faber2025pyclad,
title = {pyCLAD: The universal framework for continual lifelong anomaly detection},
journal = {SoftwareX},
volume = {29},
pages = {101994},
year = {2025},
issn = {2352-7110},
doi = {https://doi.org/10.1016/j.softx.2024.101994},
url = {https://www.sciencedirect.com/science/article/pii/S2352711024003649},
author = {Kamil Faber and Bartlomiej Sniezynski and Nathalie Japkowicz and Roberto Corizzo},
keywords = {Continual anomaly detection, Lifelong anomaly detection, Continual learning, Anomaly detection, Software},
}
How to contribute?
We welcome all contributions! If you want to contribute to pyCLAD, please follow the guidelines in the CONTRIBUTING.md file.
Metadata
Release files for pyclad 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyclad-0.3.0.tar.gz | 199.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyclad-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 235.8 kB
Release files / pyclad-0.3.0.tar.gz
| Download URL | pyclad-0.3.0.tar.gz |
|---|---|
| Size | 199.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1081b8065a828793eb9128423c27370002b15e2857e9377dd3afdb294dda6249
|
|
BLAKE2b-256 checksum How to use checksums |
d7261dce551f70f6351dab2f8efcd230292e1838a49f45667ab879edf5fced2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / pyclad-0.3.0-py3-none-any.whl
| Download URL | pyclad-0.3.0-py3-none-any.whl |
|---|---|
| Size | 36.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80b5a73f25398c627a04d8563baa4f0cb5837dd75b214cb4cde87d0f40f475e7
|
|
BLAKE2b-256 checksum How to use checksums |
2cc38e2cb5d52e8417bcf4ed9a3958e7888f4e999c551a514d87c08629535721
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|