glmnet

A python port of the glmnet package for fitting generalized linear models via penalized maximum likelihood.

https://github.com/civisanalytics/python-glmnet

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.0%) to scientific vocabulary

Keywords

elasticnet glm glmnet lasso python r
Last synced: 6 months ago · JSON representation

Repository

A python port of the glmnet package for fitting generalized linear models via penalized maximum likelihood.

Basic Info
  • Host: GitHub
  • Owner: civisanalytics
  • License: other
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 188 KB
Statistics
  • Stars: 267
  • Watchers: 74
  • Forks: 58
  • Open Issues: 17
  • Releases: 4
Archived
Topics
elasticnet glm glmnet lasso python r
Created over 9 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.rst

Python GLMNET
=============

Maintenance Warning
-------------------

This package is not longer maintained.

Description
-----------

This is a Python wrapper for the fortran library used in the R package
`glmnet `__.
While the library includes linear, logistic, Cox, Poisson, and
multiple-response Gaussian, only linear and logistic are implemented in
this package.

The API follows the conventions of
`Scikit-Learn `__, so it is expected to
work with tools from that ecosystem.

Installation
------------

requirements
~~~~~~~~~~~~

``python-glmnet`` requires Python version >= 3.6, ``scikit-learn``, ``numpy``,
and ``scipy``. Installation from source or via ``pip`` requires a Fortran compiler.

conda
~~~~~

.. code:: bash

    conda install -c conda-forge glmnet


pip
~~~

.. code:: bash

    pip install glmnet


source
~~~~~~

``glmnet`` depends on numpy, scikit-learn and scipy.
A working Fortran compiler is also required to build the package.
For Mac users, ``brew install gcc`` will take care of this requirement.

.. code:: bash

    git clone git@github.com:civisanalytics/python-glmnet.git
    cd python-glmnet
    python setup.py install

Usage
-----

General
~~~~~~~

By default, ``LogitNet`` and ``ElasticNet`` fit a series of models using
the lasso penalty (α = 1) and up to 100 values for λ (determined by the
algorithm). In addition, after computing the path of λ values,
performance metrics for each value of λ are computed using 3-fold cross
validation. The value of λ corresponding to the best performing model is
saved as the ``lambda_max_`` attribute and the largest value of λ such
that the model performance is within ``cut_point * standard_error`` of
the best scoring model is saved as the ``lambda_best_`` attribute.

The ``predict`` and ``predict_proba`` methods accept an optional
parameter ``lamb`` which is used to select which model(s) will be used
to make predictions. If ``lamb`` is omitted, ``lambda_best_`` is used.

Both models will accept dense or sparse arrays.

Regularized Logistic Regression
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    from glmnet import LogitNet

    m = LogitNet()
    m = m.fit(x, y)

Prediction is similar to Scikit-Learn:

.. code:: python

    # predict labels
    p = m.predict(x)
    # or probability estimates
    p = m.predict_proba(x)

Regularized Linear Regression
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    from glmnet import ElasticNet

    m = ElasticNet()
    m = m.fit(x, y)

Predict:

.. code:: python

    p = m.predict(x)

Owner

  • Name: Civis Analytics
  • Login: civisanalytics
  • Kind: organization
  • Location: Chicago and D.C.

Building a Data-Driven World

GitHub Events

Total
  • Watch event: 4
  • Fork event: 1
Last Year
  • Watch event: 4
  • Fork event: 1

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 48
  • Total Committers: 11
  • Avg Commits per committer: 4.364
  • Development Distribution Score (DDS): 0.75
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Stephen Hoover s****r@c****m 12
jdavis@civisanalytics.com j****s@c****m 11
Minwoo Jeong m****i@g****m 6
Bill Lattner w****r@c****m 6
Bill Lattner w****r@g****m 5
Jackson L. Lee j****e@c****m 2
Elijah Goodfriend e****d 2
melvinev 3****v 1
Victor Rodriguez v****a@i****m 1
Michael Heilman m****n@c****m 1
Lingling Xu 3****3 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 44
  • Total pull requests: 41
  • Average time to close issues: 4 months
  • Average time to close pull requests: 3 months
  • Total issue authors: 33
  • Total pull request authors: 18
  • Average comments per issue: 2.61
  • Average comments per pull request: 1.46
  • Merged pull requests: 28
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 15 minutes
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Visdoom (5)
  • stephen-hoover (3)
  • amirhessam88 (2)
  • wlattner (2)
  • paulhendricks (2)
  • hanfang (2)
  • JWarmenhoven (2)
  • edlee123 (1)
  • egayer (1)
  • trimeta (1)
  • muhlbach (1)
  • seanv507 (1)
  • dependabot[bot] (1)
  • mathurinm (1)
  • 00sapo (1)
Pull Request Authors
  • wlattner (9)
  • stephen-hoover (8)
  • xdavio (4)
  • dependabot[bot] (3)
  • VictorRodriguez (2)
  • JacobHayes (2)
  • eli-goodfriend (2)
  • jacksonllee (2)
  • mheilman (2)
  • k0ruy (2)
  • mwjin (1)
  • buyology (1)
  • randrover (1)
  • lingling93 (1)
  • amirhessam88 (1)
Top Labels
Issue Labels
bug (4) Documentation (2) question (2) enhancement (1) dependencies (1)
Pull Request Labels
bug (4) dependencies (3) Documentation (2)

Packages

  • Total packages: 5
  • Total downloads:
    • pypi 2,703 last-month
  • Total docker downloads: 142
  • Total dependent packages: 5
    (may contain duplicates)
  • Total dependent repositories: 31
    (may contain duplicates)
  • Total versions: 17
  • Total maintainers: 3
pypi.org: glmnet

Python wrapper for glmnet

  • Versions: 5
  • Dependent Packages: 4
  • Dependent Repositories: 27
  • Downloads: 2,695 Last month
  • Docker Downloads: 142
Rankings
Dependent packages count: 1.6%
Dependent repos count: 2.8%
Docker downloads count: 3.1%
Average: 3.4%
Downloads: 3.6%
Stargazers count: 4.0%
Forks count: 5.1%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/civisanalytics/python-glmnet
  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 3.6%
Stargazers count: 3.8%
Average: 4.6%
Dependent packages count: 5.4%
Dependent repos count: 5.7%
Last synced: 6 months ago
spack.io: py-glmnet

This is a Python wrapper for the fortran library used in the R package glmnet.

  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 13.2%
Forks count: 13.7%
Average: 13.8%
Dependent packages count: 28.1%
Maintainers (1)
Last synced: 6 months ago
pypi.org: glmnet2

Python wrapper for glmnet

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 8 Last month
Rankings
Stargazers count: 4.0%
Forks count: 5.6%
Dependent packages count: 6.6%
Average: 16.2%
Dependent repos count: 30.6%
Downloads: 34.3%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: glmnet
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 4
Rankings
Dependent repos count: 16.0%
Forks count: 23.7%
Stargazers count: 24.0%
Average: 28.8%
Dependent packages count: 51.4%
Last synced: 6 months ago