API Reference
Frame
- class evidencelib.Frame(atoms, *, empty=(), exclusive=False, model='hybrid')[source]
A finite frame of discernment.
The internal representation uses Venn regions. This lets the same proposition algebra represent Shafer’s exclusive DST model, the free DSmT model, and constrained hybrid DSm models.
- Parameters:
- elements(*, max_count=100000)[source]
Generate the model’s closure under union and intersection.
The result is the power set for DST and the hyper-power set for the free DSm model. DSmT cardinality grows very quickly; pass
max_count=Noneonly when you really want the full closure.- Parameters:
max_count (int | None)
- Return type:
tuple[Proposition, …]
- format(prop)[source]
- Parameters:
prop (Proposition)
- Return type:
- proposition(value)[source]
Coerce a string, proposition, or iterable of atoms into a proposition.
- Parameters:
value (str | Proposition | Iterable[str])
- Return type:
- symbols(names=None)[source]
Return atom propositions.
namesmay be omitted to return all frame atoms, or supplied as a whitespace/comma-separated subset.- Parameters:
names (str | None)
- Return type:
tuple[Proposition, …]
MassFunction
- class evidencelib.MassFunction(frame, values, *, validate=True, tolerance=1e-09)[source]
A basic belief assignment over a frame.
- Parameters:
- conjunctive(*others)[source]
Unnormalized conjunctive rule.
On a free DSm frame this is the classic DSm rule (DSmC). On Shafer’s DST model, contradictory intersections are accumulated on
empty.- Parameters:
others (MassFunction)
- Return type:
- dempster(*others)[source]
Dempster’s normalized rule of combination.
- Parameters:
others (MassFunction)
- Return type:
- dsmc(*others)[source]
Alias for the classic conjunctive DSm rule.
- Parameters:
others (MassFunction)
- Return type:
- dsmh(*others)[source]
Hybrid DSm rule for constrained models.
Products whose intersection is non-empty go to that intersection. Products whose intersection is empty are transferred to the union of the involved propositions. If that union is also empty under the model, the mass goes to total ignorance.
- Parameters:
others (MassFunction)
- Return type:
- dubois_prade(*others)[source]
Dubois-Prade style transfer of conflicts to disjunctions.
- Parameters:
others (MassFunction)
- Return type:
- focal()[source]
- Return type:
tuple[Proposition, …]
- normalization_tolerance = 1e-06
- pcr5(other)[source]
PCR5 for two sources.
- Parameters:
other (MassFunction)
- Return type:
- pcr6(*others)[source]
PCR6 proportional conflict redistribution for two or more sources.
- Parameters:
others (MassFunction)
- Return type:
- pignistic()[source]
Return pignistic scores for singleton hypotheses.
This is the classical pignistic transformation on DST frames. On free or hybrid DSmT frames, singleton hypotheses can overlap, so the returned event scores are useful for decisions but do not have to sum to one.
- smets(*others)[source]
Smets/TBM unnormalized rule, keeping conflict on the empty set.
- Parameters:
others (MassFunction)
- Return type:
- to_dict(*, string_keys=True)[source]
Return the mass assignment as a plain dictionary.
- Parameters:
string_keys (bool)
- Return type:
dict[str | Proposition, float]
- yager(*others)[source]
Yager’s rule: transfer total conflict to total ignorance.
- Parameters:
others (MassFunction)
- Return type:
Proposition
- class evidencelib.Proposition(frame, regions)[source]
A canonical proposition represented by possible Venn regions.
Users normally create propositions through a
evidencelib.Frameand combine them with|for union and&for intersection.- intersects(other)[source]
- Parameters:
other (Proposition)
- Return type:
Exceptions
Package-specific exceptions.