Skip to main content

JAX based lib for sampling statistical distributions.

Project description

JAXampler

Python package

JAX based lib for sampling statistical distributions.

Samplers

In order to sample from a distribution, import the corresponding sampler from the jaxampler.sampler module and call the sample method with the required arguments.

from jaxampler.rvs import Beta, Normal
from jaxampler.sampler import AcceptRejectSampler

scale = 1.35
N = 100_000

target_rv = Normal(mu=0.5, sigma=0.2)
proposal_rv = Beta(alpha=2, beta=2)

ar_sampler = AcceptRejectSampler()

samples = ar_sampler.sample(
    target_rv=target_rv,
    proposal_rv=proposal_rv,
    scale=scale,
    N=N,
)

JAXampler currently supports the following samplers:

Random Variables

To create a new random variable, import the corresponding type from the jaxampler.rvs i.e. DiscreteRV and ContinuousRV for discrete and continuous random variables respectively. Then, instantiate the random variable with the required parameters and implement the necessary methods (logpdf, cdf, and ppf etc). JAXampler currently supports the following random variables:

Discrete Random Variables

Continuous Random Variables

Citing Jaxampler

To cite this repository:

@software{jaxampler2023github,
    author  = {Meesum Qazalbash},
    title   = {{JAXampler}: tool for sampling statistical distributions},
    url     = {http://github.com/Qazalbash/jaxampler},
    version = {0.0.1},
    year    = {2023}
}

Contributors

Made with contrib.rocks.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

jaxampler-0.0.2-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file jaxampler-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: jaxampler-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 41.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for jaxampler-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d17aa422380b5cdf2fe612479397427c6ce430b976b45562defd58a852a2b1fc
MD5 1deab411b0ce2b90ef47c2796b628033
BLAKE2b-256 932c9b22019f9045b6dcbf36b381e763fe207518546f59ea4f7603b041a5291e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page