Skip to main content

TensorFlow 2 implementation for k-Lipschitz layers

Project description

Library Banner


👋 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.

📚 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 Name Notebook
Getting Started 1 - Creating a 1-Lipschitz neural network Open In Colab
Wasserstein distance estimation on toy example Open In Colab
HKR Classifier on toy dataset Open In Colab
HKR classifier on MNIST dataset Open In Colab
HKR multiclass and fooling Open In Colab

📦 What's Included

  • k-Lipschitz variant of keras layers such as Dense, Conv2D and Pooling,
  • activation functions compatible with keras,
  • kernel initializers and kernel constraints for keras,
  • loss functions that make use of Lipschitz constrained networks (see our paper for more information),
  • tools to monitor the singular values of kernels during training,
  • tools to convert k-Lipschitz network to regular network for faster inference.

👍 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:

  • Xplique a Python library exclusively dedicated to explaining neural networks.
  • Influenciae Python toolkit dedicated to computing influence values for the discovery of potentially problematic samples in a dataset.
  • deel-torchlip a Python library for training k-Lipschitz neural networks on PyTorch.
  • DEEL White paper a summary of the DEEL team on the challenges of certifiable AI and the role of data quality, representativity and explainability for this purpose.

🙏 Acknowledgments

DEEL Logo
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 DEEL 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 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

deel-lip-1.5.0.tar.gz (60.3 kB view details)

Uploaded Source

Built Distribution

deel_lip-1.5.0-py3-none-any.whl (51.1 kB view details)

Uploaded Python 3

File details

Details for the file deel-lip-1.5.0.tar.gz.

File metadata

  • Download URL: deel-lip-1.5.0.tar.gz
  • Upload date:
  • Size: 60.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for deel-lip-1.5.0.tar.gz
Algorithm Hash digest
SHA256 a3db6e32a7eac23db1e53f6e5cf8ce5cd65a44735909c28264f6fa2cda56b2bb
MD5 6b1c160847094cfd5b655548df789760
BLAKE2b-256 16fc21562986f2877384b0c2c2162723e486ce7966d700aaa3264984bca9c7c5

See more details on using hashes here.

File details

Details for the file deel_lip-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: deel_lip-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 51.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for deel_lip-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe245221a238e21fd11048040684236c3ed3b566dbc2f9eb9506dcc87c091609
MD5 94da01addcbfb9a20436e0074b6d2a7c
BLAKE2b-256 c18f64a899ead49d4b7119c595348326eb294c57d12a84fef01b080eefcc3ab0

See more details on using hashes here.

Supported by

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