Skip to main content

A fast and modular scikit-learn replacement for generalized linear models

Project description

skglm

image0

skglm is a library that provides better sparse generalized linear models for scikit-learn. Its main features are:

  • speed: problems with millions of features can be solved in seconds. Default solvers rely on efficient coordinate descent with Numba just in time compilation.

  • flexibility: virtually any combination of datafit and penalty can be implemented in a few lines of code.

  • scikit-learn API: all estimators are drop-in replacements for scikit-learn.

  • scope: support for many missing models in scikit-learn - weighted Lasso, arbitrary group penalties, non-convex sparse penalties, etc.

Currently, the package handles any combination of the following datafits:

  • quadratic

  • logistic loss

  • multitask quadratic

and the following penalties:

  • L1 norm

  • weighted L1 norm

  • L1 + L2 squared norm (elastic net)

  • MCP

  • L05 and L2/3 penalties

The estimators follow the scikit-learn API, come with automated parallel cross-validation, and support both sparse and dense data.

Documentation

Please visit https://contrib.scikit-learn.org/skglm/ for the latest version of the documentation.

Install and work with the development version

First clone the repository available at https://github.com/scikit-learn-contrib/skglm:

$ git clone https://github.com/scikit-learn-contrib/skglm.git
$ cd skglm/

Then, install the package with:

$ pip install -e .

To check if everything worked fine, you can do:

$ python -c 'import skglm'

and it should not give any error message.

Demos & Examples

In the example section of the documentation, you will find numerous examples on real-life datasets, timing comparison with other estimators, easy and fast ways to perform cross-validation, etc.

Dependencies

All dependencies are specified in the setup.py file. They are installed automatically when pip install -e . is run.

Cite

If you use this code, please cite

@online{skglm,
    title={Beyond L1: Faster and Better Sparse Models with skglm},
    author={Q. Bertrand and Q. Klopfenstein and P.-A. Bannier and G. Gidel and M. Massias},
    year={2022},
    url={https://arxiv.org/abs/2204.07826}
}

ArXiv links:

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

skglm-0.2.tar.gz (38.9 kB view details)

Uploaded Source

File details

Details for the file skglm-0.2.tar.gz.

File metadata

  • Download URL: skglm-0.2.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.7

File hashes

Hashes for skglm-0.2.tar.gz
Algorithm Hash digest
SHA256 f4ed34cb3eced3e43e737f91879dcb2a21e6c3efccd2131e286cb31a8223a400
MD5 013b2073a3acd1c974c8e299e36893b4
BLAKE2b-256 e2cfbdb5ef199f1e22fdaed94db908b7a2bb8653d8397596d420824c56b55f39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page