Home

Awesome

<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./docs/assets/logo_white.svg"> <source media="(prefers-color-scheme: light)" srcset="./docs/assets/logo.svg"> <img alt="Library Banner" src="./docs/assets/logo.svg"> </picture> </div> <br> <div align="center"> <a href="#"> <img src="https://img.shields.io/pypi/pyversions/deel-lip.svg"> </a> <a href="https://github.com/deel-ai/deel-lip/actions/workflows/python-linters.yml"> <img alt="PyLint" src="https://github.com/deel-ai/deel-lip/actions/workflows/python-linters.yml/badge.svg?branch=master"> </a> <a href="https://github.com/deel-ai/deel-lip/actions/workflows/python-tests.yml"> <img alt="Tox" src="https://github.com/deel-ai/deel-lip/actions/workflows/python-linters.yml/badge.svg?branch=master"> </a> <a href="https://pypi.org/project/deel-lip"> <img alt="Pypi" src="https://img.shields.io/pypi/v/deel-lip.svg"> </a> <a href="https://pepy.tech/project/deel-lip"> <img alt="Pepy" src="https://pepy.tech/badge/deel-lip"> </a> <a href="#"> <img src="https://img.shields.io/badge/License-MIT-efefef"> </a> <br> <a href="https://deel-ai.github.io/deel-lip/"><strong>Explore DEEL-LIP docs Β»</strong></a> </div> <br>

πŸ‘‹ Welcome to deel-lip documentation!

Controlling the Lipschitz constant of a layer or a whole neural network has many applications ranging from adversarial robustness to Wasserstein distance estimation.

This library provides an efficient implementation of k-Lispchitz layers for keras.

[!CAUTION] Incompatibility with TensorFlow >= 2.16 and Keras 3

Due to significant changes introduced in TensorFlow version 2.16 and Keras 3, this package is currently incompatible with TensorFlow versions 2.16 and above. Users are advised to use TensorFlow versions lower than 2.16 to ensure compatibility and proper functionality of this package.

Β We are actively working on updating the package to support Keras 3. Please stay tuned for updates. For now, make sure to install an earlier version of TensorFlow by specifying it in your environment.

πŸ“š Table of contents

πŸš€ Quick Start

You can install deel-lip directly from pypi:

pip install deel-lip

In order to use deel-lip, you also need a valid tensorflow installation. deel-lip supports tensorflow versions 2.x.

πŸ”₯ Tutorials

Tutorial NameNotebook
Getting Started 1 - Creating a 1-Lipschitz neural networkOpen In Colab
Getting Started 2 - Training an adversarially robust 1-Lipschitz neural networkOpen In Colab
Wasserstein distance estimation on toy exampleOpen In Colab
HKR Classifier on toy datasetOpen In Colab
HKR classifier on MNIST datasetOpen In Colab
HKR multiclass and foolingOpen In Colab

πŸ“¦ What's Included

πŸ‘ Contributing

To contribute, you can open an issue, or fork this repository and then submit changes through a pull-request. We use black to format the code and follow PEP-8 convention. To check that your code will pass the lint-checks, you can run:

tox -e py36-lint

You need tox in order to run this. You can install it via pip:

pip install tox

πŸ‘€ See Also

More from the DEEL project:

πŸ™ Acknowledgments

<div align="right"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://share.deel.ai/apps/theming/image/logo?useSvg=1&v=10" width="25%" align="right"> <source media="(prefers-color-scheme: light)" srcset="https://www.deel.ai/wp-content/uploads/2021/05/logo-DEEL.png" width="25%" align="right"> <img alt="DEEL Logo" src="https://www.deel.ai/wp-content/uploads/2021/05/logo-DEEL.png" width="25%" align="right"> </picture> </div> This project received funding from the French ”Investing for the Future – PIA3” program within the Artificial and Natural Intelligence Toulouse Institute (ANITI). The authors gratefully acknowledge the support of the <a href="https://www.deel.ai/"> DEEL </a> project.

πŸ—žοΈ Citation

This library has been built to support the work presented in the paper Achieving robustness in classification using optimaltransport with Hinge regularization which aim provable and efficient robustness by design.

This work can be cited as:

@misc{2006.06520,
    Author = {Mathieu Serrurier and Franck Mamalet and Alberto GonzΓ‘lez-Sanz and Thibaut Boissin and Jean-Michel Loubes and Eustasio del Barrio},
    Title = {Achieving robustness in classification using optimal transport with hinge regularization},
    Year = {2020},
    Eprint = {arXiv:2006.06520},
}

πŸ“ License

The package is released under <a href="https://choosealicense.com/licenses/mit"> MIT license</a>.