Computational belief functions for DST and DSmT.
Project description
evidencelib
evidencelib is a Python library for belief-function calculations in Dempster-Shafer theory (DST) and Dezert-Smarandache theory (DSmT). It provides a compact, zero-dependency quantitative core for reasoning under uncertainty using belief functions.
- Documentation: https://evidencelib.readthedocs.io
- Source Code: https://github.com/itaprac/evidencelib
- PyPI: https://pypi.org/project/evidencelib/
- Issue Tracker: https://github.com/itaprac/evidencelib/issues
Features
- Multiple models — Shafer's classical DST, free DSmT, and constrained hybrid DSm models
- Proposition algebra — symbolic construction of unions, intersections, and parsing from strings
- Fusion rules — Dempster, Yager, Smets/TBM, Dubois-Prade, Hybrid DSm, PCR5, PCR6
- Belief measures — mass, belief, plausibility, commonality, conflict
- Decision support — pignistic transformation over singletons and disjoint Venn regions
- Zero dependencies — pure Python, no external packages required
- Fully typed — type hints throughout the codebase
Installation
pip install evidencelib
Requires Python 3.10 or later.
Quick Start
Basic DST Example
from evidencelib import Frame
# Create a frame with mutually exclusive hypotheses
frame = Frame.dst(["Alive", "Dead"])
Alive, Dead = frame.symbols()
# Define a basic belief assignment
m = frame.mass({
Alive: 0.2,
Dead: 0.5,
Alive | Dead: 0.3,
})
# Query belief measures
print(m.belief(Alive)) # 0.2
print(m.plausibility(Alive)) # 0.5
print(m.pignistic()) # {"Alive": 0.35, "Dead": 0.65}
print(m.decision()) # "Dead"
Combining Evidence
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})
# Dempster's rule
print(m1.dempster(m2).to_dict())
# {"A": 0.512, "A|B": 0.341, "B": 0.146}
# PCR6
print(m1.pcr6(m2).to_dict())
# {"A": 0.54, "A|B": 0.28, "B": 0.18}
DSmT with Overlapping Hypotheses
from evidencelib import Frame
# Free DSm model — hypotheses may overlap
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()) # singleton scores (may not sum to 1)
print(m.pignistic_regions()) # probability over disjoint Venn regions
API Overview
Frames
| Constructor | Description |
|---|---|
Frame.dst(atoms) |
Shafer's model — exhaustive and mutually exclusive hypotheses |
Frame.dsmt(atoms) |
Free DSm model — hypotheses may overlap |
Frame.hybrid(atoms, empty=..., exclusive=...) |
Constrained DSm model with explicit constraints |
Propositions
| Operation | Description |
|---|---|
A | B |
Union / disjunction |
A & B |
Intersection / conjunction |
frame.proposition("A ∩ (B ∪ C)") |
Parse from string |
frame.elements() |
Generate power set or hyper-power set |
Belief Measures
| Method | Description |
|---|---|
mass(A) |
Direct mass assigned to proposition A |
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 |
dempster(...) |
Dempster's normalized rule |
smets(...) |
TBM/Smets rule — keeps conflict on empty set |
yager(...) |
Yager's rule — transfers conflict to total ignorance |
dsmc(...) |
Classic DSm conjunctive rule |
dsmh(...) |
Hybrid DSm rule for constrained models |
dubois_prade(...) |
Dubois-Prade 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 Venn regions |
decision() |
Singleton with the largest pignistic probability |
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 tests:
python -m pytest -q
Build documentation:
python -m sphinx -W -b html docs docs/_build/html
Examples
See the examples/ directory for complete scripts:
basic_dst.py— simple DST frame and belief measuresrules_dst.py— comparing fusion ruleszadeh.py— Zadeh's classic counterexampledsmt_fusion.py— DSmT evidence fusionhybrid_dsmt.py— constrained hybrid DSm model
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
MIT License — see LICENSE for details.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file evidencelib-1.0.1.tar.gz.
File metadata
- Download URL: evidencelib-1.0.1.tar.gz
- Upload date:
- Size: 57.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc4081a92dfe771e111c746b053e8d83e674997b7bc3f1d56d8fb246f1d77274
|
|
| MD5 |
fd71422967856d892d350a2c018f78ca
|
|
| BLAKE2b-256 |
5a87d54464db7b37a88221d604481213b888bfbbdc9a6551ce7747cfb87d1254
|
Provenance
The following attestation bundles were made for evidencelib-1.0.1.tar.gz:
Publisher:
publish.yml on itaprac/evidencelib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evidencelib-1.0.1.tar.gz -
Subject digest:
cc4081a92dfe771e111c746b053e8d83e674997b7bc3f1d56d8fb246f1d77274 - Sigstore transparency entry: 1563634244
- Sigstore integration time:
-
Permalink:
itaprac/evidencelib@bc57c2533e6b2bd5cf957c8f095a8eff3df00944 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/itaprac
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bc57c2533e6b2bd5cf957c8f095a8eff3df00944 -
Trigger Event:
push
-
Statement type:
File details
Details for the file evidencelib-1.0.1-py3-none-any.whl.
File metadata
- Download URL: evidencelib-1.0.1-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
044d3553727bf1d406e8d061106f6e386b9774068702cc053dfbab267214aa3d
|
|
| MD5 |
3934d0af93ee9fb9df6e1fb9046dff24
|
|
| BLAKE2b-256 |
96392d7f4775a2db6383b50f0df7a4384785ac21e97bddd5d4f7e2dd0f044e8e
|
Provenance
The following attestation bundles were made for evidencelib-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on itaprac/evidencelib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evidencelib-1.0.1-py3-none-any.whl -
Subject digest:
044d3553727bf1d406e8d061106f6e386b9774068702cc053dfbab267214aa3d - Sigstore transparency entry: 1563634264
- Sigstore integration time:
-
Permalink:
itaprac/evidencelib@bc57c2533e6b2bd5cf957c8f095a8eff3df00944 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/itaprac
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bc57c2533e6b2bd5cf957c8f095a8eff3df00944 -
Trigger Event:
push
-
Statement type: