Skip to main content

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
  • Poisson
  • Exponential
  • Student's t
  • Voigtian
  • Crystal Ball
  • Tsallis
  • 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.

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.

Because of limited manpower, this project is barely documented. The documentation is basically pydoc numba_stats. The calling conventions are the same as for the corresponding functions in scipy.stats. These are sometimes a bit unusual, for example, for the exponential distribution, see the scipy docs for details.

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 cosmetics, 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 has been removed. To keep old code running, please pin your numba_stats to version 0.7.

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


Download files

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

Source Distribution

numba-stats-0.8.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

numba_stats-0.8.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file numba-stats-0.8.0.tar.gz.

File metadata

  • Download URL: numba-stats-0.8.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for numba-stats-0.8.0.tar.gz
Algorithm Hash digest
SHA256 9f4eda83acf9f500084f481702a99772620d7d09c9db9b79853e96399efd5b77
MD5 02286191841d2230ba033f179a881169
BLAKE2b-256 f1cb1ad914f3f84ccf6b7910fcad917eda0de1c9d71a635bc18336150ea05449

See more details on using hashes here.

File details

Details for the file numba_stats-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: numba_stats-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

File hashes

Hashes for numba_stats-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca89592b9e93b4203214dbc7ca8b8df3de8c5239a209ddf903ee0ce9e01a15c2
MD5 6a9617a03ae8d8ddf8854d8dd424e06e
BLAKE2b-256 c433d60273f04846d26a60a433693a12da6fcf95d08b41c37594c8f2dd67b056

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