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
On GitHub
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.
Release files for sklearn-contrib-lightning 0.6.2.post0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sklearn-contrib-lightning-0.6.2.post0.tar.gz | 70.1 kB | Details |
Built distributions (wheels)
Total release size: 20.3 MB
Release files / sklearn-contrib-lightning-0.6.2.post0.tar.gz
| Download URL | sklearn-contrib-lightning-0.6.2.post0.tar.gz |
|---|---|
| Size | 70.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ace82cfd672f6d5be952780cae239650999ff9f1f750be7d62b43d905e33d6c1
|
|
BLAKE2b-256 checksum How to use checksums |
91284badeccd1507b56f21d7500a8e264cbcce4bfd22e0ee82faac388a4216e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-win_amd64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 640.1 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
38f392ebfd2d022d3b70e135b7a55f832d52b06e4f0924f5bf4ab03cfc8495fe
|
|
BLAKE2b-256 checksum How to use checksums |
1d2fc5af319aca8a2b0be3c403678060cc8dff6856741200b4d507d54c2c8b32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-manylinux2014_x86_64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-manylinux2014_x86_64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
7fcb4b8528695e2965a8b5f32a991fd80e85e46a619a1c74642cb1540ca1b5e7
|
|
BLAKE2b-256 checksum How to use checksums |
8041d97cf77682ee762608e44cc6db0581c8fbad76eb9319ee62c9f98709d5ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-macosx_10_9_x86_64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-macosx_10_9_x86_64.whl |
|---|---|
| Size | 665.3 kB |
| Tags | CPython 3.10 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
2434094d66fdfb6083b02f2e421ce415a54589bccdfe2c5abfbe21a31e191def
|
|
BLAKE2b-256 checksum How to use checksums |
817e8a2e7bbcb3b3ffece692be28d06f3b0c2402013ac0c867aea9f3d6476a9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-win_amd64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 639.5 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a35d8c09267b65de76f779870f9f4eab22f6759b40bb87d98289851d20e28411
|
|
BLAKE2b-256 checksum How to use checksums |
16e198076599491d72639dfdd0075b08dc2f1be5e160bcf4288896be3cca9a71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-win32.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-win32.whl |
|---|---|
| Size | 545.7 kB |
| Tags | CPython 3.9 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
dcaa2d51a3e69d73e736fc632798d7c03e79c8fc35bf4ab0cb8b91af827d23f3
|
|
BLAKE2b-256 checksum How to use checksums |
1ea7da1480c596842fd9db7ad95e00a55232974be3197b4347d251d91bacabe7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-manylinux2014_x86_64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-manylinux2014_x86_64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
9c51ae55ea0a9634203cdae0c3abeb15b407efdfc780bff36aa08a2b09e1f65c
|
|
BLAKE2b-256 checksum How to use checksums |
0a3ade5f2650a262a5226e068204c60a803efc584501a85fbfda1b40a596f765
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-macosx_10_9_x86_64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-macosx_10_9_x86_64.whl |
|---|---|
| Size | 665.2 kB |
| Tags | CPython 3.9 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
7f8497295b9dbc190ca85390b675f4b81a3a96dc23a39fe971b1489fa43e9959
|
|
BLAKE2b-256 checksum How to use checksums |
2c934dcd0563c8125a122529b797c4b3c34187552734ea4ad1333d7d5639341a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-win_amd64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 644.0 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d4572f670b5940fe172d4d9d58ffb7ed06a2315e624c0c947377b3b09147ba30
|
|
BLAKE2b-256 checksum How to use checksums |
0dde70d448673c5d218cc1c3517d26213f00e8e07c591068134fe54ca7152452
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-win32.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-win32.whl |
|---|---|
| Size | 549.5 kB |
| Tags | CPython 3.8 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
1a6245045195ac06ac3d35be65a6a8467b1e439df66596621e724f47b1a2c979
|
|
BLAKE2b-256 checksum How to use checksums |
e13b71224ef5f5ba64867619a8b6994183811df3677eadd7b852cba569cd9c75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-manylinux2014_x86_64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-manylinux2014_x86_64.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
5a76d50e88e275767a839a113adbe937c447c474a2a1dedc16fe332f2bbed054
|
|
BLAKE2b-256 checksum How to use checksums |
d6a548d00792cf722d7ca7ab6cff88a9bd4b9ed10dfddd80fb0f8975b2ba05c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-macosx_10_9_x86_64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-macosx_10_9_x86_64.whl |
|---|---|
| Size | 653.9 kB |
| Tags | CPython 3.8 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
1cf858ae70b6891473a3e10787e91d9b924a9b9d78bf49ecc36bbc6bc8591771
|
|
BLAKE2b-256 checksum How to use checksums |
e26934c65803c7ae7dc68747cced98fd97e1b5b491c2fc90b8064fe0cf7fc45b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-win_amd64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-win_amd64.whl |
|---|---|
| Size | 627.0 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0d9e5f6cedce42126fe31b93af1de3b940e84d8c61a9b1a25ee10f3d36ab719f
|
|
BLAKE2b-256 checksum How to use checksums |
719b27232ff043ee8f404351892ad69a9a0077c42c41d2072a355328611bf25b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-win32.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-win32.whl |
|---|---|
| Size | 538.6 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Windows x86-32 |
|
SHA-256 checksum How to use checksums |
fe2d8b9457140dfdf9bfe27036cee385b60802a957764af34fa16de56f1c0bca
|
|
BLAKE2b-256 checksum How to use checksums |
8a805125e9fb784428a0e9d744752b844441a410ac1407821c46b6f4dec8c487
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-manylinux2014_x86_64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-manylinux2014_x86_64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
ebceccd82da12bca23dbbe20e5baad8a2601c480bfc233813316b260634ad61a
|
|
BLAKE2b-256 checksum How to use checksums |
38d1166c2648026863767494f0992aef7de1939d49edb305dee9329e79bebb79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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.12
|
Release files / sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-macosx_10_9_x86_64.whl
| Download URL | sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-macosx_10_9_x86_64.whl |
|---|---|
| Size | 646.9 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
a98f23bc5fdf4f24fe438d24dbca77cb4bb93454d2affc397c70fabaafb22e9f
|
|
BLAKE2b-256 checksum How to use checksums |
ca7f54e6ea5b07dcd0ea5f069a2d242038d6a54983eeafd9934b9a7eb098003d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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.12
|