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

Uploaded CPython 3.12macOS 11.0+ ARM64

pyensmallen-0.3.2-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.3.2-cp311-cp311-macosx_11_0_arm64.whl (8.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyensmallen-0.3.2-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.3.2-cp310-cp310-macosx_11_0_arm64.whl (8.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pyensmallen-0.3.2.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.3.2.tar.gz
Algorithm Hash digest
SHA256 1f2fab3c8220f45c4c8888517421ca51ef60c841bff141840b5068383090220a
MD5 4b871f262754cbbb64f4b3d67e914a19
BLAKE2b-256 be7e068fd25b0f5b61bf56c125bb29e1d9e6b6ba0c374e7af05d8f1bd2a61fcd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyensmallen-0.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 05686150794900668503827aa91d9be138c3b9f68f49810010b5a48aba64aef2
MD5 18a706f6fb0aae43dafc65f05db97f0b
BLAKE2b-256 30fe46760f690ed1cad68084af6d4c4ac19de52d6bc723f7108ab8707f82c033

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyensmallen-0.3.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d10d72bf8f97141275789671136ae30c1930e4689428e51b7b0191d142984f72
MD5 4600e8307f8f132ff24b7df86d7b2c8c
BLAKE2b-256 b636693d9b40ce77eb5d7d4c3bd2b80b98b0f7045dde2cbcb331c3820fbf2ebe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyensmallen-0.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6598c4126aae0b952e09362855d6cc18d1aaf48795225c5c8a15d4d14d988a11
MD5 b023f25b5453ae6bbd29005d68911bfe
BLAKE2b-256 1ec3d60ced0d39c8f48bd0a0eff3f31fe126e6958643fcb7e045e28a9742871d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyensmallen-0.3.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 40124056d342594cda74537ecd883090a045311e8219d3e4cba932e10b0abb33
MD5 3abeda8833dffb2db7fc201aa17f0780
BLAKE2b-256 64b74ab4183238307d11683180fad282bb65c515ff1615d4604f97d4c7bed849

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyensmallen-0.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 28a35252f23b06104072b81e837d354b0be8e851d59025022f180bd4041315b8
MD5 f3ca6f353bb036a1fdd2fedb76de2746
BLAKE2b-256 cc64f73886b6237271f3b5bf84ccd3b03c59737d2455cb43e5708359e3c3a0ea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyensmallen-0.3.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e74ba262fc7dfcb6ea9698dd9f7b7ed3fcdb0a12e77cf3062cd312e1a1ffe063
MD5 1b0973110d3e1b2672ec5f8891d04c89
BLAKE2b-256 6d956e35d48f91d92389c75dd94006ae628b424c03d4bec9249e0456806ac4f2

See more details on using hashes here.

Provenance

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