Numba-accelerated implementations of common probability distributions
Project description
numba-stats
We provide numba-accelerated implementations of statistical functions for common probability distributions
- Uniform
- Normal
- Log-normal
- Poisson
- Exponential
- Student's t
- Voigtian
- Crystal Ball
- Tsallis-Hagedorn, a model for the minimum bias pT distribution
- Q-Gaussian
- Bernstein density (not normalised to unity, use this in extended likelihood fits)
with more to come. The speed gains are huge, up to a factor of 100 compared to scipy
. Benchmarks are included in the repository and are run by pytest
.
Documentation (or lack of)
Because of limited manpower, this project is poorly documented. The documentation is basically pydoc numba_stats
and even that is mostly generic stubs. However, the calling conventions for those functions which have a scipy.stats
equivalent, are identical to those in SciPy. These conventions are sometimes a bit unusual, for example, in case of the exponential, the log-normal or the uniform distribution. See the SciPy docs for details.
Contributions
You can help with adding more distributions, patches are very welcome. Implementing a probability distribution is easy. You need to write it in simple Python that numba
can understand. Special functions from scipy.special
can be used after some wrapping, see submodule numba_stats._special.py
how it is done.
Plans for version 1.0
Version v1.0 (not there yet) will introduce breaking changes to the API.
# before v0.8
from numba_stats import norm_pdf
from numba_stats.stats import norm_cdf
dp = norm_pdf(1, 2, 3)
p = norm_cdf(1, 2, 3)
# recommended since v0.8
from numba_stats import norm
dp = norm.pdf(1, 2, 3)
p = norm.cdf(1, 2, 3)
This change is not only cosmetical, it was necessary to battle the increasing startup times of numba-stats
. Now you only pay the compilation cost for the distribution that you actually need. The stats
submodule will be removed. To keep old code running, please pin your numba_stats to version <1
.
numba-stats and numba-scipy
numba-scipy is the official package and repository for fast numba-accelerated scipy functions, are we reinventing the wheel?
Ideally, the functionality in this package should be in numba-scipy
and we hope that eventually this will be case. In this package, we don't offer overloads for scipy functions and classes like numba-scipy
does. This simplifies the implementation dramatically. numba-stats
is intended as a temporary solution until fast statistical functions are included in numba-scipy
. numba-stats
currently does not depend on numba-scipy
, only on numba
and scipy
.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file numba-stats-0.8.1.tar.gz
.
File metadata
- Download URL: numba-stats-0.8.1.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 283a6f76cb283a09efb310064e95af12ec450c533315a49d2ad29021f8bcb887 |
|
MD5 | 896bee226f0d544129bf6b2627d57355 |
|
BLAKE2b-256 | 12a6712596921ddb2756dd68cdf3c14f096307393556dd96e138062808be03dd |
File details
Details for the file numba_stats-0.8.1-py3-none-any.whl
.
File metadata
- Download URL: numba_stats-0.8.1-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2603e09418ee1d3808c9dd053c731c2265e1b9050397a59cd3201a7ab2403533 |
|
MD5 | 95e0768a3be7b34eeabb61c5393999c3 |
|
BLAKE2b-256 | f09b6cba19be779f255da08c531b3f8dda88d46317027bd034e6d2a1a939c212 |