No project description provided
Project description
numerax
Statistical and numerical computation functions for JAX, focusing on tools not available in the main JAX API.
Installation
pip install numerax
# With scientific ML dependencies like equinox
pip install numerax[sciml]
Features
Special Functions
Inverse functions for statistical distributions with differentiability support:
import jax.numpy as jnp
import numerax
# Inverse functions for statistical distributions
x = numerax.special.gammap_inverse(p, a) # Gamma quantiles
y = numerax.special.erfcinv(x) # Inverse complementary error function
# Chi-squared distribution (includes JAX functions + custom ppf)
x = numerax.stats.chi2.ppf(q, df, loc=0, scale=1)
Key features:
- Inverse functions for statistical distributions missing from JAX
- Full differentiability and JAX transformation support
Profile Likelihood
Efficient profile likelihood computation for statistical inference with nuisance parameters:
import jax.numpy as jnp
import numerax
# Example: Normal distribution with mean inference, variance profiling
def normal_llh(params, data):
mu, log_sigma = params
sigma = jnp.exp(log_sigma)
return jnp.sum(-0.5 * jnp.log(2 * jnp.pi) - log_sigma
- 0.5 * ((data - mu) / sigma) ** 2)
# Profile over log_sigma, infer mu
is_nuisance = [False, True] # mu=inference, log_sigma=nuisance
def get_initial_log_sigma(data):
return jnp.array([jnp.log(jnp.std(data))])
profile_llh = numerax.stats.make_profile_llh(
normal_llh, is_nuisance, get_initial_log_sigma
)
# Evaluate profile likelihood
data = jnp.array([1.2, 0.8, 1.5, 0.9, 1.1])
llh_val, opt_nuisance, diff, n_iter = profile_llh(jnp.array([1.0]), data)
Key features:
- Convergence diagnostics and configurable optimization parameters
- Automatic parameter masking for inference vs. nuisance parameters
Utilities
Utilities such as parameter counting.
from numerax.utils import count_params
# Count parameters in PyTree-based models
model = {"weights": jnp.ones((10, 5)), "bias": jnp.zeros(5)}
num_params = count_params(model) # 55 parameters
Key features:
- Parameter counting for PyTree-based models (requires
numerax[sciml]) - Decorators for preserving function metadata when using JAX's advanced features
Acknowledgements
This work is supported by the Department of Energy AI4HEP program.
Citation
If you use numerax in your research, please cite it using the citation information from Zenodo (click the DOI badge at the top of the README) to ensure you get the correct DOI for the version you used.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file numerax-1.1.0.tar.gz.
File metadata
- Download URL: numerax-1.1.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
114325c957b5c9964924f8eb06c4a9e42e6641cb30c96d41320d9164ddd9a1ef
|
|
| MD5 |
42e7b867d4430f7035c262a5227a91b3
|
|
| BLAKE2b-256 |
20229780d3832eb5d8f1d9c58408e1549caabf6edf12dcb6b0987f24ff1ebbcd
|
Provenance
The following attestation bundles were made for numerax-1.1.0.tar.gz:
Publisher:
publish.yml on juehang/numerax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
numerax-1.1.0.tar.gz -
Subject digest:
114325c957b5c9964924f8eb06c4a9e42e6641cb30c96d41320d9164ddd9a1ef - Sigstore transparency entry: 576311119
- Sigstore integration time:
-
Permalink:
juehang/numerax@35bdc989ca0aa640186fb2d736171eaa40e26c83 -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/juehang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@35bdc989ca0aa640186fb2d736171eaa40e26c83 -
Trigger Event:
release
-
Statement type:
File details
Details for the file numerax-1.1.0-py3-none-any.whl.
File metadata
- Download URL: numerax-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06753a95a8c669c20c7332e5b2c896993036c69d893d9e8daf7f7ecca1d9bbec
|
|
| MD5 |
987c9652d234f969f0c89fdca9279c79
|
|
| BLAKE2b-256 |
c96a6666b821fb811fcabf61734e08b080cdaafb4ede5761bf7381ba7ece0a83
|
Provenance
The following attestation bundles were made for numerax-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on juehang/numerax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
numerax-1.1.0-py3-none-any.whl -
Subject digest:
06753a95a8c669c20c7332e5b2c896993036c69d893d9e8daf7f7ecca1d9bbec - Sigstore transparency entry: 576311123
- Sigstore integration time:
-
Permalink:
juehang/numerax@35bdc989ca0aa640186fb2d736171eaa40e26c83 -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/juehang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@35bdc989ca0aa640186fb2d736171eaa40e26c83 -
Trigger Event:
release
-
Statement type: