PyDFLT
Project description
A Python-based Decision-Focused Learning Toolbox
PyDFLT is designed to help researchers apply and develop Decision Focused Learning (DFL) tools in Python. It uses CVXPYLayers [1] for differentiable models, PyEPO [2] for models with a linear objective and has an implementation of SFGE [3] and Lancer [4]. To help with research, it supports Weights & Biases (https://wandb.ai/) and Optuna (https://optuna.org). In the near future, we will publish PyDFLT on the Python Package Index, after which you can install it by running:
pip install pydflt
Documentation
Documentation can be found https://pydflt.github.io/documentation.
Contributing
If you want to contribute, you can fork the repository and send a pull request. We make use of uv (https://github.com/astral-sh/uv) for the installation and testing. Install uv here. To create the virtual environment:
uv sync --all-extras --all-groups
Notice that your IDE might automatically create the environment, but does only install the basic package dependencies. Make sure to run above command to install all dependencies.
Before committing
We make use of pre-commit (https://pre-commit.com/) and pytest to ensure code is consistent and functioning properly. Both are part of the dev dependencies and therefore installed in the virtual environment. Before committing make sure to run both:
uv run pre-commit run --all-files
uv run pytest
Documentation
We use Sphinx (https://www.sphinx-doc.org/en/master/) for the documentation. The Makefile in this directory can be used to build the documentation.
You can run uv run make html --directory=docs rom the project root as well, which will build the documentation in the exact same way as it will be displayed on the website.
Then, go to docs/build/html/api/src.html and drag the file into a browser.
Using Weights & Biases
If you want to use Weights & Biases, either set an environment variable named WANDB_KEY with your key,
or create a .env file with WANDB_KEY = 'your-key-here'.
References
[1] Akshay Agrawal, Brandon Amos, Shane Barratt, Stephen Boyd, Steven Diamond, and J Zico Kolter. Differentiable convex optimization layers. Advances in neural information processing systems, 32, 2019. doi:10.48550/arXiv.1910.12430.
[2] Bo Tang and Elias B. Khalil. Pyepo: a pytorch-based end-to-end predict-then-optimize library for linear and integer programming. Mathematical Programming Computation, 16(3):297–335, 2024. doi:10.1007/s12532-024-00255-x.
[3] Mattia Silvestri, Senne Berden, Jayanta Mandi, Ali ˙Irfan Mahmuto˘gulları, Maxime Mulamba, Allegra De Filippo, Tias Guns, and Michele Lombardi. Score function gradient estimation to widen the applicability of decision-focused learning. CoRR, abs/2307.05213, 2023. doi:10.48550/arXiv.2307.05213.
[4] Arman Zharmagambetov, Brandon Amos, Aaron Ferber, Taoan Huang, Bistra Dilkina, and Yuandong Tian. Landscape surrogate: Learning decision losses for mathematical optimization under partial information. Advances in Neural Information Processing Systems, 36:27332–27350, 2023. doi:10.48550/arXiv.2307.08964.
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 pydflt-0.1.0.tar.gz.
File metadata
- Download URL: pydflt-0.1.0.tar.gz
- Upload date:
- Size: 75.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96856bc113c5e3c295ecdacd4c8977c2f6591c00d4d2a47a7546e9ec94d92723
|
|
| MD5 |
6285b773081296a893546ef9419e554a
|
|
| BLAKE2b-256 |
5008ed6484bcf4af2c9463a37d67df7d83c63859e920eee09ae00f88b8fd2bee
|
Provenance
The following attestation bundles were made for pydflt-0.1.0.tar.gz:
Publisher:
publish.yml on PyDFLT/PyDFLT
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydflt-0.1.0.tar.gz -
Subject digest:
96856bc113c5e3c295ecdacd4c8977c2f6591c00d4d2a47a7546e9ec94d92723 - Sigstore transparency entry: 588762473
- Sigstore integration time:
-
Permalink:
PyDFLT/PyDFLT@9193c80d50d8e5cae8fa6f7b627838b3e56ab2fb -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/PyDFLT
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9193c80d50d8e5cae8fa6f7b627838b3e56ab2fb -
Trigger Event:
push
-
Statement type:
File details
Details for the file pydflt-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pydflt-0.1.0-py3-none-any.whl
- Upload date:
- Size: 93.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53d06bcb648fab2b9bc222344ab2fa4196476148450054a4ee0df45d4ef78fc0
|
|
| MD5 |
e0a462363831d0e5358b6e72008b38b7
|
|
| BLAKE2b-256 |
c5a0c05019bbe5b8df3a00e91f036ea2f61526d8b9653bc8f7594c2999941e79
|
Provenance
The following attestation bundles were made for pydflt-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on PyDFLT/PyDFLT
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydflt-0.1.0-py3-none-any.whl -
Subject digest:
53d06bcb648fab2b9bc222344ab2fa4196476148450054a4ee0df45d4ef78fc0 - Sigstore transparency entry: 588762539
- Sigstore integration time:
-
Permalink:
PyDFLT/PyDFLT@9193c80d50d8e5cae8fa6f7b627838b3e56ab2fb -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/PyDFLT
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9193c80d50d8e5cae8fa6f7b627838b3e56ab2fb -
Trigger Event:
push
-
Statement type: