pyuncertainnumber.pba.dss

Constructors for Dempester-Shafer structures.

Classes

dempstershafer_element

DempsterShafer

Class for Dempester-Shafer structures.

Functions

plot_dss_raw(intervals, masses[, edge_color, ax, zorder])

plot the Dempster-Shafer structures in a raw (boxes)form

plot_dss_raw_reverse_axis(intervals, masses[, ax, ...])

Plot Dempster–Shafer structures as boxes.

plot_DS_structure(vec_interval[, masses, offset, ax])

plot the Dempster-Shafer structures in intervals form

plot_DS_structure_with_labels(vec_interval[, masses, ...])

temp use: plot the intervals in a vectorised form

Module Contents

class pyuncertainnumber.pba.dss.dempstershafer_element

Bases: tuple

interval
mass
class pyuncertainnumber.pba.dss.DempsterShafer(intervals: pyuncertainnumber.pba.intervals.Interval | list[list] | list[pyuncertainnumber.pba.intervals.Interval] | numpy.ndarray, masses: numpy.typing.ArrayLike)

Bases: pyuncertainnumber.pba.mixins.NominalValueMixin, pyuncertainnumber.pba.mixins._PboxOpsMixin

Class for Dempester-Shafer structures.

Parameters:
  • intervals – expect wildcard vector intervals, vec-Interval; list of scalar intervals; list of list pairs; or 2D array;

  • masses (ArrayLike) – probability masses

Example

>>> from pyuncertainnumber import pba
>>> dss = pba.DempsterShafer(intervals=[[1,5], [3,6]], masses=[0.5, 0.5])
>>> dss.structures
[dempstershafer_element(interval=[1.0,5.0], mass=0.5),
 dempstershafer_element(interval=[3.0,6.0], mass=0.5)]

Note

Dempster-Shafer structures are also called belief structures or evidence structures, and it can be converted to p-boxes.

p-box and DSS illustration

P-box and Dempster Shafer structure illustration.

_intervals
_masses
_create_DSstructure()
__repr__()
_compute_nominal_value()
property structures
property intervals

Returns the Interval-typed focal elements of the Dempster-Shafer structure.

property focal_elements

Returns the focal elements of the Dempster-Shafer structure.

property masses
plot(style='raw', ax=None, zorder=None, **kwargs)

for box type transform dss into a pbox and plot

Parameters:
  • style (str) – “raw” (default), “box”, “pbox”, “interval”

  • edge_color (str) – edge color for raw style. If None, use default red color.

display(style='box', ax=None, **kwargs)
to_pbox()
_to_pbox()

for mixin use only

classmethod from_dsElements(*ds_elements: dempstershafer_element)

Create a Dempster-Shafer structure from a list of Dempster-Shafer elements.

pyuncertainnumber.pba.dss.plot_dss_raw(intervals, masses, edge_color=None, ax=None, zorder=None, **kwargs)

plot the Dempster-Shafer structures in a raw (boxes)form

Parameters:
  • intervals – vec-Interval; list of scalar intervals; list of list pairs; or 2D array;

  • masses (array-like) – masses of the intervals

  • ax – matplotlib axis object

pyuncertainnumber.pba.dss.plot_dss_raw_reverse_axis(intervals, masses, ax=None, orientation='xy', invert_xaxis=True)

Plot Dempster–Shafer structures as boxes.

Parameters:
  • intervals – list of (a, b) intervals

  • masses – list or array of probability masses

  • ax – matplotlib axis object

  • orientation – “xy” (default) or “yx” (reversed; swaps X and Y axes)

pyuncertainnumber.pba.dss.plot_DS_structure(vec_interval: list[pyuncertainnumber.pba.intervals.Interval] | numpy.ndarray | list[list], masses=None, offset=0.3, ax=None, **kwargs)

plot the Dempster-Shafer structures in intervals form

Parameters:
  • vec_interval – vec-Interval; list of scalar intervals; list of list pairs; or 2D array;

  • masses – masses of the intervals

  • offset – offset for display the masses next to the intervals

pyuncertainnumber.pba.dss.plot_DS_structure_with_labels(vec_interval: list[pyuncertainnumber.pba.intervals.Interval], masses=None, offset=0.3, ax=None, **kwargs)

temp use: plot the intervals in a vectorised form

Parameters:
  • vec_interval – vec-Interval; list of scalar intervals; list of list pairs; or 2D array;

  • masses – masses of the intervals

  • offset – offset for display the masses next to the intervals