Skip to main content

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

Project description

https://travis-ci.org/scikit-learn-contrib/lightning.svg?branch=master https://ci.appveyor.com/api/projects/status/onn6yba9ckerlvme/branch/master?svg=true

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 >= 2.7, setuptools, Numpy >= 1.3, SciPy >= 0.7 and scikit-learn >= 0.15. Building from source also requires Cython and a working C/C++ compiler. To run the tests you will also need nose >= 0.10.

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 https://conda.anaconda.org/scikit-learn-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 this verion, type:

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

Documentation

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

On Github

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

Authors

  • Mathieu Blondel, 2012-present

  • Manoj Kumar, 2015-present

  • Arnaud Rachez, 2016-present

  • Fabian Pedregosa, 2016-present

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.1.1.tar.gz (626.8 kB view details)

Uploaded Source

Built Distributions

sklearn_contrib_lightning-0.1.1-cp35-cp35m-win_amd64.whl (367.8 kB view details)

Uploaded CPython 3.5m Windows x86-64

sklearn_contrib_lightning-0.1.1-cp35-cp35m-win32.whl (319.6 kB view details)

Uploaded CPython 3.5m Windows x86

sklearn_contrib_lightning-0.1.1-cp35-cp35m-macosx_10_5_x86_64.whl (420.1 kB view details)

Uploaded CPython 3.5m macOS 10.5+ x86-64

sklearn_contrib_lightning-0.1.1-cp27-cp27m-win_amd64.whl (400.4 kB view details)

Uploaded CPython 2.7m Windows x86-64

sklearn_contrib_lightning-0.1.1-cp27-cp27m-win32.whl (358.9 kB view details)

Uploaded CPython 2.7m Windows x86

File details

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

File metadata

File hashes

Hashes for sklearn-contrib-lightning-0.1.1.tar.gz
Algorithm Hash digest
SHA256 562327371acc4b24aeb1c155e3cf0ea5773364ab5afd3112bceecfc291028482
MD5 a59ab39603e3e68d2fb3e1759a25f386
BLAKE2b-256 40309fc9fabfed19666c1bb6f8f18baa5d45ccf8cf9f224f14d108042321b635

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.1.1-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.1.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 ac98a80a4873781b593146c1c3c7274835ad89648ca6dab75cedfc7d98fc97fd
MD5 fe06a180c25fef9377b3461c18ef745e
BLAKE2b-256 a5e8bb3e05f2104d668efa2ab5e3bc4e965428ae56ed1f6f465d9bc9fc0c79c8

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.1.1-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.1.1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 7f800bc49061a8782b2b0788d81ce438046d6f150eddbc58d573f83fa9b5a6d2
MD5 b51a8c36fdcccee82e5ef52f7cec19d3
BLAKE2b-256 74e8df09d11d96ad504a8ac65142d909512c07ac0efff3e712ee1fc472dbdb27

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.1.1-cp35-cp35m-macosx_10_5_x86_64.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.1.1-cp35-cp35m-macosx_10_5_x86_64.whl
Algorithm Hash digest
SHA256 43d2b48a81327417a943a361c367e011f85301c735436195e319da75478347da
MD5 e5f38ad5b84548b66adf4e1a88d6ca3c
BLAKE2b-256 9d26119bfad9199d62405afebd018692f578b56f806d307cd42a5a8d6ec7b6f8

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.1.1-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.1.1-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 6ce7dd06ef9c8def5d5148ea7450e1ed8d168dc441784449065e5ed2aacf2479
MD5 0a9a3317fd9ea340d26be92d8a41d4bc
BLAKE2b-256 17a664bc413e4ccf5871dd21df3a36f35651117c1768785617d5de46c815ce5a

See more details on using hashes here.

File details

Details for the file sklearn_contrib_lightning-0.1.1-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for sklearn_contrib_lightning-0.1.1-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 52f8c5dbed8c2ca7fac1d436dbccb316e9842380844d05f65eded71e7dedb067
MD5 8c259552b82cf763be2ac0858c0ba51f
BLAKE2b-256 c5a24d6030627f8a644f5349208ce49eb36f20761658240930d2e3d4415b077c

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