Skip to main content

Paramax for Python 3.9 (a fork)

============ Parameterizations and constraints for JAX PyTrees

Paramax allows applying custom constraints or behaviors to PyTree components, using unwrappable placeholders. This can be used for

  • Enforcing positivity (e.g., scale parameters)
  • Structured matrices (triangular, symmetric, etc.)
  • Applying tricks like weight normalization
  • Marking components as non-trainable

Some benefits of the unwrappable pattern:

  • It allows parameterizations to be computed once for a model (e.g. at the top of the loss function).
  • It is flexible, e.g. allowing custom parameterizations to be applied to PyTrees from external libraries
  • It is concise

If you found the package useful, please consider giving it a star on github, and if you create AbstractUnwrappables that may be of interest to others, a pull request would be much appreciated!

Documentation

Original documentation available here.

Installation (Requires python>=3.9)

pip install paramax 

Example

>>> import paramax
>>> import jax.numpy as jnp
>>> scale = paramax.Parameterize(jnp.exp, jnp.log(jnp.ones(3)))  # Enforce positivity
>>> paramax.unwrap(("abc", 1, scale))
('abc', 1, Array([1., 1., 1.], dtype=float32))

Alternative parameterization patterns

Using properties to access parameterized model components is common but has drawbacks:

  • Parameterizations are tied to class definition, limiting flexibility e.g. this cannot be used on PyTrees from external libraries
  • It can become verbose with many parameters
  • It often leads to repeatedly computing the parameterization

Related

  • We make use of the Equinox package, to register the PyTrees used in the package
  • This package spawned out of a need for a simple method to apply parameter constraints in the distributions package flowjax

Metadata

Release files for paramax-py39 0.0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for paramax-py39 0.0.3.1
File Size Uploaded Provenance
paramax_py39-0.0.3.1.tar.gz 3.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for paramax-py39 0.0.3.1
File Interpreter ABI Platform
paramax_py39-0.0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / paramax_py39-0.0.3.1.tar.gz

Download URL paramax_py39-0.0.3.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ed6d58a789336495db2ccb5a49ea0fd62464fc95e178e6cd7b5a47f7a36418cc
BLAKE2b-256 checksum
How to use checksums
d34fcb7b5e376dae55324df2ba49f48a9a60f57197cde8d0a0f56afe7837c555
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.19

Release files / paramax_py39-0.0.3.1-py3-none-any.whl

Download URL paramax_py39-0.0.3.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d3dd2d62078d4ee7cbe76883b3cd4c75365a1cf4192fa20924dbd2cbc6ebad0
BLAKE2b-256 checksum
How to use checksums
edbd42ae838c8d6eb53e783fdd037b8c2f897a3e6c99447aaac0107195d1034f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.19

Security for paramax-py39 0.0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.3.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page