Large-scale sparse linear classification, regression and ranking in Python
Project description
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.
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 Distributions
File details
Details for the file sklearn-contrib-lightning-0.6.2.post0.tar.gz
.
File metadata
- Download URL: sklearn-contrib-lightning-0.6.2.post0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ace82cfd672f6d5be952780cae239650999ff9f1f750be7d62b43d905e33d6c1 |
|
MD5 | 4dc6edccedfe6cb259056f3015d3966c |
|
BLAKE2b-256 | 91284badeccd1507b56f21d7500a8e264cbcce4bfd22e0ee82faac388a4216e2 |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 640.1 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38f392ebfd2d022d3b70e135b7a55f832d52b06e4f0924f5bf4ab03cfc8495fe |
|
MD5 | 77e9bf792301fcb0426a2163b9417e6a |
|
BLAKE2b-256 | 1d2fc5af319aca8a2b0be3c403678060cc8dff6856741200b4d507d54c2c8b32 |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-manylinux2014_x86_64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.10
- 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fcb4b8528695e2965a8b5f32a991fd80e85e46a619a1c74642cb1540ca1b5e7 |
|
MD5 | e2e8538e6a0638923acfbed453739f8f |
|
BLAKE2b-256 | 8041d97cf77682ee762608e44cc6db0581c8fbad76eb9319ee62c9f98709d5ba |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 665.3 kB
- Tags: CPython 3.10, 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.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2434094d66fdfb6083b02f2e421ce415a54589bccdfe2c5abfbe21a31e191def |
|
MD5 | ab4d9c7ac76a947916429d908eca7321 |
|
BLAKE2b-256 | 817e8a2e7bbcb3b3ffece692be28d06f3b0c2402013ac0c867aea9f3d6476a9c |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 639.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | a35d8c09267b65de76f779870f9f4eab22f6759b40bb87d98289851d20e28411 |
|
MD5 | e2aaa8213a0cbad20b38ddcc3a88c00d |
|
BLAKE2b-256 | 16e198076599491d72639dfdd0075b08dc2f1be5e160bcf4288896be3cca9a71 |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-win32.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-win32.whl
- Upload date:
- Size: 545.7 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcaa2d51a3e69d73e736fc632798d7c03e79c8fc35bf4ab0cb8b91af827d23f3 |
|
MD5 | 77fa5c943e5dcf8b0ce3cb8db4ec40e0 |
|
BLAKE2b-256 | 1ea7da1480c596842fd9db7ad95e00a55232974be3197b4347d251d91bacabe7 |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-manylinux2014_x86_64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.9
- 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c51ae55ea0a9634203cdae0c3abeb15b407efdfc780bff36aa08a2b09e1f65c |
|
MD5 | bd12754af4c49a06bfaed92cd829578e |
|
BLAKE2b-256 | 0a3ade5f2650a262a5226e068204c60a803efc584501a85fbfda1b40a596f765 |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f8497295b9dbc190ca85390b675f4b81a3a96dc23a39fe971b1489fa43e9959 |
|
MD5 | 85b01a4529394d468c7cab4b667f9c07 |
|
BLAKE2b-256 | 2c934dcd0563c8125a122529b797c4b3c34187552734ea4ad1333d7d5639341a |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 644.0 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4572f670b5940fe172d4d9d58ffb7ed06a2315e624c0c947377b3b09147ba30 |
|
MD5 | a4079c6aa8816e1c1b01cdafbdeada29 |
|
BLAKE2b-256 | 0dde70d448673c5d218cc1c3517d26213f00e8e07c591068134fe54ca7152452 |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-win32.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-win32.whl
- Upload date:
- Size: 549.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a6245045195ac06ac3d35be65a6a8467b1e439df66596621e724f47b1a2c979 |
|
MD5 | bc73ad16a220db1ee914b6c6ab2211d5 |
|
BLAKE2b-256 | e13b71224ef5f5ba64867619a8b6994183811df3677eadd7b852cba569cd9c75 |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-manylinux2014_x86_64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.8
- 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a76d50e88e275767a839a113adbe937c447c474a2a1dedc16fe332f2bbed054 |
|
MD5 | 2299ff2b7b81cb3284529c1d1a9452c4 |
|
BLAKE2b-256 | d6a548d00792cf722d7ca7ab6cff88a9bd4b9ed10dfddd80fb0f8975b2ba05c6 |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cf858ae70b6891473a3e10787e91d9b924a9b9d78bf49ecc36bbc6bc8591771 |
|
MD5 | b21ffef0de61ef8e7cebb1b5fc3d5667 |
|
BLAKE2b-256 | e26934c65803c7ae7dc68747cced98fd97e1b5b491c2fc90b8064fe0cf7fc45b |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d9e5f6cedce42126fe31b93af1de3b940e84d8c61a9b1a25ee10f3d36ab719f |
|
MD5 | c43a392ef6641dc3f6002b7ec0b371f3 |
|
BLAKE2b-256 | 719b27232ff043ee8f404351892ad69a9a0077c42c41d2072a355328611bf25b |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-win32.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-win32.whl
- Upload date:
- Size: 538.6 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe2d8b9457140dfdf9bfe27036cee385b60802a957764af34fa16de56f1c0bca |
|
MD5 | 4e1d36bfea752b78e8860b67d2822f59 |
|
BLAKE2b-256 | 8a805125e9fb784428a0e9d744752b844441a410ac1407821c46b6f4dec8c487 |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-manylinux2014_x86_64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-manylinux2014_x86_64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.7m
- 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.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebceccd82da12bca23dbbe20e5baad8a2601c480bfc233813316b260634ad61a |
|
MD5 | 495ca2a62a6a5c9bf52aff6432716eb9 |
|
BLAKE2b-256 | 38d1166c2648026863767494f0992aef7de1939d49edb305dee9329e79bebb79 |
Provenance
File details
Details for the file sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: sklearn_contrib_lightning-0.6.2.post0-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 646.9 kB
- Tags: CPython 3.7m, 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.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a98f23bc5fdf4f24fe438d24dbca77cb4bb93454d2affc397c70fabaafb22e9f |
|
MD5 | 08c32cde9dadc6363b170ae03055b94d |
|
BLAKE2b-256 | ca7f54e6ea5b07dcd0ea5f069a2d242038d6a54983eeafd9934b9a7eb098003d |