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
|
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
import time
from time import strftime, gmtime
def get_name() -> str:
curr = time.time()
s = strftime("%d_%b_%Y_%H%M%S", gmtime(curr))
return s
width = 0.4
kernels = ["Gmail", "WhatsApp", "Youtube", "Twitter", "Facebook"]
x = np.arange(5)
values = (8.13, 4.15, 10.06, 16.75, 18.84)
print(values)
# Standard deviations (error values)
# errors = [np.std(poly), np.std(rbf), np.std(sigmoid)]
# errors2 = [np.std(baseline_poly), np.std(baseline_rbf), np.std(baseline_sigmoid)]
# print(errors)
# print(errors2)
# Create bar chart with error bars
fig, ax = plt.subplots()
# plt.bar(x-0.22, values, width, yerr=errors, capsize=8, color='moccasin', edgecolor='black', label='Sunfish')
# plt.bar(x+0.22,values2, width, yerr=errors2, capsize=8, color='slategrey', edgecolor='black', label='OpenDC')
plt.bar(
x,
values,
width,
capsize=8,
color="thistle",
edgecolor="black",
label="Red + Yellow Alarms / Total Failures",
)
# Add labels and title
plt.xlabel("Mean Failure Intensity (Trace)", fontweight="bold", size=10)
plt.ylabel("Failures Detection Rate", fontweight="bold", size=10)
loc = range(len(kernels))
labels = kernels
plt.xticks(loc, kernels, size=10)
plt.grid(True, color="lightgray", linewidth=1, linestyle="-.")
plt.legend(fontsize=10, loc="upper left")
plt.yticks(size=10)
# ax.set_yscale("log")
# Show plot
location: str = "figures/%s.pdf" % get_name()
plt.savefig(location, dpi=300, bbox_inches="tight")
|