Metadata-Version: 2.4
Name: detoxai
Version: 0.3.8
Summary: todo
Author-email: Łukasz Sztukiewicz <contact@lukaszsztukiewicz.com>, Ignacy Stępka <ignacy.stepka@student.put.poznan.pl>, Michał Wiliński <michal.wilinski@student.put.poznan.pl>
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: concept-erasure>=0.2.4
Requires-Dist: gdown>=5.2.0
Requires-Dist: lightning>=2.4.0
Requires-Dist: matplotlib>=3.10.0
Requires-Dist: pandas>=2.2.3
Requires-Dist: pillow>=11.0.0
Requires-Dist: scikit-learn>=1.6.0
Requires-Dist: scikit-optimize>=0.10.2
Requires-Dist: torchvision>=0.20.1
Requires-Dist: tqdm>=4.67.1
Requires-Dist: zennit>=0.5.1
Description-Content-Type: text/markdown

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](https://detoxai.github.io) and documentation [https://detoxai.readthedocs.io](https://detoxai.readthedocs.io)  

## Installation

DetoxAI is available on PyPI, and can be installed by running the following command:
 ```bash
  pip install detoxai
  ```

## Quickstart

The snippet below shows the high-level API of DetoxAI and how to use it. 
```python
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. 
```python
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](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
