-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (30 loc) · 900 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from logic.types import product as logic
from logic.expression import Context
from logic.manager import Manager
manager = Manager(
E="-((M=>Mc)&(Mc=>M))",
T="!(-(tol=>{E}))",
bias="S&{E}&{T}",
fairness="!{bias}",
)
context = Context(logic,
S=0.2,
M=0.8,
Mc=0.78,
tol=0.01)
predicates = {
"S": "protected group members are encountered",
"E": "there is discrimination against the group",
"M": "accurate group predictions",
"Mc": "accurate other predictions",
"T": "numerical tolerance is reached",
"tol": "acceptable numerical tolerance"
}
print("Chosen logic: "+logic.text())
print(manager.text(**predicates))
manager.evaluate(context)
print("\n\n")
print("truth values")
print("------------")
for k, v in context.values.items():
print(predicates.get(k,k).ljust(50)+f"{v:.3f}")