fuz
fuz is a library for probability fusion, allowing the merging of distribution functions in a principled manner.
with fuz, you can do things like bayesian evidence updating, optimal bayesian ranking, and fuzzy logic.
highlights
- pooling
- linear, multiplicative, geometric, holder ...etc.
- fuzzy logic extension to distribution functions
- numerical integration in logarithmic space for stability
NaNand logarithmic complex number handling- distribution tools
upcoming features
- wider compatibility with
narwhals- dataframes, functions, samples ...etc.
- initial gpu support with
jax - more documentation 😹
demos
check out the marimo demos at:
- ch1. bernoulli to beta
- ch2. to infinity
quickstart
pip install fuz
distributions
import fuz.dists as fd
a = fd.Beta(5,4)
a.stats
b = fd.beta_from_mode_trials(0.9,10)
d = fd.Dirichlet([3,6,2])
logarithmic manipulation
import numpy as np
from fuz.log import complex_lsub, lsimp_irreg
a = np.log([[1,np.nan],[3,4]])
b = np.log([[3,2],[6,1]])
print(complex_lsub(a,b))
x = np.linspace(0,1,1025)
b = fd.beta_from_mu_k(0.3,9)
c = fd.beta_from_mode_k(0.3,9)
y = b.logpdf(x) * c.logcdf(x)
np.exp(lsimp_irreg(y,x))
note - integrating y here gives you the win rate of b over c. see the demo folder for more.
fuzzy logic
import fuz.logic as fzl
x = np.linspace(0,1,1025)
b = fd.beta_from_mode_var(0.7,0.01)
c = fd.beta_from_mu_var(0.7,0.01)
b_negpdf = fzl.negf(b.pdf)
negb_and_c = fzl.ands(x, b_negpdf(x), c.pdf(x))
pooling
ranking
more
see demo folder (pip install marimo first) for more usage.
other
the official pronunciation of fuz is a fugued function of fuzzy fusion 😉
abstract
fuz is a python library for fusion of probability distributions, bayesian evidence updating and ranking, fuzzy logic, operations in logarithmic space, and more. fuz includes several original contributions, including a performant bayesian averaging/ranking algorithm that is mathematically optimal, equations for determining whether one pdf "wins" over another, and multiple demonstrations of equivalence. these include the equivalence of simple kalman filtering, bayesian updating, and multiplicative (upco) pooling, the equivalence of mode-parameterization of beta and dirichlet distributions to optimal bayesian averaging, useful limits as the dirichlet $\alpha_0$ approaches infinity, and various equivalences for discrete distributions.
acknowledgements
thanks to jane liou for her useful insights and support!
Metadata
Release files for fuz 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fuz-0.1.3.tar.gz | 149.0 kB | Without provenance | Details for fuz-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fuz-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for fuz-0.1.3-py3-none-any.whl |
Total release size: 185.7 kB
Release files / fuz-0.1.3.tar.gz
| Download URL | fuz-0.1.3.tar.gz |
|---|---|
| Size | 149.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e38fa66c7d2220e54a9f712a27fcb3eb75e41029bb70714d06a8a5a3d89cb878
|
|
BLAKE2b-256 checksum How to use checksums |
7bc60998ef0216c587eadbe2686529b86982bc4c908633b05ed23a4af3cb0654
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Release files / fuz-0.1.3-py3-none-any.whl
| Download URL | fuz-0.1.3-py3-none-any.whl |
|---|---|
| Size | 36.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3127fb5115160ca42f40e36897e472902bbb91c8299093a8e642cfee2c404ea
|
|
BLAKE2b-256 checksum How to use checksums |
7e6c575de5cd95cb414426ab43b6553bb4e115d2b5681e74bcbaaa838e7f345f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Security for fuz 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.