Skip to main content

Large-scale sparse linear classification, regression and ranking in Python

Project description

https://github.com/scikit-learn-contrib/lightning/actions/workflows/main.yml/badge.svg?branch=master https://zenodo.org/badge/DOI/10.5281/zenodo.200504.svg

lightning

lightning is a library for large-scale linear classification, regression and ranking in Python.

Highlights:

  • follows the scikit-learn API conventions

  • supports natively both dense and sparse data representations

  • computationally demanding parts implemented in Cython

Solvers supported:

  • primal coordinate descent

  • dual coordinate descent (SDCA, Prox-SDCA)

  • SGD, AdaGrad, SAG, SAGA, SVRG

  • FISTA

Example

Example that shows how to learn a multiclass classifier with group lasso penalty on the News20 dataset (c.f., Blondel et al. 2013):

from sklearn.datasets import fetch_20newsgroups_vectorized
from lightning.classification import CDClassifier

# Load News20 dataset from scikit-learn.
bunch = fetch_20newsgroups_vectorized(subset="all")
X = bunch.data
y = bunch.target

# Set classifier options.
clf = CDClassifier(penalty="l1/l2",
                   loss="squared_hinge",
                   multiclass=True,
                   max_iter=20,
                   alpha=1e-4,
                   C=1.0 / X.shape[0],
                   tol=1e-3)

# Train the model.
clf.fit(X, y)

# Accuracy
print(clf.score(X, y))

# Percentage of selected features
print(clf.n_nonzero(percentage=True))

Dependencies

lightning requires Python >= 3.7, setuptools, Joblib, Numpy >= 1.12, SciPy >= 0.19 and scikit-learn >= 0.19. Building from source also requires Cython and a working C/C++ compiler. To run the tests you will also need pytest.

Installation

Precompiled binaries for the stable version of lightning are available for the main platforms and can be installed using pip:

pip install sklearn-contrib-lightning

or conda:

conda install -c conda-forge sklearn-contrib-lightning

The development version of lightning can be installed from its git repository. In this case it is assumed that you have the git version control system, a working C++ compiler, Cython and the numpy development libraries. In order to install the development version, type:

git clone https://github.com/scikit-learn-contrib/lightning.git
cd lightning
python setup.py install

Documentation

http://contrib.scikit-learn.org/lightning/

On GitHub

https://github.com/scikit-learn-contrib/lightning

Citing

If you use this software, please cite it. Here is a BibTex snippet that you can use:

@misc{lightning_2016,
  author       = {Blondel, Mathieu and
                  Pedregosa, Fabian},
  title        = {{Lightning: large-scale linear classification,
                 regression and ranking in Python}},
  year         = 2016,
  doi          = {10.5281/zenodo.200504},
  url          = {https://doi.org/10.5281/zenodo.200504}
}

Other citing formats are available in its Zenodo entry.

Authors

  • Mathieu Blondel

  • Manoj Kumar

  • Arnaud Rachez

  • Fabian Pedregosa

  • Nikita Titov

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

sklearn-contrib-lightning-0.6.2.tar.gz (70.1 kB view details)

Uploaded Source

Built Distributions

sklearn_contrib_lightning-0.6.2-cp310-cp310-win_amd64.whl (640.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

sklearn_contrib_lightning-0.6.2-cp310-cp310-macosx_10_9_x86_64.whl (665.2 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

sklearn_contrib_lightning-0.6.2-cp39-cp39-win_amd64.whl (639.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

sklearn_contrib_lightning-0.6.2-cp39-cp39-win32.whl (545.6 kB view details)

Uploaded CPython 3.9 Windows x86

sklearn_contrib_lightning-0.6.2-cp39-cp39-macosx_10_9_x86_64.whl (665.2 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

sklearn_contrib_lightning-0.6.2-cp38-cp38-win_amd64.whl (643.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

sklearn_contrib_lightning-0.6.2-cp38-cp38-win32.whl (549.4 kB view details)

Uploaded CPython 3.8 Windows x86

sklearn_contrib_lightning-0.6.2-cp38-cp38-macosx_10_9_x86_64.whl (653.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

sklearn_contrib_lightning-0.6.2-cp37-cp37m-win_amd64.whl (627.0 kB view details)

Uploaded CPython 3.7m Windows x86-64

sklearn_contrib_lightning-0.6.2-cp37-cp37m-win32.whl (538.5 kB view details)

Uploaded CPython 3.7m Windows x86

sklearn_contrib_lightning-0.6.2-cp37-cp37m-macosx_10_9_x86_64.whl (646.8 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file sklearn-contrib-lightning-0.6.2.tar.gz.

File metadata

  • Download URL: sklearn-contrib-lightning-0.6.2.tar.gz
  • Upload date:
  • Size: 70.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for sklearn-contrib-lightning-0.6.2.tar.gz
Algorithm Hash digest
SHA256 d0de4b061f068665a1ec308b136e3c7f199dbcdff200318573efda5e11739eb8
MD5 053db5fdf75b2bf0ed3823eff575c6b4
BLAKE2b-256 073e56dfd9e7c7b27ccc6be3be310b77ab85df4eff49adc8be632c328db3a452

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: sklearn_contrib_lightning-0.6.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 640.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 273cadc505b92c3b4fe3f057cb58f2f91c96f03c9502ffbbb0d72325a9aef43b
MD5 14ea10c0142cd77f8d9118317c3e355a
BLAKE2b-256 1c8642cf4d0cc2ef74d137f6554a4d3a6bdd384f507972b3f91fe11599bc5861

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4d1d81f9d94f9a9c1b0a218d59fdfa19175b4049b4d6d0f73007dc0b32217dea
MD5 864ffa11261fbd0a55f3eb0f5ac2fc20
BLAKE2b-256 1534ae81c2257ec53cb6798cc6240ebadba5e2094e27fb61dcb9e9f312472a3f

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1852f264fc2a973aa0e7428c21b18280b1c410ef7960a1740108f2b5daf56908
MD5 577eb83c03884b9cb8cffbcb0a002d45
BLAKE2b-256 47abe5d9adcf86b587f071704e63264d02fdc79b3576b8d2c8a79bcaa72dabc4

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: sklearn_contrib_lightning-0.6.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 639.4 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4ede51513fd87e5276ffdde750b73eb5c22432f3bdadaada344dbd5647bf21a1
MD5 baeb558d39d7cfe105dd48a1f3b69492
BLAKE2b-256 493744b2805c47accbf8bdab1cf9063f5a72389738abed13140417e58d15e01e

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp39-cp39-win32.whl.

File metadata

  • Download URL: sklearn_contrib_lightning-0.6.2-cp39-cp39-win32.whl
  • Upload date:
  • Size: 545.6 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 36602420717b7431c03fab2a6604378ce0f7c9981f00e509af7f345a006f49c1
MD5 694c020adbe57a103eaa5e6a9d4314e1
BLAKE2b-256 c325fa86e122c6d17e0577f2174ed9cb4f0e89c20c235a4391ad0dce656667ff

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0b4512c60d3cb9b5d3cf3407290b308029bbc252166c532e4c535891de41f817
MD5 650af7dbd4db185f5270bd20f121c707
BLAKE2b-256 e4006ecfe8059309856144fc4c82c9a76b2ae3164ef060f0c1562c46bbe3edff

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: sklearn_contrib_lightning-0.6.2-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 665.2 kB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3deef7892e8faf815ee1d14e14b8b1caabd50b98f002da811a2465eda96f33ce
MD5 2c25f07784e000e884d0d707ed82e651
BLAKE2b-256 a52bbcbee539bdfdcaca5c8a95c947870d6595f07456ceb2bca2b31fb46ef945

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: sklearn_contrib_lightning-0.6.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 643.9 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9e9ea8fd4ca4330cb16798747b45c3a86239770b782cbb75d2e85e7591c139f2
MD5 ff54ca19fe6bd585f6d008b96727514c
BLAKE2b-256 ae8a576d5083749d69735fdbe65e8f9f47321c50ffe9702aa506c2abfdaa0cc5

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp38-cp38-win32.whl.

File metadata

  • Download URL: sklearn_contrib_lightning-0.6.2-cp38-cp38-win32.whl
  • Upload date:
  • Size: 549.4 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 13904ab949786ce4dc2a2cdea2a57a707331a9ebc483899d9169292e0d4bef13
MD5 6a5f903ef27477562ed99275c61866a2
BLAKE2b-256 62fb2da669509577eb8a28d41988e64e17f4b6907120cedafa8a64e2b32337fe

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a8609088ec81daa315baddf8f3743b43fef2297b0716535f7b5eb70f92e2a802
MD5 73c942d45cd8828e42bc1119dcc62e44
BLAKE2b-256 9ffde41f587334896b3fbee44f82d6a81a7d9a878815d828d78cc70d3e3ec315

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: sklearn_contrib_lightning-0.6.2-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 653.9 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 50a342d00e23a48c67b8a6147e6ec8e9823d9c28fe53225165ed3fcf3db59ff1
MD5 14f8b5496bc70dab6ff2d4264cb96d28
BLAKE2b-256 ad7a8864f3c540626bd86727430d27e83631e5cd681ad908c53e3147ba045dc5

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: sklearn_contrib_lightning-0.6.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 627.0 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 bfde5ac9421fc02536c00f333dd6b268bb2b89f92984d5c0c3b8e4cc8d33765c
MD5 44ed85175bf6c92152223982ab42c0d6
BLAKE2b-256 736de7bffcac9855f6b5ccb94462e9c85a63693368b8f5de26547e8ff703ae07

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp37-cp37m-win32.whl.

File metadata

  • Download URL: sklearn_contrib_lightning-0.6.2-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 538.5 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 00ae5464c2577841c9ab29feb72db2fc4c23068b14834f5c0a0edd096f658cd8
MD5 513be96a60d6261a14f918b3a89623d6
BLAKE2b-256 7a1f6a17225ac9b199d3ea5f2cdeb531ea5e7b6c95628d3ceeffd339ea14be3f

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 542247f39b09b5741a2b30f7c4ee6eb48350e5f4a4a8af435c2097179d1c924d
MD5 a15dc28de8559ca0be2655b83507d63d
BLAKE2b-256 c353dfca7e42a28630143ace9ebe8fbd9962d75c7345669a3f133b5cc7a17d86

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.6.2-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.6.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8623b272402bf3104245f3ee17ba08a3ee20770f6a0c84da2a5177b87322dcb1
MD5 a045f722da7ca64976af3f84c97b117b
BLAKE2b-256 b2756cdf54f55617914d63185a4344f50710925cee1dec9f216dee384afd103e

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