Skip to main content

perform probability fusion

Project description

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
  • NaN and 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:

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!

Download files

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

Source Distribution

fuz-0.1.3.tar.gz (149.0 kB view details)

Uploaded Source

Built Distribution

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

fuz-0.1.3-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file fuz-0.1.3.tar.gz.

File metadata

  • Download URL: fuz-0.1.3.tar.gz
  • Upload date:
  • Size: 149.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for fuz-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e38fa66c7d2220e54a9f712a27fcb3eb75e41029bb70714d06a8a5a3d89cb878
MD5 ef90e650426559598ffd8225fd8ca7e1
BLAKE2b-256 7bc60998ef0216c587eadbe2686529b86982bc4c908633b05ed23a4af3cb0654

See more details on using hashes here.

File details

Details for the file fuz-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: fuz-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for fuz-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e3127fb5115160ca42f40e36897e472902bbb91c8299093a8e642cfee2c404ea
MD5 506abc12dfc46cbfcdd71d30d5c6903d
BLAKE2b-256 7e6c575de5cd95cb414426ab43b6553bb4e115d2b5681e74bcbaaa838e7f345f

See more details on using hashes here.

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