Skip to main content

Python wrapper for glmnet

Reason this release was yanked:

build error

Project description

Build status Latest version on conda forge Latest version on PyPI Supported python versions for python-glmnet

Fork of python-glmnet with support for more recent Python versions.

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

conda install -c conda-forge glmnet

pip

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.

git clone git@github.com:replicahq/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

from glmnet import LogitNet

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

Prediction is similar to Scikit-Learn:

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

Regularized Linear Regression

from glmnet import ElasticNet

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

Predict:

p = m.predict(x)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

python_glmnet-2.2.2-1-cp311-cp311-musllinux_1_1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

python_glmnet-2.2.2-1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

python_glmnet-2.2.2-1-cp311-cp311-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

python_glmnet-2.2.2-1-cp311-cp311-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

python_glmnet-2.2.2-1-cp310-cp310-musllinux_1_1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

python_glmnet-2.2.2-1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

python_glmnet-2.2.2-1-cp310-cp310-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

python_glmnet-2.2.2-1-cp310-cp310-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

python_glmnet-2.2.2-1-cp39-cp39-musllinux_1_1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

python_glmnet-2.2.2-1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

python_glmnet-2.2.2-1-cp39-cp39-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

python_glmnet-2.2.2-1-cp39-cp39-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

python_glmnet-2.2.2-0-cp311-cp311-musllinux_1_1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

python_glmnet-2.2.2-0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

python_glmnet-2.2.2-0-cp311-cp311-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

python_glmnet-2.2.2-0-cp311-cp311-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

python_glmnet-2.2.2-0-cp310-cp310-musllinux_1_1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

python_glmnet-2.2.2-0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

python_glmnet-2.2.2-0-cp310-cp310-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

python_glmnet-2.2.2-0-cp310-cp310-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

python_glmnet-2.2.2-0-cp39-cp39-musllinux_1_1_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

python_glmnet-2.2.2-0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

python_glmnet-2.2.2-0-cp39-cp39-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

python_glmnet-2.2.2-0-cp39-cp39-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file python_glmnet-2.2.2-1-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 4030c7dc3c1b67aaf0abea9509243a122308cd3798eb086a2841c89840805412
MD5 1662a2c1beede94f967992022136e739
BLAKE2b-256 4373bdacb8d110cff716b6cd654cfbce5c56eacfd7d4f78bdbb7e476bac37862

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5bcd3a6b9d8ee5fb26a5e08bc78e1c8f1da1d6f4537855aa2906aeb740d336ef
MD5 21bcfe4e31d1e0cfbb69b4707c1250bc
BLAKE2b-256 4128db8e9815726c4051ec7fb378e193c2bea1370356f870e3b3ee9aebab26c7

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d0a5f7e4f63997a3ed173f0d9d578c35c4253ff43ffb931b74b88e6e7f974f89
MD5 4a2fb223edc15f65d54eed3f2fec41a1
BLAKE2b-256 6e4fecb1f7b6e4c57e5616e2c56079ff16045ec559707fb0bf17949398b608bd

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 39c4d166475409a27feed88258d79a58771fc9cb15b65634cf8625ea925cb38d
MD5 870d5582ba1999ab12b87cd9d51449f1
BLAKE2b-256 fd5f855532a397734cdc5a65b12a2de2dbce74bcae428a4bf3c9fe6a02edd34a

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 7812051755b130f6fc02c4caa094836b605d3670f2166b2d6ccefd9ac2af20d0
MD5 0fad86492be8bbb2112b285396117d3d
BLAKE2b-256 3c4c278339e6ac1681ab052fc8e38efb42e39cef6d3acac5577e6932a753831d

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd26234a45a96b7d87f0eaaad2ba9179d54f178cdf921e6794d603e3a2f0ffdc
MD5 cfa1bbe2c5c92c263e3a82d396bae1d6
BLAKE2b-256 8dc8d86dfd80f4e4b81cdada93c5a58e909f6e295d723f239b56c8ff180e94a9

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 790acbbe08d05859984093163ee3414aaf20ddcaff1a5ad878c506d61457067a
MD5 28ded966dd2f8f1ae8f04e685fc70732
BLAKE2b-256 d2ccf53cd9df20d18e53802aea05e271b1086ac7d9e36882f487b4dae8960541

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 04a9c221856b7fd7b5139fe295bfb354297a098c1731cbcd20239b1a56ca1ac3
MD5 cb4fd81f75c3de54baca239741a46eaf
BLAKE2b-256 4657025438b7b449f942ca1935b9fac90a2dd4a4e1f01ecd41359b907687d143

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 e702ae85ebe5aabefc52f966c3c35a73f2e6a257e58158f8d4c33d89c5bc8591
MD5 e75ac4b7b1febf9ad4fb80b4d9d3118b
BLAKE2b-256 e0ca2337efaf995899236a7c960d8f3ffa59b92b24d3a099b1a9f5cfec7fa031

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 242246d0464e4fee4965bf99228d08d82be9212bacf0e132b7d2ab750520c9f1
MD5 6321c31a09156231012caa8c7f17d29b
BLAKE2b-256 be1479a807e453613d98ce440000d944e7df4add22536b26d3c64bf6c5724899

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7701bae22604d72340657089efe79e1c6cf840c82d19920559c06b1710eb37aa
MD5 5024e26624b0e9c915cdac069212bada
BLAKE2b-256 ae3b63e4059136318e04f151c2f048f2103689f5a3c68160b259384ef0202a61

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3990b5aa5e2402707255c08e75ca724b79ce8afacd4b0cf1fd37286aee16cb43
MD5 f70121a13ac3beaae6b8c44113ec926f
BLAKE2b-256 bc114a14aa0fbc87855c78dea596b872992dd13a96e9adaddf69fe81827ee451

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 db9beb3c582dc1c1453fda9224fe161718989c2cfa511baf49f2aed5ea5a6938
MD5 674b15a8f8f59040fa00735f37e110d7
BLAKE2b-256 994a4e2919f6582b23d5347a891d75886ec278e0c731307b69d51a236e276ab2

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 77256d4bf967b113cccc1b256e53048e107828df19de0cec0ff925fc4496f2c0
MD5 93170aea4b20c8ee27294a2a56ab8d59
BLAKE2b-256 0598b593d01e7e8564705c7d9d05562b1e28c650ec3af9107a1a75931ea5fc20

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7ce14418d0db1199b1e6431a71889ce99f34b05a3c40ff86665368ba5bfb6283
MD5 7bd319306133cde79c519f717c13cfcd
BLAKE2b-256 926da87834956f0a2660b8d25eb5ad8f5602576f18f44f4490930a466fc499cc

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 83c783b210ffba60c10cbb9687c555cb4ccc1192615364f79539bfb9b615485a
MD5 ca5c7f4be42b7924db4908887fa2edc6
BLAKE2b-256 ea20b87a38278ec623a9357770841a3ad58de2c28db9ddf28808ff925a267866

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 32123cbdc9e869af6142aa7ff582e7f25fa2f8c475b70e2f491526acd6d9197d
MD5 b9c1949dc1359ca4fefae0d847c192b2
BLAKE2b-256 2f76f8ee4e9e0fb4cc5cc2d024f991b1676e4febd5fa91f6e282722db1d6df24

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d6c40f16fd51dd2524fbeeeb00f0a96e7c97451ed6dfab735edfb6bd5ce5d466
MD5 5816231945d6c6f949b3480d080c5eb3
BLAKE2b-256 37ef45493525e39da4fed229addc8ea985e67657c82955d6c33412efd3cf6bee

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4634c56e49f86283f20a0d68179275a160a66431c4ad8c2aa128a6d9ebbaf8b3
MD5 364f35f9c68cf8c778bbab02aaca9312
BLAKE2b-256 385c9d8e33429536899a696f4a25281ecdb6178d9ccbf057e5611b0eb3cf5392

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3cc1c7df260412fa5514ca36ffae2145b05353e2b4bf97cc8e26b3a42659d589
MD5 303099dd3a35096ae16b3f6e854fa8b5
BLAKE2b-256 7d6d8974b614dcd414c7cd8a26a884674f86af3edfc35f806c17431320411d77

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 f23eb702fe03f76dafc2e40a2f997bda6564a2e6b6e9f597e50df498af89c0e5
MD5 9700585d7d3b9d1e797d48e83b73a16f
BLAKE2b-256 17e5fc96229b7fd589b0efba0eca681892021fb57f620f477402e4af8c1942e3

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 23a51bc5c059c3e15b849d77e318ce5ddb44f65ccfc477312929cd5fd7ec2d54
MD5 9c2a089e61d673d7eebc770f67b61c53
BLAKE2b-256 cad52ada179894ac8e6a14dfb451faeabf0377be48cb4a02194c1b1f751d093b

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d35539fbead98371ec1551aefc6c4cbae0f4ebc506c279ac134bd83cee9cc552
MD5 8572475266e4ecd6210635faf3f2fa27
BLAKE2b-256 c3b344c1227985954fc4403ed2f24ea79d116a26936dfa33eb811488687b56a0

See more details on using hashes here.

File details

Details for the file python_glmnet-2.2.2-0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for python_glmnet-2.2.2-0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e35dd360b2fbc64179ab3c52fb278145320f9eff48f4b4d628efe0af71f24b5c
MD5 6c8cd37ffcc4d3161ed457c4702f2008
BLAKE2b-256 ef3abf34fdc3c781271c5b295e73f03debe6d99ba8b50a40f91ebd06e13acff5

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