todo
Project description
DetoxAI is a Python package for debiasing neural networks. It provides a simple and efficient way to remove bias from your models while maintaining their performance. The package is designed to be easy to use and integrate into existing projects. For more information about the package, see the website https://detoxai.github.io and documentation https://detoxai.readthedocs.io
Installation
DetoxAI is available on PyPI, and can be installed by running the following command:
pip install detoxai
Quickstart
The snippet below shows the high-level API of DetoxAI and how to use it.
import detoxai
model = ...
dataloader = ... # has to output a tuple of three tensors: (x, y, protected attributes)
corrected = detoxai.debias(model, dataloader)
metrics = corrected["SAVANIAFT"].get_all_metrics() # Get metrics for the model debiased with SavaniAFT method
model = corrected["SAVANIAFT"].get_model()
A shortest snippet that would actually run and shows how to plug DetoxAI into your code is below.
import torch
import torchvision
import detoxai
model = torchvision.models.resnet18(pretrained=True)
model.fc = torch.nn.Linear(model.fc.in_features, 2) # Make it binary classification
X = torch.rand(128, 3, 224, 224)
Y = torch.randint(0, 2, size=(128,))
PA = torch.randint(0, 2, size=(128,))
dataloader = torch.utils.data.DataLoader(list(zip(X, Y, PA)), batch_size=32)
results: dict[str, detoxai.CorrectionResult] = detoxai.debias(model, dataloader)
Too see more examples of detoxai in use, navigate to the github repo https://github.com/DetoxAI/detoxai and see examples/ folder.
Acknowledgment
If you use this library in your work please cite as:
@misc{detoxai2025,
author={Ignacy St\k{e}pka and Lukasz Sztukiewicz and Micha\l{} Wili\'{n}ski and Jerzy Stefanowski},
title={{DetoxAI}: a {Python} Package for Debiasing Neural Networks},
year={2025},
url={https://github.com/DetoxAI/detoxai},
}
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file detoxai-0.3.8.tar.gz.
File metadata
- Download URL: detoxai-0.3.8.tar.gz
- Upload date:
- Size: 8.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8f43877317600cfcca4bfd4392754dc2216726afc3656002f59e6bc719537ec
|
|
| MD5 |
98491bf2f3a738c0d0c1b7087d85642e
|
|
| BLAKE2b-256 |
34a84215368c1700a9cd2f370b4f9382de775b802293fa874e5d22e103bfeae9
|
File details
Details for the file detoxai-0.3.8-py3-none-any.whl.
File metadata
- Download URL: detoxai-0.3.8-py3-none-any.whl
- Upload date:
- Size: 92.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e555696948460f75dd2dc1b39b6655badf53e68af352c67851579785c45a782d
|
|
| MD5 |
5a1b8d89e879a5ef98f0fa22a8cafd86
|
|
| BLAKE2b-256 |
6363314a70a853236588f3ee8d9d014336c5a2a9c94f016ccb83352161837ef0
|