Skip to main content

No project description provided

Project description

numerax

tests docs

Statistical and numerical computation functions for JAX, focusing on tools not available in the main JAX API.

📖 Documentation

Installation

pip install numerax

Features

Special Functions

Inverse functions for statistical distributions with differentiability support:

import jax.numpy as jnp
import numerax

# Gamma distribution quantiles
x = numerax.special.gammap_inverse(p, a)

# Chi-squared distribution quantiles  
x = numerax.special.chi2.ppf(q, df, loc=0, scale=1)

Key features:

  • Halley's method for fast convergence
  • Custom JVP implementation for exact gradients
  • Numerical stability with adaptive precision
  • Full JAX transformation compatibility

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:

  • JIT-compiled for performance
  • L-BFGS optimization with convergence diagnostics
  • Configurable tolerance and initial values
  • Handles parameter masking automatically

Utilities

Development utilities for creating JAX functions with custom derivatives while ensuring proper documentation support. Includes decorators for preserving function metadata when using JAX's advanced features.

Requirements

  • Python ≥ 3.12
  • JAX
  • jaxtyping
  • optax

Acknowledgements

This work is supported by the Department of Energy AI4HEP program.

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

numerax-0.3.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numerax-0.3.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file numerax-0.3.0.tar.gz.

File metadata

  • Download URL: numerax-0.3.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for numerax-0.3.0.tar.gz
Algorithm Hash digest
SHA256 be3200b22b1229ad42fd1f0a049748384eaf9c180da746f247d5d05fd47d1e0a
MD5 63094fc79031998f88262a8f0c8aa21f
BLAKE2b-256 304b97cb2b2d28442584de53683319df2703ba7bbca998fb9d1384364b219327

See more details on using hashes here.

Provenance

The following attestation bundles were made for numerax-0.3.0.tar.gz:

Publisher: publish.yml on juehang/numerax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numerax-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: numerax-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for numerax-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a76674021a863c4cc579efe8a342a9fa4fdb7c7c856777f19076d9fd9771565c
MD5 c9c052a6369955e90cfaeaec4c9e1497
BLAKE2b-256 f38c3f98c5c128a66df9959bbf23ce5f275fdebcdcae5a910a3e2126933c4856

See more details on using hashes here.

Provenance

The following attestation bundles were made for numerax-0.3.0-py3-none-any.whl:

Publisher: publish.yml on juehang/numerax

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