37 lines
565 B
Python
37 lines
565 B
Python
|
from utils import *
|
||
|
|
||
|
def i(A, B):
|
||
|
"""
|
||
|
:param A: First probability
|
||
|
:param B: Second probability
|
||
|
:return: The intersection of A and B
|
||
|
"""
|
||
|
return A * B
|
||
|
|
||
|
|
||
|
def u(A, B):
|
||
|
"""
|
||
|
:param A: The first probability
|
||
|
:param B: The second probability
|
||
|
:return: The union of A and B
|
||
|
"""
|
||
|
return A + B - i(A, B)
|
||
|
|
||
|
|
||
|
def g(A, B):
|
||
|
"""
|
||
|
:param A: The first probability
|
||
|
:param B: The second probability
|
||
|
:return: The conditional probability of A given B
|
||
|
"""
|
||
|
return g(A, B) / B
|
||
|
|
||
|
|
||
|
def n(A):
|
||
|
"""
|
||
|
:param A: The probability
|
||
|
:return: The negation of A
|
||
|
"""
|
||
|
return 1 - A
|
||
|
|
||
|
man(man)
|