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.9.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.9-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.9-cp312-cp312-macosx_11_0_arm64.whl (8.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyensmallen-0.2.9-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.9-cp311-cp311-macosx_11_0_arm64.whl (8.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyensmallen-0.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pyensmallen-0.2.9-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.9.tar.gz.

File metadata

  • Download URL: pyensmallen-0.2.9.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.9.tar.gz
Algorithm Hash digest
SHA256 394a9a077462280ad020425c9629b567f02c9250e937833a6119782c66e2ab97
MD5 0541e34963156a7a59c28ab735d9500a
BLAKE2b-256 d04d11621c92760128a039af689570e366219dd42f1f078394015185d143eca3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.9.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.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 953fba48ffb13ab50f6a6428534f38d85d74b34a8435e62ad4be5d040b71d8f1
MD5 480994e23ca6c53875ec6e2f96f356ea
BLAKE2b-256 03099bc3d7f467dc80ccf69d72e202d3ee8602db1caf204440700de8992cf2c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.9-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.9-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 631d968c65b624dea6f2d75c6918342c3dc306c0153d0565afaa8af308b025a4
MD5 c049536a4cfbff554659a5184f782634
BLAKE2b-256 a88309fc0aac61d34ea23ec71432b81ce7d6dc1479e636e86041d3048421c30f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.9-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.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fe3668d5e2347683a47fd3c6f8618840307731724d1fd2deed9938510c838039
MD5 bbe7975a08accd9e5e81fe8b81c84518
BLAKE2b-256 6898ca3199be98019923444e7257c5dd0080a36bae3d2a7502b5f1a28a2a62ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.9-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.9-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 71fafc0ba7f7d270ccd4b7e26b49e2f0d773dd98ad28f1de060e9e875fdcc891
MD5 231bb7eb5f67f35203f7ef70b14a6980
BLAKE2b-256 84a5ec51c6768a1f0f08b04c8b97514b394a5023adcfdfaafdbe2482741ea7d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.9-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.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bf79e275dbc899214b68a8019298e48e04866cc0889e60f6ad2d5b1b8ac16a54
MD5 e78468fcee5cb6784c27cb617b2cb5ea
BLAKE2b-256 a3100b28e585e40b0ad2051254cc16c21e9b314dff8c6cd202e1d98ed2203962

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.9-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.9-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyensmallen-0.2.9-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ec9eceff56927f23e47d5a1ab7dbf7dcc6550f95852d4c8f1c50b3f8b98a9b8
MD5 b568e824ef9c9f04525eb472f8125862
BLAKE2b-256 ac6b25200c6bf268833d913dde4fb2cd7f5be154461049f7c571f420ee2e4d80

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen-0.2.9-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