Skip to main content

Python bindings for the Ensmallen library.

Project description

pyensmallen: python bindings for the ensmallen library for numerical optimization

Lightweight python bindings for ensmallen library. Currently supports

  • L-BFGS, with intended use for optimisation of smooth objectives for m-estimation
  • ADAM (and variants with different step-size routines) - makes use of ensmallen's templatization.
  • Frank-Wolfe, with intended use for constrained optimization of smooth losses
    • constraints are either lp-ball (lasso, ridge, elastic-net) or simplex
  • (Generalized) Method of Moments estimation with ensmallen optimizers.
    • this uses ensmallen for optimization [and relies on jax for automatic differentiation to get gradients and jacobians]. This is the main use case for pyensmallen and is the reason for the bindings.

See ensmallen docs for details. The notebooks/ directory walks through several statistical examples.

speed

pyensmallen is very fast. A comprehensive set of benchmarks is available in the benchmarks directory. The benchmarks are run on an intel 12th gen framework laptop. Benchmarks vary data size (sample size and number of covariates) and parametric family (linear, logistic, poisson) and compare pyensmallen with scipy and statsmodels (I initially also tried to keep cvxpy in the comparison set but it was far too slow to be in the running). At large data sizes, pyensmallen is roughly an order of magnitude faster than scipy, which in turn is an order of magnitude faster than statsmodels. So, a single statsmodels run takes around as long as a pyensmallen run that naively uses the nonparametric bootstrap for inference. This makes the bootstrap a viable option for inference in large data settings.

Installation:

Make sure your system has blas installed. On macos, this can be done via brew. Linux systems should have it installed by default. If you are using conda, you can install blas via conda-forge.

Then,

from pypi

pip install pyensmallen

from source

  1. Install armadillo and ensmallen for your system (build from source, or via conda-forge; I went with the latter)
  2. git clone this repository
  3. pip install -e .
  4. Profit? Or at least minimize loss?

from wheel

  • download the appropriate .whl for your system from the more recent release listed in Releases and run pip install ./pyensmallen... OR
  • copy the download url and run pip install https://github.com/apoorvalal/pyensmallen/releases/download/<version>/pyensmallen-<version>-<pyversion>-linux_x86_64.whl

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

pyensmallen-0.2.7.tar.gz (3.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyensmallen-0.2.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pyensmallen-0.2.7-cp312-cp312-macosx_11_0_arm64.whl (8.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyensmallen-0.2.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pyensmallen-0.2.7-cp311-cp311-macosx_11_0_arm64.whl (8.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyensmallen-0.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pyensmallen-0.2.7-cp310-cp310-macosx_11_0_arm64.whl (8.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file pyensmallen-0.2.7.tar.gz.

File metadata

  • Download URL: pyensmallen-0.2.7.tar.gz
  • Upload date:
  • Size: 3.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyensmallen-0.2.7.tar.gz
Algorithm Hash digest
SHA256 cfd687b9c698b27854769f9ebc7b5a9d23d5059a8292922db16bb78612c91fed
MD5 c3869935029339c1e735ef715fd4b12a
BLAKE2b-256 dd66eeae4d3c668de2099ba382ed3f1931d692a39acecdc283e57bffe227a211

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.7.tar.gz:

Publisher: build.yml on apoorvalal/pyensmallen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyensmallen-0.2.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5479b77dfd9da2339193ef9e6072e3a35ec79fa724e797a734373a55ccc85c64
MD5 4152188ccb4706c990ed66eb42fcb7aa
BLAKE2b-256 7fc4e0d09b0b2290069456b50718b140b4a380df50ee18400d6f96b2d15557c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on apoorvalal/pyensmallen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyensmallen-0.2.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 020d7843de5bd7ac401292cc49c937d5cf0e9f69f70eb76f09b040b296a5931c
MD5 11d900fca90a30f9aae2f4a49cce657c
BLAKE2b-256 c548ac105b04126c7b9398cb198af313902815bb223c36509c1545ccacd21340

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.7-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: build.yml on apoorvalal/pyensmallen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyensmallen-0.2.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7bde9bbdebae83a3fa66dbf24240525f57fdc7736323ce8c54439719b48f0122
MD5 02dff4a1e9815f5ce7224bf5d1a38aa0
BLAKE2b-256 5adefe962c49bde4284585e028e44623487677a8b3228f5736a9adeda808945b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on apoorvalal/pyensmallen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyensmallen-0.2.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c7ee2c3a7920dd99193eb4970da33fdb17b6c17013dcdd1cf5f6b7b3b09f9444
MD5 51aeeddd290ede8cf76a60613d555d31
BLAKE2b-256 9abca25cc75b12fe0b8dfde3167623d41f5e5834d29b074629ad13d0ff2b98b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.7-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: build.yml on apoorvalal/pyensmallen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyensmallen-0.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9dc72fb7b552aba4b11c0cd4c48fa32ca07f1a09a248e8f7ef705942ea1126d0
MD5 53ecd89f77efa497a6058b2f48f36ff0
BLAKE2b-256 ba929dfd20bb69345f6eaef1aece0571f3e2e11b74fa9227432b83ddafe9ffae

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on apoorvalal/pyensmallen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyensmallen-0.2.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d91b7ed7495ae2c717cd3fa8e8c858698b6b78acdd67cf94dec7e30ae5afa125
MD5 b3aef234a7730e756b8abe8b3c506ab7
BLAKE2b-256 74c48a525b727fdb0421ea6131323da40d12274506dfea70e4450790d33f210e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.7-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: build.yml on apoorvalal/pyensmallen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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