Skip to main content

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. We hosted a website with a demo and an overview of the package, which can be found at https://detoxai.github.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 Stepka and Lukasz Sztukiewicz and Michal Wilinski 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

detoxai-0.3.4.tar.gz (3.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

detoxai-0.3.4-py3-none-any.whl (92.7 kB view details)

Uploaded Python 3

File details

Details for the file detoxai-0.3.4.tar.gz.

File metadata

  • Download URL: detoxai-0.3.4.tar.gz
  • Upload date:
  • Size: 3.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for detoxai-0.3.4.tar.gz
Algorithm Hash digest
SHA256 5e205bf9485e31aca5ff4ef66d7e7f3bee21e03b959f2dd6bf0242bc141068a9
MD5 761205a9042bd795cb639309bbf11f3d
BLAKE2b-256 d256ddd2e9ae143c9d984a0550f08f326a374364e523239a2bf8489d9fa45a5c

See more details on using hashes here.

File details

Details for the file detoxai-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: detoxai-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 92.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for detoxai-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 469c4c543fe03979a0b3deea49cd9db0e0d26c81cf9f1de74586eb0c9259abed
MD5 394298484e50fc26dec09eb109be7dc4
BLAKE2b-256 4ab2b1de1531d3dbf9d14acdc00984139c35abe0381d99d6f9b9c6212c198360

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page