Skip to content

Func

dstz.math.func

bel(element, ev)

Calculates the belief function for an element.

The belief function (Bel) measures the total belief that is directly committed to a hypothesis (represented by element). It is calculated as the sum of the masses of all focal sets that are subsets of the element's value set.

Parameters:

Name Type Description Default
element Element

The element representing the hypothesis of interest.

required
ev Evidence

The evidence distribution (mass function).

required

Returns:

Name Type Description
float

The belief value for the given element.

Source code in dstz/math/func.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
def bel(element, ev):
    """Calculates the belief function for an element.

    The belief function (Bel) measures the total belief that is directly
    committed to a hypothesis (represented by `element`). It is calculated
    as the sum of the masses of all focal sets that are subsets of the
    element's value set.

    Args:
        element (Element): The element representing the hypothesis of interest.
        ev (Evidence): The evidence distribution (mass function).

    Returns:
        float: The belief value for the given element.
    """
    res = 0
    for key in ev:
        if key.value and key.value.issubset(element.value):
            res += ev[key]
    return res

pl(element, ev)

Calculates the plausibility of an element.

The plausibility function (Pl) measures the total belief that can possibly be attributed to a hypothesis (represented by element). It is calculated as the sum of the masses of all focal sets that have a non-empty intersection with the element's value set.

Parameters:

Name Type Description Default
element Element

The element representing the hypothesis of interest.

required
ev Evidence

The evidence distribution (mass function).

required

Returns:

Name Type Description
float

The plausibility value for the given element.

Source code in dstz/math/func.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
def pl(element, ev):
    """Calculates the plausibility of an element.

    The plausibility function (Pl) measures the total belief that can possibly
    be attributed to a hypothesis (represented by `element`). It is calculated
    as the sum of the masses of all focal sets that have a non-empty
    intersection with the element's value set.

    Args:
        element (Element): The element representing the hypothesis of interest.
        ev (Evidence): The evidence distribution (mass function).

    Returns:
        float: The plausibility value for the given element.
    """
    res = 0
    for key in ev:
        if element.value.intersection(key.value):
            res += ev[key]
    return res

q(element, ev)

Calculates the commonality function for an element.

The commonality function (Q) measures the total belief that is committed to a body of evidence that contains the hypothesis (element) as a subset. It is calculated as the sum of the masses of all focal sets that are supersets of the element's value set.

Parameters:

Name Type Description Default
element Element

The element representing the hypothesis of interest.

required
ev Evidence

The evidence distribution (mass function).

required

Returns:

Name Type Description
float

The commonality value for the given element.

Source code in dstz/math/func.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def q(element, ev):
    """Calculates the commonality function for an element.

    The commonality function (Q) measures the total belief that is committed
    to a body of evidence that contains the hypothesis (`element`) as a subset.
    It is calculated as the sum of the masses of all focal sets that are
    supersets of the element's value set.

    Args:
        element (Element): The element representing the hypothesis of interest.
        ev (Evidence): The evidence distribution (mass function).

    Returns:
        float: The commonality value for the given element.
    """
    res = 0
    for key in ev:
        if key.value and element.value.issubset(key.value):
            res += ev[key]
    return res