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_experimental-0.2.7126.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_experimental-0.2.7126-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_experimental-0.2.7126-cp312-cp312-macosx_11_0_arm64.whl (8.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyensmallen_experimental-0.2.7126-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_experimental-0.2.7126-cp311-cp311-macosx_11_0_arm64.whl (8.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyensmallen_experimental-0.2.7126-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_experimental-0.2.7126-cp310-cp310-macosx_11_0_arm64.whl (8.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file pyensmallen_experimental-0.2.7126.tar.gz.

File metadata

File hashes

Hashes for pyensmallen_experimental-0.2.7126.tar.gz
Algorithm Hash digest
SHA256 e1802a8ae3a5583b5523ff3166fbfd0ebe65a745c73986bcf050d89dee59408b
MD5 0bdd6957c1e4271e833ac7cb4ae51c3d
BLAKE2b-256 742bdbf25738389ea65eca28645a4921bd3dadee254f6ce4e65bafe3ab62f081

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen_experimental-0.2.7126.tar.gz:

Publisher: build.yml on gauravmanmode/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_experimental-0.2.7126-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyensmallen_experimental-0.2.7126-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 80c4c4f6f24a6a8ee018e820fe12d3864e98f50c89ec2415425f9f6a2401ad99
MD5 ee65dd4e50ca4ef973ee2db9ad3bb4cd
BLAKE2b-256 ddc611522c9075279c521e16ac7221a281654b2465b75e39cf33c01eaaa88163

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen_experimental-0.2.7126-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on gauravmanmode/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_experimental-0.2.7126-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyensmallen_experimental-0.2.7126-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8eeb38468836ca11db42d1f270d5dc7492f1a607c947cc08809eb20f4b5be620
MD5 a43ad6e4c926843ee4874ea0c4711d80
BLAKE2b-256 241c7d8d9c686921f56df76e1f207d9c679d3e2a65aed8f588b279ebaf29c5aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen_experimental-0.2.7126-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: build.yml on gauravmanmode/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_experimental-0.2.7126-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyensmallen_experimental-0.2.7126-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a190d0a35a518602180489586912a790d073b283546e5a6729bbf89d9be2184
MD5 20d55734373e07c14051eef2ce6bf3c6
BLAKE2b-256 a5306f735cd72621ca14072cb76de75c31fed6c8b06d49a47346c9164add6db8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen_experimental-0.2.7126-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on gauravmanmode/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_experimental-0.2.7126-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyensmallen_experimental-0.2.7126-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0662978715683fc28919b8a26410c31d6c5d7204e076f8b174a5d2014ba85950
MD5 2aa9b13b8e456389b12d7e00b126082d
BLAKE2b-256 0649cea20ec95871a83d2a7bb0c8e27102375b8550d83a1230db4bb0560a9128

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen_experimental-0.2.7126-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: build.yml on gauravmanmode/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_experimental-0.2.7126-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyensmallen_experimental-0.2.7126-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58ad25796583249b5705fc252dd4d3f7b92c59b54cef6823fc2db72578824cae
MD5 f23ccd8e5b17d0e319eb1bdf0a1fd98b
BLAKE2b-256 9f150da03c38efb21f584773aeaef9e3ebb67654b9b451d15a6638b327712ae9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen_experimental-0.2.7126-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: build.yml on gauravmanmode/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_experimental-0.2.7126-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyensmallen_experimental-0.2.7126-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 68d100ad60e9b95ff2c09841a770cebd752b4b29c49dc9c1db670fdd817cfbed
MD5 472ff28ce04d7ad72ff2d990e4abd003
BLAKE2b-256 74be8eab237ba477114ff8080d8fd092aa4406cc57a2e64faabeea004d83123d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyensmallen_experimental-0.2.7126-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: build.yml on gauravmanmode/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