-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_runner.py
More file actions
65 lines (42 loc) · 1.99 KB
/
demo_runner.py
File metadata and controls
65 lines (42 loc) · 1.99 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
This is a demo of how to use the open-source version of FixOut
"""
from fixout.artifact import FixOutArtifact
from fixout.runner import FixOutRunner
from fixout.demos.demo_data import importGermanData, importCompasData, importBankData
def demo3():
model, X_train, X_test, y_train, y_test, features_name, dic = importBankData()
fxo = FixOutRunner("Bank")
sensitive_features = ["age","marital","contact"]
fxa = FixOutArtifact(model=model,
training_data=(X_train,y_train),
testing_data=[(X_test,y_test,"Testing")],
features_name=features_name,
sensitive_features=sensitive_features,
dictionary=dic)
fxo.run(fxa, show=True)
def demo2():
model, X_train, X_test, y_train, y_test, features_name, dic = importCompasData()
fxo = FixOutRunner("Predicting Recidivism")
sensitive_features = ["sex","age","race"] # or [19,18,8]
fxa = FixOutArtifact(model=model,
training_data=(X_train,y_train),
testing_data=[(X_test,y_test,"Testing")],
features_name=features_name,
sensitive_features=sensitive_features,
dictionary=dic)
fxo.run(fxa, show=True)
def demo():
model, X_train, X_test, y_train, y_test, features_name, dic = importGermanData()
fxo = FixOutRunner("Credit Risk Assessment (German bank)")
#sensitive_features = [19,18,8]
sensitive_features = ["foreignworker","telephone","statussex"]
fxa = FixOutArtifact(model=model,
training_data=(X_train,y_train),
testing_data=[(X_test,y_test,"Testing")],
features_name=features_name,
sensitive_features=sensitive_features,
dictionary=dic)
fxo.run(fxa, show=True)
if __name__ == '__main__':
demo()