l0learn: Fast Best Subset Selection
Hussein Hazimeh, Rahul Mazumder, and Tim Nonet
Massachusetts Institute of Technology
Introduction
L0Learn is a highly efficient framework for solving L0-regularized learning problems. It can (approximately) solve the following three problems, where the empirical loss is penalized by combinations of the L0, L1, and L2 norms:
We support both regression (using squared error loss) and classification (using logistic or squared hinge loss). Optimization is done using coordinate descent and local combinatorial search over a grid of regularization parameter(s) values. Several computational tricks and heuristics are used to speed up the algorithms and improve the solution quality. These heuristics include warm starts, active set convergence, correlation screening, greedy cycling order, and efficient methods for updating the residuals through exploiting sparsity and problem dimensions. Moreover, we employed a new computationally efficient method for dynamically selecting the regularization parameter λ in the path. We describe the details of the algorithms in our paper: Fast Best Subset Selection: Coordinate Descent and Local Combinatorial Optimization Algorithms (link).
The toolkit is implemented in C++11 and can often run faster than popular sparse learning toolkits (see our experiments in the paper above). We also provide an easy-to-use R interface; see the section below for installation and usage of the R package.
NEW: Version 2 (03/2021) adds support for sparse matrices and box constraints on the coefficients.
Package Installation
l0learn comes pre-packaged with a version of Amardillo
l0learn Currently is only supported on Linux and MacOS. Windows support is an active area of development.
The latest version (v2.0.3) can be installed from pip as follows:
pip install l0learn
Documentation
Documentation can be found here
Source Code and Installing from Source
Alternatively, l0learn can be build from source
git clone https://github.com/TNonet/L0Learn.git
cd python
To install, ensure the proper packages are installed from pyproject.toml build from source with the following:
pip install ".[test]"
To test, run the following command:
python -m pytest
Change Log
L0Learn's changelog can be accessed from here.
Usage
For a tutorial, please refer to l0learn's Vignette(Link to be added). For a detailed description of the API, check the Documentation(link to be added).
FAQ
Which penalty to use?
Pure L0 regularization can overfit when the signal strength in the data is relatively low. Adding L2 regularization can alleviate this problem and lead to competitive models (see the experiments in our paper). Thus, in practice, we strongly recommend using the L0L2 penalty. Ideally, the parameter gamma (for L2 regularization) should be tuned over a sufficiently large interval, and this can be performed using L0Learn's built-in cross-validation method.
Which algorithm to use?
By default, L0Learn uses a coordinate descent-based algorithm, which achieves competitive run times compared to popular sparse learning toolkits. This can work well for many applications. We also offer a local search algorithm which is guarantteed to return higher quality solutions, at the expense of an increase in the run time. We recommend using the local search algorithm if your problem has highly correlated features or the number of samples is much smaller than the number of features---see the local search section of the Vignette for how to use this algorithm.
How to certify optimality?
While for many challenging statistical instances L0Learn leads to optimal solutions, it cannot provide certificates of optimality. Such certificates can be provided via Integer Programming. Our toolkit L0BnB is a scalable integer programming framework for L0-regularized regression, which can provide such certificates and potentially improve upon the solutions of L0Learn (if they are sub-optimal). We recommend using L0Learn first to obtain a candidtate solution (or a pool of solutions) and then checking optimality using L0BnB.
Citing L0Learn
If you find L0Learn useful in your research, please consider citing the following two papers.
Paper 1:
@article{doi:10.1287/opre.2019.1919,
author = {Hazimeh, Hussein and Mazumder, Rahul},
title = {Fast Best Subset Selection: Coordinate Descent and Local Combinatorial Optimization Algorithms},
journal = {Operations Research},
volume = {68},
number = {5},
pages = {1517-1537},
year = {2020},
doi = {10.1287/opre.2019.1919},
URL = {https://doi.org/10.1287/opre.2019.1919},
eprint = {https://doi.org/10.1287/opre.2019.1919}
}
Paper 2:
@article{JMLR:v22:19-1049,
author = {Antoine Dedieu and Hussein Hazimeh and Rahul Mazumder},
title = {Learning Sparse Classifiers: Continuous and Mixed Integer Optimization Perspectives},
journal = {Journal of Machine Learning Research},
year = {2021},
volume = {22},
number = {135},
pages = {1-47},
url = {http://jmlr.org/papers/v22/19-1049.html}
}
Metadata
Release files for l0learn 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 70.1 MB
Release files / l0learn-0.4.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | l0learn-0.4.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 15.0 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
41f0de13e2f0cc461bc6e57fad9bb795829836a065d1cbf521bf959cd0dd3f96
|
|
BLAKE2b-256 checksum How to use checksums |
a6c710fcfcfe7e078c6aa62699fd2316665734912e2b88dd0ff4d7ba680db048
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / l0learn-0.4.3-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | l0learn-0.4.3-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e8061cceb9cb20e4797bf59ee72c0017a216e0ffd046f2caf83af1491c8e7f2e
|
|
BLAKE2b-256 checksum How to use checksums |
f69144563bbfaf67ae6eb1fe1f0f79f97666c6a51fef957f9b801ed6a34c8ac4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / l0learn-0.4.3-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | l0learn-0.4.3-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
e4cb7c6c2567629e13bd77dc3683c02c4254cbca4aff2a61fe4e84e70624cc8a
|
|
BLAKE2b-256 checksum How to use checksums |
aa60215153c0a89084775ea10d95d7e95523d49f9b5c90b700fe9e00889c5f23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / l0learn-0.4.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | l0learn-0.4.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 15.0 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
7f9b756687c570dbba76a53cf11420d84e0f96432ec5d0dac1e5389416ec1b62
|
|
BLAKE2b-256 checksum How to use checksums |
e8349ae92bd0f71333768e47ece0614f436d677533d3631ce982bf318ef0b92b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / l0learn-0.4.3-cp39-cp39-macosx_11_0_arm64.whl
| Download URL | l0learn-0.4.3-cp39-cp39-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.9 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a0f1711fe8fca0b6db3f8c591da9915b48db19c55b28fc528079962b83a3ae89
|
|
BLAKE2b-256 checksum How to use checksums |
9f39b536413bec717e8bb89d41eedc932d8fbc8e1272e799fd631893330a3764
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / l0learn-0.4.3-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | l0learn-0.4.3-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
6b8a0b26dc410364526b9088618b811fefb0c655bd3306916cdb858a5f3f2e75
|
|
BLAKE2b-256 checksum How to use checksums |
247f7000aec6d18800fed87d3208b75eab296bb4d152a1a76eb93f3f24732a68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / l0learn-0.4.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | l0learn-0.4.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 15.0 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
15fc058721dcf29eb3fa3712e80e1ec09d48b3b38fa4ee40c7e1433d48153d5f
|
|
BLAKE2b-256 checksum How to use checksums |
4c6fbfce0ff1a03f0b98e3a200e3c6ace9f5092a5890d0cc3e87a8786da80411
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / l0learn-0.4.3-cp38-cp38-macosx_11_0_arm64.whl
| Download URL | l0learn-0.4.3-cp38-cp38-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b3702d864ae9ef2ef18a2b4b36101e46578936745f691a4edab07a73a7a6cdcf
|
|
BLAKE2b-256 checksum How to use checksums |
3cff2bc54eae4ef9261ea7ca4fc2b43624ee3ac30679896cdaae12088574767f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / l0learn-0.4.3-cp38-cp38-macosx_10_9_x86_64.whl
| Download URL | l0learn-0.4.3-cp38-cp38-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
5868952291cb9fa9453d6c3ba476508d5f5f1a2670db63e93f37da0fd1e734a4
|
|
BLAKE2b-256 checksum How to use checksums |
44f7d9cf0875161de68c683ec98d4679f7ca89ac36a158b29538e0d0391c28d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / l0learn-0.4.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | l0learn-0.4.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 15.0 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
ab035163fd1b70a638dd62e1340b13bf568609c1746d00c5a32e52075f11d7b8
|
|
BLAKE2b-256 checksum How to use checksums |
edeed2e465ececad1ef4ddc82116fe85bce55fc3fd5b917b734227f5db9f7009
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / l0learn-0.4.3-cp37-cp37m-macosx_10_9_x86_64.whl
| Download URL | l0learn-0.4.3-cp37-cp37m-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
21ffdf4003b476dc3deae1defad22bddd9dff71303a141e88f7a5b999991f5bd
|
|
BLAKE2b-256 checksum How to use checksums |
75f1dc0207cd1cb838b2dc6389cf1bbfee8cfaf6c5972e9324df703b55a9d267
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for l0learn 0.4.3
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.