Skip to main content

build and test build wheel Python versions Black PyPI Documentation Status Gurobi-forum

Gurobi

Gurobi Machine Learning

Gurobi Machine Learning is an open-source python package to formulate trained regression models in a gurobipy model to be solved with the Gurobi solver.

The package currently supports various scikit-learn objects. It has limited support for Keras, PyTorch and XGBoost. Only neural networks with ReLU activation can be used with Keras and PyTorch.

Documentation

The latest user manual is available on readthedocs.

Contact us

For questions related to using Gurobi Machine Learning please use Gurobi's Forum.

For reporting bugs, issues and feature requests please open an issue.

If you encounter issues with Gurobi or gurobipy please contact Gurobi Support.

Installation

Dependencies

gurobi-machinelearning requires the following:

The current version supports the following ML packages:

Installing these packages is only required if the predictor you want to insert uses them (i.e. to insert a Keras based predictor you need to have tensorflow installed).

The up to date supported and tested versions of each package for the last release can be found in the documentation.

Pip installation

The easiest way to install gurobi-machinelearning is using pip in a virtual environment:

(.venv) pip install gurobi-machinelearning

This will also install the numpy, scipy and gurobipy dependencies.

Please note that gurobipy is commercial software and requires a license. When installed via pip or conda, gurobipy ships with a free license which is only for testing and can only solve models of limited size.

Getting a Gurobi License

Alternatively to the bundled limited license, there are licenses that can handle models of all sizes.

As a student or staff member of an academic institution you qualify for a free, full product license. For more information, see:

For a commercial evaluation, you can request an evaluation license.

Other useful resources to get started:

Development

We value any level of experience in using Gurobi Machine Learning and would like to encourage you to contribute directly to this project. Please see the Contributing Guide for more information.

Source code

You can clone the latest sources with the command:

git clone git@github.com:Gurobi/gurobi-machinelearning.git

Testing

After cloning the project, you can run the tests by invoking tox. For this, you will need to create a virtual environment and activate it:

python3.10 -m venv .venv
. .venv/bin/activate

Then, you can install tox (>= 3.26.0) and run a few basic tests:

(.venv) pip install tox
(.venv) tox -e py311,pre-commit,docs

tox will install, among others, the aforementioned ML packages into a separate venv. These packages can be quite large, so this might take a while.

Running the full test set

In the above command, we only ran a subset of tests. Running the full set of tests requires having a Gurobi license installed, and is done by running just the tox command without the -e parameter:

(.venv) pip install tox
(.venv) tox

If you don't have a Gurobi license, you can still run the subset of tests, open a PR, and Github Actions will run the tests with a full Gurobi license.

Submitting a Pull Request

Before opening a Pull Request, have a look at the full Contributing page to make sure your code complies with our guidelines.

Metadata

Release files for gurobi-machinelearning 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gurobi-machinelearning 1.7.0
File Size Uploaded Provenance Actions
gurobi_machinelearning-1.7.0.tar.gz 47.9 kB Without provenance Details for gurobi_machinelearning-1.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gurobi-machinelearning 1.7.0
File Interpreter ABI Platform Actions
gurobi_machinelearning-1.7.0-py3-none-any.whl Python 3 none any Details for gurobi_machinelearning-1.7.0-py3-none-any.whl

Total release size: 130.4 kB

Release files / gurobi_machinelearning-1.7.0.tar.gz

Download URL gurobi_machinelearning-1.7.0.tar.gz
Size 47.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1a86f956ccc2771c20527dba3cfe2c728fba155ac1f52a1142c58cc9eeedf252
BLAKE2b-256 checksum
How to use checksums
1f7311c3fc709584ec8193537676a3dfa520dbfc82a4650146502624105a7639
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Release files / gurobi_machinelearning-1.7.0-py3-none-any.whl

Download URL gurobi_machinelearning-1.7.0-py3-none-any.whl
Size 82.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b585b26e399cc6b2c8d4c6ab0ef081644f51d0ea3b6f1dd224a9da682be51004
BLAKE2b-256 checksum
How to use checksums
e554f66923d3517fbaf39a1cd3889063eabc38f227e30c6ea398dba55cce8e02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.14

Security for gurobi-machinelearning 1.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page