-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathplot_scalability.py
72 lines (63 loc) · 2.81 KB
/
plot_scalability.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
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
66
67
68
69
70
71
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import matplotlib as mpl
mpl.rcParams['lines.linewidth'] = 3
plt.rc('axes', labelsize=16)
plt.rc('axes', titlesize=16)
intrees = pd.read_csv('./results/global_result/intrees/experiment.csv')
defrag = pd.read_csv('./results/global_result/defrag/experiment.csv')
te2rules = pd.read_csv('./results/global_result/te2rules/experiment.csv')
file_extension = ".jpg"
linestyle = {3:"-", 5:"--"}
color = {100:"r", 200:"g", 500:"b"}
X_metric = "num_stages"
Y_metric = "time"
for dataset in ["compas", "bank", "adult"]:
te2rules_dataset = te2rules[te2rules.dataset == dataset]
te2rules_dataset = te2rules_dataset[te2rules_dataset.jaccard_threshold == 0.2]
assert(len(te2rules_dataset) == 3*3*2)
plt.figure()
plt.title(dataset)
for num_trees in [100, 200, 500]:
for depth in [3, 5]:
exp_name = str("(") + str(num_trees) + ", " + str(depth) + ")"
te2rules_to_plot = te2rules_dataset[te2rules_dataset.num_trees == num_trees]
te2rules_to_plot = te2rules_to_plot[te2rules_dataset.depth == depth]
plt.plot(te2rules_to_plot[X_metric], te2rules_to_plot[Y_metric],
marker='o',
linestyle=linestyle[depth],
color=color[num_trees],
label=exp_name)
plt.yscale("log")
plt.ylabel("runtime (seconds)")
plt.xlabel("stages")
plt.xticks([1,2,3])
plt.legend()
plt.savefig("./plots/scalability/" + dataset + "_time" + file_extension)
plt.close()
X_metric = "num_stages"
Y_metric = "test_fidelity_positive"
for dataset in ["compas", "bank", "adult"]:
te2rules_dataset = te2rules[te2rules.dataset == dataset]
te2rules_dataset = te2rules_dataset[te2rules_dataset.jaccard_threshold == 0.2]
assert(len(te2rules_dataset) == 3*3*2)
plt.figure()
plt.title(dataset)
for num_trees in [100, 200, 500]:
for depth in [3, 5]:
exp_name = str("(") + str(num_trees) + ", " + str(depth) + ")"
te2rules_to_plot = te2rules_dataset[te2rules_dataset.num_trees == num_trees]
te2rules_to_plot = te2rules_to_plot[te2rules_dataset.depth == depth]
plt.plot(te2rules_to_plot[X_metric], te2rules_to_plot[Y_metric],
marker='o',
linestyle=linestyle[depth],
color=color[num_trees],
label=exp_name)
plt.ylabel("fidelity (positives)")
plt.xlabel("number of stages")
plt.xticks([1,2,3])
plt.ylim([0, 1])
plt.legend()
plt.savefig("./plots/scalability/" + dataset + "_fidelity_positive" + file_extension)
plt.close()