pyuncertainnumber.pba.dss ========================= .. py:module:: pyuncertainnumber.pba.dss .. autoapi-nested-parse:: Constructors for Dempester-Shafer structures. Classes ------- .. autoapisummary:: pyuncertainnumber.pba.dss.dempstershafer_element pyuncertainnumber.pba.dss.DempsterShafer Functions --------- .. autoapisummary:: pyuncertainnumber.pba.dss.plot_dss_raw pyuncertainnumber.pba.dss.plot_dss_raw_reverse_axis pyuncertainnumber.pba.dss.plot_DS_structure pyuncertainnumber.pba.dss.plot_DS_structure_with_labels Module Contents --------------- .. py:class:: dempstershafer_element Bases: :py:obj:`tuple` .. py:attribute:: interval .. py:attribute:: mass .. py:class:: DempsterShafer(intervals: pyuncertainnumber.pba.intervals.Interval | list[list] | list[pyuncertainnumber.pba.intervals.Interval] | numpy.ndarray, masses: numpy.typing.ArrayLike) Bases: :py:obj:`pyuncertainnumber.pba.mixins.NominalValueMixin`, :py:obj:`pyuncertainnumber.pba.mixins._PboxOpsMixin` Class for Dempester-Shafer structures. :param intervals: expect wildcard vector intervals, vec-Interval; list of scalar intervals; list of list pairs; or 2D array; :param masses: probability masses :type masses: ArrayLike .. rubric:: 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. .. figure:: /_static/dss_pbox_illustration.png :alt: p-box and DSS illustration :align: center :width: 80% P-box and Dempster Shafer structure illustration. .. py:attribute:: _intervals .. py:attribute:: _masses .. py:method:: _create_DSstructure() .. py:method:: __repr__() .. py:method:: _compute_nominal_value() .. py:property:: structures .. py:property:: intervals Returns the Interval-typed focal elements of the Dempster-Shafer structure. .. py:property:: focal_elements Returns the focal elements of the Dempster-Shafer structure. .. py:property:: masses .. py:method:: plot(style='raw', ax=None, zorder=None, **kwargs) for box type transform dss into a pbox and plot :param style: "raw" (default), "box", "pbox", "interval" :type style: str :param edge_color: edge color for raw style. If None, use default red color. :type edge_color: str .. py:method:: display(style='box', ax=None, **kwargs) .. py:method:: to_pbox() .. py:method:: _to_pbox() for mixin use only .. py:method:: from_dsElements(*ds_elements: dempstershafer_element) :classmethod: Create a Dempster-Shafer structure from a list of Dempster-Shafer elements. .. py:function:: plot_dss_raw(intervals, masses, edge_color=None, ax=None, zorder=None, **kwargs) plot the Dempster-Shafer structures in a raw (boxes)form :param intervals: vec-Interval; list of scalar intervals; list of list pairs; or 2D array; :param masses: masses of the intervals :type masses: array-like :param ax: matplotlib axis object .. py:function:: plot_dss_raw_reverse_axis(intervals, masses, ax=None, orientation='xy', invert_xaxis=True) Plot Dempster–Shafer structures as boxes. :param intervals: list of (a, b) intervals :param masses: list or array of probability masses :param ax: matplotlib axis object :param orientation: "xy" (default) or "yx" (reversed; swaps X and Y axes) .. py:function:: 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 :param vec_interval: vec-Interval; list of scalar intervals; list of list pairs; or 2D array; :param masses: masses of the intervals :param offset: offset for display the masses next to the intervals .. py:function:: 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 :param vec_interval: vec-Interval; list of scalar intervals; list of list pairs; or 2D array; :param masses: masses of the intervals :param offset: offset for display the masses next to the intervals