GithubHelp home page GithubHelp logo

hushell / lightning Goto Github PK

View Code? Open in Web Editor NEW

This project forked from scikit-learn-contrib/lightning

0.0 2.0 0.0 2.06 MB

Large-scale linear classification, regression and ranking in Python

Home Page: http://www.mblondel.org/lightning/

Makefile 2.11% Python 92.50% Shell 0.10% C 5.29%

lightning's Introduction

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, SVRG
  • FISTA, SpaRSA

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 needs Python >= 2.7, setuptools, Numpy >= 1.3, SciPy >= 0.7, scikit-learn >= 0.14 and a working C/C++ compiler.

To run the tests you will also need nose >= 0.10.

Installation

To install lightning from pip, type:

pip install https://github.com/mblondel/lightning/archive/master.zip

To install lightning from source, type:

git clone https://github.com/mblondel/lightning.git
cd lightning
python setup.py build
sudo python setup.py install

Documentation

http://www.mblondel.org/lightning/

On Github

https://github.com/mblondel/lightning

Author

Mathieu Blondel, 2012-present

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.