Skip to main content

Computational belief functions for DST and DSmT.

Project description

evidencelib

CI Documentation Status License: MIT

Python library for belief-function calculations in Dempster-Shafer theory (DST) and Dezert-Smarandache theory (DSmT).

evidencelib provides a compact quantitative core for finite frames: symbolic propositions, basic belief assignments, evidence fusion rules, belief measures, and pignistic decision support.

Documentation is available on Read the Docs.


Installation

You can install evidencelib using pip:

pip install evidencelib

For local development:

git clone https://github.com/itaprac/evidencelib.git
cd evidencelib
python3.10 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev,docs]"

Run the test suite:

python -m pytest -q

Build the documentation locally:

python -m sphinx -W -b html docs docs/_build/html

Available Functionality

The library contains:

Models

Constructor Description
Frame.dst(...) Shafer's classical DST model with exhaustive and mutually exclusive hypotheses.
Frame.dsmt(...) Free DSm model where hypotheses may overlap.
Frame.hybrid(...) Constrained DSm model with explicit emptiness or exclusivity constraints.

Proposition Algebra

Operation Meaning
A | B Union / disjunction, A ∪ B.
A & B Intersection / conjunction, A ∩ B.
frame.proposition("A ∩ (B ∪ C)") Parse a proposition from text.
frame.elements() Generate the model's power set or hyper-power set.

Belief Measures

Method Description
mass(A) Direct mass assigned to a proposition.
belief(A) Sum of masses contained in A.
plausibility(A) Sum of masses intersecting A.
commonality(A) Sum of masses containing A.
conflict Mass assigned to the empty proposition.

Fusion Rules

Method Description
conjunctive(...) Unnormalized conjunctive rule.
dsmc(...) Classic DSm rule on a free DSm frame.
smets(...) TBM/Smets rule, keeping conflict on the empty proposition.
dempster(...) Normalized Dempster rule.
yager(...) Yager rule, moving conflict to total ignorance.
dsmh(...) Hybrid DSm rule for constrained models.
dubois_prade(...) Static Dubois-Prade-style conflict transfer.
pcr5(...) PCR5 for two sources.
pcr6(...) PCR6 for two or more sources.

Decision Support

Method Description
pignistic() Singleton pignistic scores.
pignistic_regions() Probability distribution over disjoint model regions.
decision() Singleton with the largest pignistic score.

Usage Example

from evidencelib import Frame

frame = Frame.dst(["A", "B"])
A, B = frame.symbols()

m1 = frame.mass({
    A: 0.6,
    A | B: 0.4,
})

m2 = frame.mass({
    B: 0.3,
    A | B: 0.7,
})

print(m1.dempster(m2).to_dict())
print(m1.pcr5(m2).to_dict())

Output:

{"A": 0.5121951219512195, "A|B": 0.34146341463414637, "B": 0.14634146341463414}
{"A": 0.54, "A|B": 0.28, "B": 0.18}

Free DSmT example:

frame = Frame.dsmt(["A", "B"])
A, B = frame.symbols()

m = frame.mass({
    A: 0.2,
    B: 0.3,
    A & B: 0.4,
    A | B: 0.1,
})

print(m.pignistic())
print(m.pignistic_regions())

In DSmT, singleton hypotheses can overlap, so pignistic() returns decision scores that do not necessarily sum to one. Use pignistic_regions() for a probability distribution over disjoint Venn regions.

More examples are available in the examples/ directory and in the documentation.


References

  • Shafer, G. (1976). A Mathematical Theory of Evidence. Princeton University Press.
  • Smarandache, F., & Dezert, J. (eds.). Advances and Applications of DSmT for Information Fusion.
  • Dezert, J., & Smarandache, F. An Introduction to DSmT.
  • Zadeh, L. A. (1986). A simple view of the Dempster-Shafer theory of evidence and its implication for the rule of combination. AI Magazine, 7(2), 85-90.

License

evidencelib is released under the MIT License.

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

evidencelib-1.0.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

evidencelib-1.0.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file evidencelib-1.0.0.tar.gz.

File metadata

  • Download URL: evidencelib-1.0.0.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for evidencelib-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9e97f50b9814620dd2e9b98897b94b97f3ffedd3635c586f05fa06cec947f85d
MD5 2a212dc8c2b07737b3a241aa175039e8
BLAKE2b-256 7cbe222d96308e63744cd3c9af1cc55fd94d7bfff6547333647b06ee7f1c2afd

See more details on using hashes here.

File details

Details for the file evidencelib-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: evidencelib-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for evidencelib-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 79f7367926aa2a1eabc4e8b61afe1bc68f551511ddcc25ebc1cc8b783df5d837
MD5 bbec0fddb85d79d190913f4ac018a5c7
BLAKE2b-256 47a0235b715ad29b65f14ad97dde774122f2ebc0f0e5b8bfdac4f48a73b13aea

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