Add code 2023 NVIDIA
This commit is contained in:
parent
e2acd93d18
commit
4783c71929
|
@ -0,0 +1,3 @@
|
||||||
|
*/
|
||||||
|
*.pkl
|
||||||
|
*.png
|
|
@ -0,0 +1,302 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
|
||||||
|
folder = "exp_100_epochs/"
|
||||||
|
|
||||||
|
bayes_exp_1 = load_pickle("$(folder)bayes_exp_data_1.pkl")
|
||||||
|
bayes_exp_2 = load_pickle("$(folder)bayes_exp_data_2.pkl")
|
||||||
|
bayes_exp_3 = load_pickle("$(folder)bayes_exp_data_3.pkl")
|
||||||
|
bayes_exp_4 = load_pickle("$(folder)bayes_exp_data_4.pkl")
|
||||||
|
bayes_exp_5 = load_pickle("$(folder)bayes_exp_data_5.pkl")
|
||||||
|
|
||||||
|
bayes_all_mean_tloss =
|
||||||
|
(1 / 5) * (
|
||||||
|
bayes_exp_1[:, 2] +
|
||||||
|
bayes_exp_2[:, 2] +
|
||||||
|
bayes_exp_3[:, 2] +
|
||||||
|
bayes_exp_4[:, 2] +
|
||||||
|
bayes_exp_5[:, 2]
|
||||||
|
)
|
||||||
|
bayes_all_mean_iloss =
|
||||||
|
(1 / 5) * (
|
||||||
|
bayes_exp_1[:, 4] +
|
||||||
|
bayes_exp_2[:, 4] +
|
||||||
|
bayes_exp_3[:, 4] +
|
||||||
|
bayes_exp_4[:, 4] +
|
||||||
|
bayes_exp_5[:, 4]
|
||||||
|
)
|
||||||
|
bayes_all_mean_acc =
|
||||||
|
(1 / 5) * (
|
||||||
|
bayes_exp_1[:, 3] +
|
||||||
|
bayes_exp_2[:, 3] +
|
||||||
|
bayes_exp_3[:, 3] +
|
||||||
|
bayes_exp_4[:, 3] +
|
||||||
|
bayes_exp_5[:, 3]
|
||||||
|
)
|
||||||
|
bayes_all_mean_pre =
|
||||||
|
(1 / 5) * (
|
||||||
|
bayes_exp_1[:, 5] +
|
||||||
|
bayes_exp_2[:, 5] +
|
||||||
|
bayes_exp_3[:, 5] +
|
||||||
|
bayes_exp_4[:, 5] +
|
||||||
|
bayes_exp_5[:, 5]
|
||||||
|
)
|
||||||
|
|
||||||
|
b_exp_1_tls = bayes_exp_1[:, 2]
|
||||||
|
b_exp_1_acc = bayes_exp_1[:, 3]
|
||||||
|
b_exp_1_vls = bayes_exp_1[:, 4]
|
||||||
|
b_exp_1_pre = bayes_exp_1[:, 5]
|
||||||
|
println("Training accuracy bayes 1 $(mean(b_exp_1_acc))")
|
||||||
|
println("Testing accuracy bayes 1 $(mean(b_exp_1_pre))")
|
||||||
|
|
||||||
|
b_exp_2_tls = bayes_exp_2[:, 2]
|
||||||
|
b_exp_2_acc = bayes_exp_2[:, 3]
|
||||||
|
b_exp_2_vls = bayes_exp_2[:, 4]
|
||||||
|
b_exp_2_pre = bayes_exp_2[:, 5]
|
||||||
|
println("Training accuracy bayes 2 $(mean(b_exp_2_acc))")
|
||||||
|
println("Testing accuracy bayes 2 $(mean(b_exp_2_pre))")
|
||||||
|
|
||||||
|
b_exp_3_tls = bayes_exp_3[:, 2]
|
||||||
|
b_exp_3_acc = bayes_exp_3[:, 3]
|
||||||
|
b_exp_3_vls = bayes_exp_3[:, 4]
|
||||||
|
b_exp_3_pre = bayes_exp_3[:, 5]
|
||||||
|
println("Training accuracy bayes 3 $(mean(b_exp_3_acc))")
|
||||||
|
println("Testing accuracy bayes 3 $(mean(b_exp_3_pre))")
|
||||||
|
|
||||||
|
b_exp_4_tls = bayes_exp_4[:, 2]
|
||||||
|
b_exp_4_acc = bayes_exp_4[:, 3]
|
||||||
|
b_exp_4_vls = bayes_exp_4[:, 4]
|
||||||
|
b_exp_4_pre = bayes_exp_4[:, 5]
|
||||||
|
println("Training accuracy bayes 4 $(mean(b_exp_4_acc))")
|
||||||
|
println("Testing accuracy bayes 4 $(mean(b_exp_4_pre))")
|
||||||
|
|
||||||
|
b_exp_5_tls = bayes_exp_5[:, 2]
|
||||||
|
b_exp_5_acc = bayes_exp_5[:, 3]
|
||||||
|
b_exp_5_vls = bayes_exp_5[:, 4]
|
||||||
|
b_exp_5_pre = bayes_exp_5[:, 5]
|
||||||
|
println("Training accuracy bayes 5 $(mean(b_exp_5_acc))")
|
||||||
|
println("Testing accuracy bayes 5 $(mean(b_exp_5_pre))")
|
||||||
|
|
||||||
|
cnn_exp_1 = load_pickle("$(folder)freq_exp_data_1.pkl")
|
||||||
|
cnn_exp_2 = load_pickle("$(folder)freq_exp_data_2.pkl")
|
||||||
|
cnn_exp_3 = load_pickle("$(folder)freq_exp_data_3.pkl")
|
||||||
|
cnn_exp_4 = load_pickle("$(folder)freq_exp_data_4.pkl")
|
||||||
|
cnn_exp_5 = load_pickle("$(folder)freq_exp_data_5.pkl")
|
||||||
|
|
||||||
|
cnn_all_mean_tloss =
|
||||||
|
(1 / 5) * (
|
||||||
|
cnn_exp_1[:, 2] +
|
||||||
|
cnn_exp_2[:, 2] +
|
||||||
|
cnn_exp_3[:, 2] +
|
||||||
|
cnn_exp_4[:, 2] +
|
||||||
|
cnn_exp_5[:, 2]
|
||||||
|
)
|
||||||
|
cnn_all_mean_iloss =
|
||||||
|
(1 / 5) * (
|
||||||
|
cnn_exp_1[:, 4] +
|
||||||
|
cnn_exp_2[:, 4] +
|
||||||
|
cnn_exp_3[:, 4] +
|
||||||
|
cnn_exp_4[:, 4] +
|
||||||
|
cnn_exp_5[:, 4]
|
||||||
|
)
|
||||||
|
cnn_all_mean_acc =
|
||||||
|
(1 / 5) * (
|
||||||
|
cnn_exp_1[:, 3] +
|
||||||
|
cnn_exp_2[:, 3] +
|
||||||
|
cnn_exp_3[:, 3] +
|
||||||
|
cnn_exp_4[:, 3] +
|
||||||
|
cnn_exp_5[:, 3]
|
||||||
|
)
|
||||||
|
cnn_all_mean_pre =
|
||||||
|
(1 / 5) * (
|
||||||
|
cnn_exp_1[:, 5] +
|
||||||
|
cnn_exp_2[:, 5] +
|
||||||
|
cnn_exp_3[:, 5] +
|
||||||
|
cnn_exp_4[:, 5] +
|
||||||
|
cnn_exp_5[:, 5]
|
||||||
|
)
|
||||||
|
|
||||||
|
f_exp_1_tls = cnn_exp_1[:, 2]
|
||||||
|
f_exp_1_acc = cnn_exp_1[:, 3]
|
||||||
|
f_exp_1_vls = cnn_exp_1[:, 4]
|
||||||
|
f_exp_1_pre = cnn_exp_1[:, 5]
|
||||||
|
println("Training accuracy freq 1 $(mean(f_exp_1_acc))")
|
||||||
|
println("Testing accuracy freq 1 $(mean(f_exp_1_pre))")
|
||||||
|
|
||||||
|
f_exp_2_tls = cnn_exp_2[:, 2]
|
||||||
|
f_exp_2_acc = cnn_exp_2[:, 3]
|
||||||
|
f_exp_2_vls = cnn_exp_2[:, 4]
|
||||||
|
f_exp_2_pre = cnn_exp_2[:, 5]
|
||||||
|
println("Training accuracy freq 2 $(mean(f_exp_2_acc))")
|
||||||
|
println("Testing accuracy freq 2 $(mean(f_exp_2_pre))")
|
||||||
|
|
||||||
|
f_exp_3_tls = cnn_exp_3[:, 2]
|
||||||
|
f_exp_3_acc = cnn_exp_3[:, 3]
|
||||||
|
f_exp_3_vls = cnn_exp_3[:, 4]
|
||||||
|
f_exp_3_pre = cnn_exp_3[:, 5]
|
||||||
|
println("Training accuracy freq 3 $(mean(f_exp_3_acc))")
|
||||||
|
println("Testing accuracy freq 3 $(mean(f_exp_3_pre))")
|
||||||
|
|
||||||
|
f_exp_4_tls = cnn_exp_4[:, 2]
|
||||||
|
f_exp_4_acc = cnn_exp_4[:, 3]
|
||||||
|
f_exp_4_vls = cnn_exp_4[:, 4]
|
||||||
|
f_exp_4_pre = cnn_exp_4[:, 5]
|
||||||
|
println("Training accuracy freq 4 $(mean(f_exp_4_acc))")
|
||||||
|
println("Testing accuracy freq 4 $(mean(f_exp_4_pre))")
|
||||||
|
|
||||||
|
f_exp_5_tls = cnn_exp_5[:, 2]
|
||||||
|
f_exp_5_acc = cnn_exp_5[:, 3]
|
||||||
|
f_exp_5_vls = cnn_exp_5[:, 4]
|
||||||
|
f_exp_5_pre = cnn_exp_5[:, 5]
|
||||||
|
println("Training accuracy freq 5 $(mean(f_exp_5_acc))")
|
||||||
|
println("Testing accuracy freq 5 $(mean(f_exp_5_pre))")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_acc,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_acc,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_acc,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_acc,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_acc,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_acc,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_acc,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_acc,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_acc,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_acc,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_100_tacc.png")
|
||||||
|
|
||||||
|
#=
|
||||||
|
en_plot = plot([
|
||||||
|
scatter(y=f_exp_1_pre, name="LeNet 1", marker=attr(color="rgb(211,120,000)")),
|
||||||
|
scatter(y=f_exp_2_pre, name="LeNet 2", marker=attr(color="rgb(255,170,017)")),
|
||||||
|
scatter(y=f_exp_3_pre, name="LeNet 3", marker=attr(color="rgb(255,187,034)")),
|
||||||
|
scatter(y=f_exp_4_pre, name="LeNet 4", marker=attr(color="rgb(255,204,051)")),
|
||||||
|
scatter(y=f_exp_5_pre, name="LeNet 5", marker=attr(color="rgb(255,221,068)")),
|
||||||
|
|
||||||
|
scatter(y=b_exp_1_pre, name="BCNN 1", marker=attr(color="rgb(055,033,240)")),
|
||||||
|
scatter(y=b_exp_2_pre, name="BCNN 2", marker=attr(color="rgb(033,081,240)")),
|
||||||
|
scatter(y=b_exp_3_pre, name="BCNN 3", marker=attr(color="rgb(033,115,240)")),
|
||||||
|
scatter(y=b_exp_4_pre, name="BCNN 4", marker=attr(color="rgb(151,177,255)")),
|
||||||
|
scatter(y=b_exp_5_pre, name="BCNN 5", marker=attr(color="rgb(051,215,255)"))
|
||||||
|
|
||||||
|
], Layout(mode="lines", opacity=0.4, xaxis_tickangle=-45, yaxis_title_text="Accuracy",
|
||||||
|
xaxis_title_text="Epoch", title="100 Epoch Experiment Testing Accuracy";yaxis_range=[0, 1] ))
|
||||||
|
savefig(en_plot,"mnist_100_tpre.png")
|
||||||
|
=#
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_pre,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_pre,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_pre,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_pre,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_pre,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_pre,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_pre,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_pre,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_pre,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_pre,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_100_tpre.png")
|
|
@ -0,0 +1,354 @@
|
||||||
|
using StatsBase: countmap
|
||||||
|
using PyCall
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function converttobyte(array)
|
||||||
|
temp = []
|
||||||
|
for l in array
|
||||||
|
if l[2] == "Mbyte"
|
||||||
|
append!(temp, parse(Float64, l[3]) * 1048576.0)
|
||||||
|
elseif l[2] == "Kbyte"
|
||||||
|
append!(temp, parse(Float64, l[3]) * 1024.0)
|
||||||
|
else
|
||||||
|
append!(temp, parse(Float64, l[3]))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
return temp
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function approx_δ(array)
|
||||||
|
temp = []
|
||||||
|
for i in 1:(length(array)-1)
|
||||||
|
push!(temp,array[i+1]-array[i])
|
||||||
|
end
|
||||||
|
return temp
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
py"""
|
||||||
|
import pickle
|
||||||
|
|
||||||
|
def load_pickle(fpath):
|
||||||
|
with open(fpath, "rb") as f:
|
||||||
|
data = pickle.load(f)
|
||||||
|
return data
|
||||||
|
"""
|
||||||
|
|
||||||
|
load_pickle = py"load_pickle"
|
||||||
|
|
||||||
|
py"""
|
||||||
|
import pickle
|
||||||
|
|
||||||
|
def save_pickle(pickle_name, data_dump):
|
||||||
|
with open(pickle_name, 'wb') as f:
|
||||||
|
pickle.dump(data_dump, f)
|
||||||
|
"""
|
||||||
|
|
||||||
|
save_pickle = py"save_pickle"
|
||||||
|
|
||||||
|
|
||||||
|
function movavg(X::Vector, numofele::Int)
|
||||||
|
Back = div(numofele, 2)
|
||||||
|
Forward = isodd(numofele) ? div(numofele, 2) : div(numofele, 2) - 1
|
||||||
|
len = length(X)
|
||||||
|
Y = similar(X)
|
||||||
|
for n = 1:len
|
||||||
|
lo = max(1, n - Back)
|
||||||
|
hi = min(len, n + Forward)
|
||||||
|
Y[n] = mean(X[lo:hi])
|
||||||
|
end
|
||||||
|
return Y
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function removewatt(X::Vector{String})
|
||||||
|
temp = match.(r"[0-9]+.[0-9]+|[0-9]+", X)
|
||||||
|
temp = [x.match for x in temp]
|
||||||
|
return parse.(Float64, temp)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function removewatt(X::SubString{String})
|
||||||
|
return parse.(Float64, match.(r"[0-9]+.[0-9]+|[0-9]+", X).match)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function removewatt(X::String)
|
||||||
|
return parse(Float64, match(r"[0-9]+.[0-9]+|[0-9]+", X).match)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function incwzeros(X::Vector, newsize::Int)
|
||||||
|
temp = X[:]
|
||||||
|
l = length(temp)
|
||||||
|
for i = 1:newsize
|
||||||
|
push!(temp, 28)
|
||||||
|
end
|
||||||
|
return temp
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function readcpudata(dat_fo, typ, dat_fl, exp)
|
||||||
|
folder = "$(typ)_$(dat_fo)_cpu_data_$(exp)/"
|
||||||
|
files_tmp = Dict()
|
||||||
|
for s = 1:5
|
||||||
|
file = "$(folder)$(typ)_$(s)_$(dat_fl)"
|
||||||
|
#println("File being loaded: $(file)")
|
||||||
|
io = open(file, "r")
|
||||||
|
t = read(io, String)
|
||||||
|
close(io)
|
||||||
|
files_tmp[s] = t
|
||||||
|
end
|
||||||
|
return files_tmp
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function getimes(file_name::String)
|
||||||
|
io = open(file_name, "r")
|
||||||
|
times_bayes = read(io, String)
|
||||||
|
close(io)
|
||||||
|
|
||||||
|
times_bayes = split(times_bayes, "\n")
|
||||||
|
times_bayes = [s for s in times_bayes if !all(isempty.(s))]
|
||||||
|
times_bayes = [split(r, "|") for r in times_bayes]
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in times_bayes
|
||||||
|
t = [strip(s) for s in vec if !all(isempty.(s))]
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
times_bayes = temp
|
||||||
|
|
||||||
|
times_bayes = [s for s in times_bayes if s[1] != "------"]
|
||||||
|
|
||||||
|
l = length(times_bayes)
|
||||||
|
|
||||||
|
times_bayes_mnist = times_bayes[1:(l÷2)]
|
||||||
|
popfirst!(times_bayes_mnist)
|
||||||
|
times_bayes_cifar = times_bayes[(l÷2)+1:end]
|
||||||
|
popfirst!(times_bayes_cifar)
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for (times, i) in zip(times_bayes_mnist, 1:length(times_bayes_mnist))
|
||||||
|
if i > 1
|
||||||
|
t = map(x -> Time(x), times[2:end])
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
times_bayes_mnist = temp
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for (times, i) in zip(times_bayes_cifar, 1:length(times_bayes_cifar))
|
||||||
|
if i > 1
|
||||||
|
t = map(x -> Time(x), times[2:end])
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
times_bayes_cifar = temp
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for (p, o) in zip(2:2:10, 1:2:10)
|
||||||
|
t = convert.(Dates.Second, times_bayes_mnist[p] .- times_bayes_mnist[o])
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
times_bayes_mnist = temp
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for (p, o) in zip(2:2:10, 1:2:10)
|
||||||
|
t = convert.(Dates.Second, times_bayes_cifar[p] .- times_bayes_cifar[o])
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
times_bayes_cifar = temp
|
||||||
|
|
||||||
|
if file_name == "times_frequentist"
|
||||||
|
typ = "Frequentist"
|
||||||
|
elseif file_name == "times_bayesian"
|
||||||
|
typ = "Bayesian"
|
||||||
|
end
|
||||||
|
|
||||||
|
to_file = Vector()
|
||||||
|
push!(to_file, "\nMNIST $(typ) Results: \n")
|
||||||
|
push!(to_file, " acc > 99 ES W Budget 100 Epochs \n")
|
||||||
|
for i = 1:5
|
||||||
|
push!(
|
||||||
|
to_file,
|
||||||
|
"size $(i): $(times_bayes_mnist[i][1]) $(times_bayes_mnist[i][2]) $(times_bayes_mnist[i][3]) $(times_bayes_mnist[i][4]) \n",
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
push!(to_file, "\nCIFAR $(typ) Results: \n")
|
||||||
|
push!(to_file, " acc > 99 ES W Budget 100 Epochs\n")
|
||||||
|
for i = 1:5
|
||||||
|
push!(
|
||||||
|
to_file,
|
||||||
|
"size $(i): $(times_bayes_cifar[i][1]) $(times_bayes_cifar[i][2]) $(times_bayes_cifar[i][3]) $(times_bayes_cifar[i][4]) \n",
|
||||||
|
)
|
||||||
|
end
|
||||||
|
return to_file
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function getcpuwatt(watt_vector)
|
||||||
|
test = watt_vector
|
||||||
|
test = split(test, "\n")
|
||||||
|
test = [s for s in test if !all(isempty.(s))]
|
||||||
|
test = [split(r, " ") for r in test]
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in test
|
||||||
|
if occursin(r"\d\d:\d\d:\d\d", vec[1])
|
||||||
|
push!(temp, vec)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
test = temp
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in test
|
||||||
|
t = [strip(s) for s in vec if !all(isempty.(s))]
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
test = temp
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in test
|
||||||
|
push!(temp, vec[end])
|
||||||
|
end
|
||||||
|
test = temp
|
||||||
|
test = map(x -> parse(Float32, x), test)
|
||||||
|
return test
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function getramuse(ram_vector)
|
||||||
|
test = ram_vector
|
||||||
|
test = split(test, "\n")
|
||||||
|
test = [s for s in test if !all(isempty.(s))]
|
||||||
|
test = [split(r, " ") for r in test]
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in test
|
||||||
|
t = [strip(s) for s in vec if !all(isempty.(s))]
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
test = temp
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in test
|
||||||
|
if vec[1] == "Mem:"
|
||||||
|
push!(temp, vec)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
test = temp
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
regex = r"[^0-9]+$"
|
||||||
|
for vec in test
|
||||||
|
unit = match(regex, vec[3]).match
|
||||||
|
qty = removewatt(vec[3])
|
||||||
|
push!(temp, (qty, unit))
|
||||||
|
end
|
||||||
|
test = temp
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for u in test
|
||||||
|
if u[2] == "Gi"
|
||||||
|
push!(temp, u[1] * 1024.0)
|
||||||
|
elseif u[2] == "Mi"
|
||||||
|
println(u[1])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
test = temp
|
||||||
|
return test
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function concat(arr::Vector)
|
||||||
|
temp = ""
|
||||||
|
for s in arr
|
||||||
|
temp = temp * s
|
||||||
|
end
|
||||||
|
return temp
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function getgpudata(folder, model, type, save = "d")
|
||||||
|
temp = Dict()
|
||||||
|
for s = 1:5
|
||||||
|
if type == "watt"
|
||||||
|
path = "$(folder)$(model)_$(type)data_$(s).pkl"
|
||||||
|
watt_data = removewatt(load_pickle(path)[:, 1])
|
||||||
|
mem_data = removewatt(load_pickle(path)[:, 2])
|
||||||
|
if save == "d"
|
||||||
|
temp[s] = Dict("Ene" => watt_data, "Mem" => mem_data)
|
||||||
|
elseif save == "eo"
|
||||||
|
temp[s] = Dict("Ene" => watt_data, "Mem" => nothing)
|
||||||
|
elseif save == "mo"
|
||||||
|
temp[s] = Dict("Ene" => nothing, "Mem" => mem_data)
|
||||||
|
end
|
||||||
|
elseif type == "exp"
|
||||||
|
path = "$(folder)$(model)_$(type)_data_$(s).pkl"
|
||||||
|
temp[s] = load_pickle(path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return temp
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function getuniquevalues(vector::Vector)::Tuple
|
||||||
|
dict = countmap(vector)
|
||||||
|
uniq = unique(vector)
|
||||||
|
vals = Vector()
|
||||||
|
for u in uniq
|
||||||
|
push!(vals, dict[u])
|
||||||
|
end
|
||||||
|
return (uniq, vals)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function expdatatodict(matrix::Matrix{Real})::Dict
|
||||||
|
return Dict(
|
||||||
|
"tloss" => matrix[:, 2],
|
||||||
|
"acc" => matrix[:, 3],
|
||||||
|
"vloss" => matrix[:, 4],
|
||||||
|
"pre" => matrix[:, 5],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
@views function makechunks(X::AbstractVector, n::Integer)
|
||||||
|
c = length(X) ÷ n
|
||||||
|
return [X[1+c*k:(k == n-1 ? end : c*k+c)] for k = 0:n-1]
|
||||||
|
end
|
||||||
|
|
||||||
|
function resize1(vect)
|
||||||
|
temp = []
|
||||||
|
size = length(vect[end])
|
||||||
|
for v in vect
|
||||||
|
temp_size = length(v)
|
||||||
|
if temp_size == size
|
||||||
|
push!(temp, Array(v))
|
||||||
|
elseif temp_size < size
|
||||||
|
app = zeros(size - temp_size)
|
||||||
|
x = Array(deepcopy(v))
|
||||||
|
new = vcat(x,app)
|
||||||
|
push!(temp, new)
|
||||||
|
elseif temp_size > size
|
||||||
|
resize!(Array(v),size)
|
||||||
|
push!(temp, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return temp
|
||||||
|
end
|
||||||
|
|
||||||
|
function join_vectors(vect)
|
||||||
|
result = []
|
||||||
|
temp = []
|
||||||
|
for v in vect
|
||||||
|
temp = vcat(temp,v)
|
||||||
|
push!(result,temp)
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
|
@ -0,0 +1,238 @@
|
||||||
|
####################################################
|
||||||
|
#
|
||||||
|
# Accuracy is bounded
|
||||||
|
#
|
||||||
|
#####################################################
|
||||||
|
include("aux_func.jl")
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
using Statistics
|
||||||
|
|
||||||
|
folder = "data_bounded/"
|
||||||
|
|
||||||
|
bayes_exp_1 = load_pickle("$(folder)bayes_exp_data_1.pkl");
|
||||||
|
bayes_exp_2 = load_pickle("$(folder)bayes_exp_data_2.pkl");
|
||||||
|
bayes_exp_3 = load_pickle("$(folder)bayes_exp_data_3.pkl");
|
||||||
|
bayes_exp_4 = load_pickle("$(folder)bayes_exp_data_4.pkl");
|
||||||
|
bayes_exp_5 = load_pickle("$(folder)bayes_exp_data_5.pkl");
|
||||||
|
|
||||||
|
b_exp_1_tls = bayes_exp_1[:, 2]
|
||||||
|
b_exp_1_acc = bayes_exp_1[:, 3]
|
||||||
|
b_exp_1_vls = bayes_exp_1[:, 4]
|
||||||
|
b_exp_1_pre = bayes_exp_1[:, 5]
|
||||||
|
println("Training accuracy bayes 1 $(mean(b_exp_1_acc))")
|
||||||
|
println("Testing accuracy bayes 1 $(mean(b_exp_1_pre))")
|
||||||
|
|
||||||
|
b_exp_2_tls = bayes_exp_2[:, 2]
|
||||||
|
b_exp_2_acc = bayes_exp_2[:, 3]
|
||||||
|
b_exp_2_vls = bayes_exp_2[:, 4]
|
||||||
|
b_exp_2_pre = bayes_exp_2[:, 5]
|
||||||
|
println("Training accuracy bayes 2 $(mean(b_exp_2_acc))")
|
||||||
|
println("Testing accuracy bayes 2 $(mean(b_exp_2_pre))")
|
||||||
|
|
||||||
|
b_exp_3_tls = bayes_exp_3[:, 2]
|
||||||
|
b_exp_3_acc = bayes_exp_3[:, 3]
|
||||||
|
b_exp_3_vls = bayes_exp_3[:, 4]
|
||||||
|
b_exp_3_pre = bayes_exp_3[:, 5]
|
||||||
|
println("Training accuracy bayes 3 $(mean(b_exp_3_acc))")
|
||||||
|
println("Testing accuracy bayes 3 $(mean(b_exp_3_pre))")
|
||||||
|
|
||||||
|
b_exp_4_tls = bayes_exp_4[:, 2]
|
||||||
|
b_exp_4_acc = bayes_exp_4[:, 3]
|
||||||
|
b_exp_4_vls = bayes_exp_4[:, 4]
|
||||||
|
b_exp_4_pre = bayes_exp_4[:, 5]
|
||||||
|
println("Training accuracy bayes 4 $(mean(b_exp_4_acc))")
|
||||||
|
println("Testing accuracy bayes 4 $(mean(b_exp_4_pre))")
|
||||||
|
|
||||||
|
b_exp_5_tls = bayes_exp_5[:, 2]
|
||||||
|
b_exp_5_acc = bayes_exp_5[:, 3]
|
||||||
|
b_exp_5_vls = bayes_exp_5[:, 4]
|
||||||
|
b_exp_5_pre = bayes_exp_5[:, 5]
|
||||||
|
println("Training accuracy bayes 5 $(mean(b_exp_5_acc))")
|
||||||
|
println("Testing accuracy bayes 5 $(mean(b_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound Bayesian 1x: $(size(bayes_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 2x: $(size(bayes_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 3x: $(size(bayes_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 4x: $(size(bayes_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 5x: $(size(bayes_exp_5)[1])")
|
||||||
|
|
||||||
|
freq_exp_1 = load_pickle("$(folder)freq_exp_data_1.pkl");
|
||||||
|
freq_exp_2 = load_pickle("$(folder)freq_exp_data_2.pkl");
|
||||||
|
freq_exp_3 = load_pickle("$(folder)freq_exp_data_3.pkl");
|
||||||
|
freq_exp_4 = load_pickle("$(folder)freq_exp_data_4.pkl");
|
||||||
|
freq_exp_5 = load_pickle("$(folder)freq_exp_data_5.pkl");
|
||||||
|
|
||||||
|
f_exp_1_tls = freq_exp_1[:, 2]
|
||||||
|
f_exp_1_acc = freq_exp_1[:, 3]
|
||||||
|
f_exp_1_vls = freq_exp_1[:, 4]
|
||||||
|
f_exp_1_pre = freq_exp_1[:, 5]
|
||||||
|
println("Training accuracy freq 1 $(mean(f_exp_1_acc))")
|
||||||
|
println("Testing accuracy freq 1 $(mean(f_exp_1_pre))")
|
||||||
|
|
||||||
|
f_exp_2_tls = freq_exp_2[:, 2]
|
||||||
|
f_exp_2_acc = freq_exp_2[:, 3]
|
||||||
|
f_exp_2_vls = freq_exp_2[:, 4]
|
||||||
|
f_exp_2_pre = freq_exp_2[:, 5]
|
||||||
|
println("Training accuracy freq 2 $(mean(f_exp_2_acc))")
|
||||||
|
println("Testing accuracy freq 2 $(mean(f_exp_2_pre))")
|
||||||
|
|
||||||
|
f_exp_3_tls = freq_exp_3[:, 2]
|
||||||
|
f_exp_3_acc = freq_exp_3[:, 3]
|
||||||
|
f_exp_3_vls = freq_exp_3[:, 4]
|
||||||
|
f_exp_3_pre = freq_exp_3[:, 5]
|
||||||
|
println("Training accuracy freq 3 $(mean(f_exp_3_acc))")
|
||||||
|
println("Testing accuracy freq 3 $(mean(f_exp_3_pre))")
|
||||||
|
|
||||||
|
f_exp_4_tls = freq_exp_4[:, 2]
|
||||||
|
f_exp_4_acc = freq_exp_4[:, 3]
|
||||||
|
f_exp_4_vls = freq_exp_4[:, 4]
|
||||||
|
f_exp_4_pre = freq_exp_4[:, 5]
|
||||||
|
println("Training accuracy freq 4 $(mean(f_exp_4_acc))")
|
||||||
|
println("Testing accuracy freq 4 $(mean(f_exp_4_pre))")
|
||||||
|
|
||||||
|
f_exp_5_tls = freq_exp_5[:, 2]
|
||||||
|
f_exp_5_acc = freq_exp_5[:, 3]
|
||||||
|
f_exp_5_vls = freq_exp_5[:, 4]
|
||||||
|
f_exp_5_pre = freq_exp_5[:, 5]
|
||||||
|
println("Training accuracy freq 5 $(mean(f_exp_5_acc))")
|
||||||
|
println("Testing accuracy freq 5 $(mean(f_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound LeNet 1x: $(size(freq_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 2x: $(size(freq_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 3x: $(size(freq_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 4x: $(size(freq_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 5x: $(size(freq_exp_5)[1])")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_acc,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_acc,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_acc,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_acc,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_acc,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_acc,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_acc,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_acc,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_acc,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_acc,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_ab_tacc.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_pre,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_pre,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_pre,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_pre,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_pre,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_pre,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_pre,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_pre,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_pre,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_pre,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_ab_tpre.png")
|
|
@ -0,0 +1,236 @@
|
||||||
|
####################################################
|
||||||
|
#
|
||||||
|
# Energy is bounded
|
||||||
|
#
|
||||||
|
#####################################################
|
||||||
|
include("aux_func.jl")
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
|
||||||
|
folder = "data_budget/"
|
||||||
|
|
||||||
|
|
||||||
|
bayes_exp_1 = load_pickle("$(folder)bayes_exp_data_1.pkl");
|
||||||
|
bayes_exp_2 = load_pickle("$(folder)bayes_exp_data_2.pkl");
|
||||||
|
bayes_exp_3 = load_pickle("$(folder)bayes_exp_data_3.pkl");
|
||||||
|
bayes_exp_4 = load_pickle("$(folder)bayes_exp_data_4.pkl");
|
||||||
|
bayes_exp_5 = load_pickle("$(folder)bayes_exp_data_5.pkl");
|
||||||
|
|
||||||
|
b_exp_1_tls = bayes_exp_1[:, 2]
|
||||||
|
b_exp_1_acc = bayes_exp_1[:, 3]
|
||||||
|
b_exp_1_vls = bayes_exp_1[:, 4]
|
||||||
|
b_exp_1_pre = bayes_exp_1[:, 5]
|
||||||
|
println("Training accuracy bayes 1 $(mean(b_exp_1_acc))")
|
||||||
|
println("Testing accuracy bayes 1 $(mean(b_exp_1_pre))")
|
||||||
|
|
||||||
|
b_exp_2_tls = bayes_exp_2[:, 2]
|
||||||
|
b_exp_2_acc = bayes_exp_2[:, 3]
|
||||||
|
b_exp_2_vls = bayes_exp_2[:, 4]
|
||||||
|
b_exp_2_pre = bayes_exp_2[:, 5]
|
||||||
|
println("Training accuracy bayes 2 $(mean(b_exp_2_acc))")
|
||||||
|
println("Testing accuracy bayes 2 $(mean(b_exp_2_pre))")
|
||||||
|
|
||||||
|
b_exp_3_tls = bayes_exp_3[:, 2]
|
||||||
|
b_exp_3_acc = bayes_exp_3[:, 3]
|
||||||
|
b_exp_3_vls = bayes_exp_3[:, 4]
|
||||||
|
b_exp_3_pre = bayes_exp_3[:, 5]
|
||||||
|
println("Training accuracy bayes 3 $(mean(b_exp_3_acc))")
|
||||||
|
println("Testing accuracy bayes 3 $(mean(b_exp_3_pre))")
|
||||||
|
|
||||||
|
b_exp_4_tls = bayes_exp_4[:, 2]
|
||||||
|
b_exp_4_acc = bayes_exp_4[:, 3]
|
||||||
|
b_exp_4_vls = bayes_exp_4[:, 4]
|
||||||
|
b_exp_4_pre = bayes_exp_4[:, 5]
|
||||||
|
println("Training accuracy bayes 4 $(mean(b_exp_4_acc))")
|
||||||
|
println("Testing accuracy bayes 4 $(mean(b_exp_4_pre))")
|
||||||
|
|
||||||
|
b_exp_5_tls = bayes_exp_5[:, 2]
|
||||||
|
b_exp_5_acc = bayes_exp_5[:, 3]
|
||||||
|
b_exp_5_vls = bayes_exp_5[:, 4]
|
||||||
|
b_exp_5_pre = bayes_exp_5[:, 5]
|
||||||
|
println("Training accuracy bayes 5 $(mean(b_exp_5_acc))")
|
||||||
|
println("Testing accuracy bayes 5 $(mean(b_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound Bayesian 1x: $(size(bayes_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 2x: $(size(bayes_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 3x: $(size(bayes_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 4x: $(size(bayes_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 5x: $(size(bayes_exp_5)[1])")
|
||||||
|
|
||||||
|
freq_exp_1 = load_pickle("$(folder)freq_exp_data_1.pkl");
|
||||||
|
freq_exp_2 = load_pickle("$(folder)freq_exp_data_2.pkl");
|
||||||
|
freq_exp_3 = load_pickle("$(folder)freq_exp_data_3.pkl");
|
||||||
|
freq_exp_4 = load_pickle("$(folder)freq_exp_data_4.pkl");
|
||||||
|
freq_exp_5 = load_pickle("$(folder)freq_exp_data_5.pkl");
|
||||||
|
|
||||||
|
f_exp_1_tls = freq_exp_1[:, 2]
|
||||||
|
f_exp_1_acc = freq_exp_1[:, 3]
|
||||||
|
f_exp_1_vls = freq_exp_1[:, 4]
|
||||||
|
f_exp_1_pre = freq_exp_1[:, 5]
|
||||||
|
println("Training accuracy freq 1 $(mean(f_exp_1_acc))")
|
||||||
|
println("Testing accuracy freq 1 $(mean(f_exp_1_pre))")
|
||||||
|
|
||||||
|
f_exp_2_tls = freq_exp_2[:, 2]
|
||||||
|
f_exp_2_acc = freq_exp_2[:, 3]
|
||||||
|
f_exp_2_vls = freq_exp_2[:, 4]
|
||||||
|
f_exp_2_pre = freq_exp_2[:, 5]
|
||||||
|
println("Training accuracy freq 2 $(mean(f_exp_2_acc))")
|
||||||
|
println("Testing accuracy freq 2 $(mean(f_exp_2_pre))")
|
||||||
|
|
||||||
|
f_exp_3_tls = freq_exp_3[:, 2]
|
||||||
|
f_exp_3_acc = freq_exp_3[:, 3]
|
||||||
|
f_exp_3_vls = freq_exp_3[:, 4]
|
||||||
|
f_exp_3_pre = freq_exp_3[:, 5]
|
||||||
|
println("Training accuracy freq 3 $(mean(f_exp_3_acc))")
|
||||||
|
println("Testing accuracy freq 3 $(mean(f_exp_3_pre))")
|
||||||
|
|
||||||
|
f_exp_4_tls = freq_exp_4[:, 2]
|
||||||
|
f_exp_4_acc = freq_exp_4[:, 3]
|
||||||
|
f_exp_4_vls = freq_exp_4[:, 4]
|
||||||
|
f_exp_4_pre = freq_exp_4[:, 5]
|
||||||
|
println("Training accuracy freq 4 $(mean(f_exp_4_acc))")
|
||||||
|
println("Testing accuracy freq 4 $(mean(f_exp_4_pre))")
|
||||||
|
|
||||||
|
f_exp_5_tls = freq_exp_5[:, 2]
|
||||||
|
f_exp_5_acc = freq_exp_5[:, 3]
|
||||||
|
f_exp_5_vls = freq_exp_5[:, 4]
|
||||||
|
f_exp_5_pre = freq_exp_5[:, 5]
|
||||||
|
println("Training accuracy freq 5 $(mean(f_exp_5_acc))")
|
||||||
|
println("Testing accuracy freq 5 $(mean(f_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound LeNet 1x: $(size(freq_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 2x: $(size(freq_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 3x: $(size(freq_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 4x: $(size(freq_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 5x: $(size(freq_exp_5)[1])")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_acc,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_acc,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_acc,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_acc,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_acc,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_acc,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_acc,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_acc,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_acc,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_acc,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_eb_tacc.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_pre,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_pre,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_pre,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_pre,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_pre,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_pre,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_pre,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_pre,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_pre,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_pre,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_eb_tpre.png")
|
|
@ -0,0 +1,293 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
|
||||||
|
folder = "CIFAR_100_epoch/"
|
||||||
|
|
||||||
|
bayes_exp_1 = load_pickle("$(folder)bayes_exp_data_1.pkl")
|
||||||
|
bayes_exp_2 = load_pickle("$(folder)bayes_exp_data_2.pkl")
|
||||||
|
bayes_exp_3 = load_pickle("$(folder)bayes_exp_data_3.pkl")
|
||||||
|
bayes_exp_4 = load_pickle("$(folder)bayes_exp_data_4.pkl")
|
||||||
|
bayes_exp_5 = load_pickle("$(folder)bayes_exp_data_5.pkl")
|
||||||
|
|
||||||
|
bayes_all_mean_tloss =
|
||||||
|
(1 / 5) * (
|
||||||
|
bayes_exp_1[:, 2] +
|
||||||
|
bayes_exp_2[:, 2] +
|
||||||
|
bayes_exp_3[:, 2] +
|
||||||
|
bayes_exp_4[:, 2] +
|
||||||
|
bayes_exp_5[:, 2]
|
||||||
|
)
|
||||||
|
|
||||||
|
bayes_all_mean_iloss =
|
||||||
|
(1 / 5) * (
|
||||||
|
bayes_exp_1[:, 4] +
|
||||||
|
bayes_exp_2[:, 4] +
|
||||||
|
bayes_exp_3[:, 4] +
|
||||||
|
bayes_exp_4[:, 4] +
|
||||||
|
bayes_exp_5[:, 4]
|
||||||
|
)
|
||||||
|
|
||||||
|
bayes_all_mean_acc =
|
||||||
|
(1 / 5) * (
|
||||||
|
bayes_exp_1[:, 3] +
|
||||||
|
bayes_exp_2[:, 3] +
|
||||||
|
bayes_exp_3[:, 3] +
|
||||||
|
bayes_exp_4[:, 3] +
|
||||||
|
bayes_exp_5[:, 3]
|
||||||
|
)
|
||||||
|
|
||||||
|
bayes_all_mean_pre =
|
||||||
|
(1 / 5) * (
|
||||||
|
bayes_exp_1[:, 5] +
|
||||||
|
bayes_exp_2[:, 5] +
|
||||||
|
bayes_exp_3[:, 5] +
|
||||||
|
bayes_exp_4[:, 5] +
|
||||||
|
bayes_exp_5[:, 5]
|
||||||
|
)
|
||||||
|
|
||||||
|
b_exp_1_tls = bayes_exp_1[:, 2]
|
||||||
|
b_exp_1_acc = bayes_exp_1[:, 3]
|
||||||
|
b_exp_1_vls = bayes_exp_1[:, 4]
|
||||||
|
b_exp_1_pre = bayes_exp_1[:, 5]
|
||||||
|
println("Training accuracy bayes 1 $(mean(b_exp_1_acc))")
|
||||||
|
println("Testing accuracy bayes 1 $(mean(b_exp_1_pre))")
|
||||||
|
|
||||||
|
b_exp_2_tls = bayes_exp_2[:, 2]
|
||||||
|
b_exp_2_acc = bayes_exp_2[:, 3]
|
||||||
|
b_exp_2_vls = bayes_exp_2[:, 4]
|
||||||
|
b_exp_2_pre = bayes_exp_2[:, 5]
|
||||||
|
println("Training accuracy bayes 2 $(mean(b_exp_2_acc))")
|
||||||
|
println("Testing accuracy bayes 2 $(mean(b_exp_2_pre))")
|
||||||
|
|
||||||
|
b_exp_3_tls = bayes_exp_3[:, 2]
|
||||||
|
b_exp_3_acc = bayes_exp_3[:, 3]
|
||||||
|
b_exp_3_vls = bayes_exp_3[:, 4]
|
||||||
|
b_exp_3_pre = bayes_exp_3[:, 5]
|
||||||
|
println("Training accuracy bayes 3 $(mean(b_exp_3_acc))")
|
||||||
|
println("Testing accuracy bayes 3 $(mean(b_exp_3_pre))")
|
||||||
|
|
||||||
|
b_exp_4_tls = bayes_exp_4[:, 2]
|
||||||
|
b_exp_4_acc = bayes_exp_4[:, 3]
|
||||||
|
b_exp_4_vls = bayes_exp_4[:, 4]
|
||||||
|
b_exp_4_pre = bayes_exp_4[:, 5]
|
||||||
|
println("Training accuracy bayes 4 $(mean(b_exp_4_acc))")
|
||||||
|
println("Testing accuracy bayes 4 $(mean(b_exp_4_pre))")
|
||||||
|
|
||||||
|
b_exp_5_tls = bayes_exp_5[:, 2]
|
||||||
|
b_exp_5_acc = bayes_exp_5[:, 3]
|
||||||
|
b_exp_5_vls = bayes_exp_5[:, 4]
|
||||||
|
b_exp_5_pre = bayes_exp_5[:, 5]
|
||||||
|
println("Training accuracy bayes 5 $(mean(b_exp_5_acc))")
|
||||||
|
println("Testing accuracy bayes 5 $(mean(b_exp_5_pre))")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cnn_exp_1 = load_pickle("$(folder)freq_exp_data_1.pkl")
|
||||||
|
cnn_exp_2 = load_pickle("$(folder)freq_exp_data_2.pkl")
|
||||||
|
cnn_exp_3 = load_pickle("$(folder)freq_exp_data_3.pkl")
|
||||||
|
cnn_exp_4 = load_pickle("$(folder)freq_exp_data_4.pkl")
|
||||||
|
cnn_exp_5 = load_pickle("$(folder)freq_exp_data_5.pkl")
|
||||||
|
|
||||||
|
cnn_all_mean_tloss =
|
||||||
|
(1 / 5) * (
|
||||||
|
cnn_exp_1[:, 2] +
|
||||||
|
cnn_exp_2[:, 2] +
|
||||||
|
cnn_exp_3[:, 2] +
|
||||||
|
cnn_exp_4[:, 2] +
|
||||||
|
cnn_exp_5[:, 2]
|
||||||
|
)
|
||||||
|
|
||||||
|
cnn_all_mean_iloss =
|
||||||
|
(1 / 5) * (
|
||||||
|
cnn_exp_1[:, 4] +
|
||||||
|
cnn_exp_2[:, 4] +
|
||||||
|
cnn_exp_3[:, 4] +
|
||||||
|
cnn_exp_4[:, 4] +
|
||||||
|
cnn_exp_5[:, 4]
|
||||||
|
)
|
||||||
|
|
||||||
|
cnn_all_mean_acc =
|
||||||
|
(1 / 5) * (
|
||||||
|
cnn_exp_1[:, 3] +
|
||||||
|
cnn_exp_2[:, 3] +
|
||||||
|
cnn_exp_3[:, 3] +
|
||||||
|
cnn_exp_4[:, 3] +
|
||||||
|
cnn_exp_5[:, 3]
|
||||||
|
)
|
||||||
|
|
||||||
|
cnn_all_mean_pre =
|
||||||
|
(1 / 5) * (
|
||||||
|
cnn_exp_1[:, 5] +
|
||||||
|
cnn_exp_2[:, 5] +
|
||||||
|
cnn_exp_3[:, 5] +
|
||||||
|
cnn_exp_4[:, 5] +
|
||||||
|
cnn_exp_5[:, 5]
|
||||||
|
)
|
||||||
|
|
||||||
|
f_exp_1_tls = cnn_exp_1[:, 2]
|
||||||
|
f_exp_1_acc = cnn_exp_1[:, 3]
|
||||||
|
f_exp_1_vls = cnn_exp_1[:, 4]
|
||||||
|
f_exp_1_pre = cnn_exp_1[:, 5]
|
||||||
|
println("Training accuracy freq 1 $(mean(f_exp_1_acc))")
|
||||||
|
println("Testing accuracy freq 1 $(mean(f_exp_1_pre))")
|
||||||
|
|
||||||
|
f_exp_2_tls = cnn_exp_2[:, 2]
|
||||||
|
f_exp_2_acc = cnn_exp_2[:, 3]
|
||||||
|
f_exp_2_vls = cnn_exp_2[:, 4]
|
||||||
|
f_exp_2_pre = cnn_exp_2[:, 5]
|
||||||
|
println("Training accuracy freq 2 $(mean(f_exp_2_acc))")
|
||||||
|
println("Testing accuracy freq 2 $(mean(f_exp_2_pre))")
|
||||||
|
|
||||||
|
f_exp_3_tls = cnn_exp_3[:, 2]
|
||||||
|
f_exp_3_acc = cnn_exp_3[:, 3]
|
||||||
|
f_exp_3_vls = cnn_exp_3[:, 4]
|
||||||
|
f_exp_3_pre = cnn_exp_3[:, 5]
|
||||||
|
println("Training accuracy freq 3 $(mean(f_exp_3_acc))")
|
||||||
|
println("Testing accuracy freq 3 $(mean(f_exp_3_pre))")
|
||||||
|
|
||||||
|
f_exp_4_tls = cnn_exp_4[:, 2]
|
||||||
|
f_exp_4_acc = cnn_exp_4[:, 3]
|
||||||
|
f_exp_4_vls = cnn_exp_4[:, 4]
|
||||||
|
f_exp_4_pre = cnn_exp_4[:, 5]
|
||||||
|
println("Training accuracy freq 4 $(mean(f_exp_4_acc))")
|
||||||
|
println("Testing accuracy freq 4 $(mean(f_exp_4_pre))")
|
||||||
|
|
||||||
|
f_exp_5_tls = cnn_exp_5[:, 2]
|
||||||
|
f_exp_5_acc = cnn_exp_5[:, 3]
|
||||||
|
f_exp_5_vls = cnn_exp_5[:, 4]
|
||||||
|
f_exp_5_pre = cnn_exp_5[:, 5]
|
||||||
|
println("Training accuracy freq 5 $(mean(f_exp_5_acc))")
|
||||||
|
println("Testing accuracy freq 5 $(mean(f_exp_5_pre))")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_acc,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_acc,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_acc,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_acc,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_acc,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_acc,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_acc,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_acc,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_acc,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_acc,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_100_tacc.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_pre,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_pre,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_pre,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_pre,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_pre,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_pre,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_pre,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_pre,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_pre,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_pre,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_100_tpre.png")
|
|
@ -0,0 +1,236 @@
|
||||||
|
####################################################
|
||||||
|
#
|
||||||
|
# Accuracy is bounded
|
||||||
|
#
|
||||||
|
#####################################################
|
||||||
|
include("aux_func.jl")
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
|
||||||
|
folder = "CIFAR_acc_bound/"
|
||||||
|
|
||||||
|
bayes_exp_1 = load_pickle("$(folder)bayes_exp_data_1.pkl");
|
||||||
|
bayes_exp_2 = load_pickle("$(folder)bayes_exp_data_2.pkl");
|
||||||
|
bayes_exp_3 = load_pickle("$(folder)bayes_exp_data_3.pkl");
|
||||||
|
bayes_exp_4 = load_pickle("$(folder)bayes_exp_data_4.pkl");
|
||||||
|
bayes_exp_5 = load_pickle("$(folder)bayes_exp_data_5.pkl");
|
||||||
|
|
||||||
|
b_exp_1_tls = bayes_exp_1[:, 2]
|
||||||
|
b_exp_1_acc = bayes_exp_1[:, 3]
|
||||||
|
b_exp_1_vls = bayes_exp_1[:, 4]
|
||||||
|
b_exp_1_pre = bayes_exp_1[:, 5]
|
||||||
|
println("Training accuracy bayes 1 $(mean(b_exp_1_acc))")
|
||||||
|
println("Testing accuracy bayes 1 $(mean(b_exp_1_pre))")
|
||||||
|
|
||||||
|
b_exp_2_tls = bayes_exp_2[:, 2]
|
||||||
|
b_exp_2_acc = bayes_exp_2[:, 3]
|
||||||
|
b_exp_2_vls = bayes_exp_2[:, 4]
|
||||||
|
b_exp_2_pre = bayes_exp_2[:, 5]
|
||||||
|
println("Training accuracy bayes 2 $(mean(b_exp_2_acc))")
|
||||||
|
println("Testing accuracy bayes 2 $(mean(b_exp_2_pre))")
|
||||||
|
|
||||||
|
b_exp_3_tls = bayes_exp_3[:, 2]
|
||||||
|
b_exp_3_acc = bayes_exp_3[:, 3]
|
||||||
|
b_exp_3_vls = bayes_exp_3[:, 4]
|
||||||
|
b_exp_3_pre = bayes_exp_3[:, 5]
|
||||||
|
println("Training accuracy bayes 3 $(mean(b_exp_3_acc))")
|
||||||
|
println("Testing accuracy bayes 3 $(mean(b_exp_3_pre))")
|
||||||
|
|
||||||
|
b_exp_4_tls = bayes_exp_4[:, 2]
|
||||||
|
b_exp_4_acc = bayes_exp_4[:, 3]
|
||||||
|
b_exp_4_vls = bayes_exp_4[:, 4]
|
||||||
|
b_exp_4_pre = bayes_exp_4[:, 5]
|
||||||
|
println("Training accuracy bayes 4 $(mean(b_exp_4_acc))")
|
||||||
|
println("Testing accuracy bayes 4 $(mean(b_exp_4_pre))")
|
||||||
|
|
||||||
|
b_exp_5_tls = bayes_exp_5[:, 2]
|
||||||
|
b_exp_5_acc = bayes_exp_5[:, 3]
|
||||||
|
b_exp_5_vls = bayes_exp_5[:, 4]
|
||||||
|
b_exp_5_pre = bayes_exp_5[:, 5]
|
||||||
|
println("Training accuracy bayes 5 $(mean(b_exp_5_acc))")
|
||||||
|
println("Testing accuracy bayes 5 $(mean(b_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound Bayesian 1x: $(size(bayes_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 2x: $(size(bayes_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 3x: $(size(bayes_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 4x: $(size(bayes_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 5x: $(size(bayes_exp_5)[1])")
|
||||||
|
|
||||||
|
cnn_exp_1 = load_pickle("$(folder)freq_exp_data_1.pkl");
|
||||||
|
cnn_exp_2 = load_pickle("$(folder)freq_exp_data_2.pkl");
|
||||||
|
cnn_exp_3 = load_pickle("$(folder)freq_exp_data_3.pkl");
|
||||||
|
cnn_exp_4 = load_pickle("$(folder)freq_exp_data_4.pkl");
|
||||||
|
cnn_exp_5 = load_pickle("$(folder)freq_exp_data_5.pkl");
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound LeNet 1x: $(size(cnn_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 2x: $(size(cnn_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 3x: $(size(cnn_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 4x: $(size(cnn_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 5x: $(size(cnn_exp_5)[1])")
|
||||||
|
|
||||||
|
f_exp_1_tls = cnn_exp_1[:, 2]
|
||||||
|
f_exp_1_acc = cnn_exp_1[:, 3]
|
||||||
|
f_exp_1_vls = cnn_exp_1[:, 4]
|
||||||
|
f_exp_1_pre = cnn_exp_1[:, 5]
|
||||||
|
println("Training accuracy freq 1 $(mean(f_exp_1_acc))")
|
||||||
|
println("Testing accuracy freq 1 $(mean(f_exp_1_pre))")
|
||||||
|
|
||||||
|
f_exp_2_tls = cnn_exp_2[:, 2]
|
||||||
|
f_exp_2_acc = cnn_exp_2[:, 3]
|
||||||
|
f_exp_2_vls = cnn_exp_2[:, 4]
|
||||||
|
f_exp_2_pre = cnn_exp_2[:, 5]
|
||||||
|
println("Training accuracy freq 2 $(mean(f_exp_2_acc))")
|
||||||
|
println("Testing accuracy freq 2 $(mean(f_exp_2_pre))")
|
||||||
|
|
||||||
|
f_exp_3_tls = cnn_exp_3[:, 2]
|
||||||
|
f_exp_3_acc = cnn_exp_3[:, 3]
|
||||||
|
f_exp_3_vls = cnn_exp_3[:, 4]
|
||||||
|
f_exp_3_pre = cnn_exp_3[:, 5]
|
||||||
|
println("Training accuracy freq 3 $(mean(f_exp_3_acc))")
|
||||||
|
println("Testing accuracy freq 3 $(mean(f_exp_3_pre))")
|
||||||
|
|
||||||
|
f_exp_4_tls = cnn_exp_4[:, 2]
|
||||||
|
f_exp_4_acc = cnn_exp_4[:, 3]
|
||||||
|
f_exp_4_vls = cnn_exp_4[:, 4]
|
||||||
|
f_exp_4_pre = cnn_exp_4[:, 5]
|
||||||
|
println("Training accuracy freq 4 $(mean(f_exp_4_acc))")
|
||||||
|
println("Testing accuracy freq 4 $(mean(f_exp_4_pre))")
|
||||||
|
|
||||||
|
f_exp_5_tls = cnn_exp_5[:, 2]
|
||||||
|
f_exp_5_acc = cnn_exp_5[:, 3]
|
||||||
|
f_exp_5_vls = cnn_exp_5[:, 4]
|
||||||
|
f_exp_5_pre = cnn_exp_5[:, 5]
|
||||||
|
println("Training accuracy freq 5 $(mean(f_exp_5_acc))")
|
||||||
|
println("Testing accuracy freq 5 $(mean(f_exp_5_pre))")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_acc,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_acc,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_acc,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_acc,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_acc,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_acc,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_acc,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_acc,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_acc,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_acc,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_ab_tacc.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_pre,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_pre,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_pre,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_pre,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_pre,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_pre,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_pre,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_pre,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_pre,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_pre,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_ab_tpre.png")
|
|
@ -0,0 +1,235 @@
|
||||||
|
####################################################
|
||||||
|
#
|
||||||
|
# Energy is bounded
|
||||||
|
#
|
||||||
|
#####################################################
|
||||||
|
include("aux_func.jl")
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
|
||||||
|
folder = "CIFAR_energy_bound/"
|
||||||
|
|
||||||
|
bayes_exp_1 = load_pickle("$(folder)bayes_exp_data_1.pkl");
|
||||||
|
bayes_exp_2 = load_pickle("$(folder)bayes_exp_data_2.pkl");
|
||||||
|
bayes_exp_3 = load_pickle("$(folder)bayes_exp_data_3.pkl");
|
||||||
|
bayes_exp_4 = load_pickle("$(folder)bayes_exp_data_4.pkl");
|
||||||
|
bayes_exp_5 = load_pickle("$(folder)bayes_exp_data_5.pkl");
|
||||||
|
|
||||||
|
b_exp_1_tls = bayes_exp_1[:, 2]
|
||||||
|
b_exp_1_acc = bayes_exp_1[:, 3]
|
||||||
|
b_exp_1_vls = bayes_exp_1[:, 4]
|
||||||
|
b_exp_1_pre = bayes_exp_1[:, 5]
|
||||||
|
println("Training accuracy bayes 1 $(mean(b_exp_1_acc))")
|
||||||
|
println("Testing accuracy bayes 1 $(mean(b_exp_1_pre))")
|
||||||
|
|
||||||
|
b_exp_2_tls = bayes_exp_2[:, 2]
|
||||||
|
b_exp_2_acc = bayes_exp_2[:, 3]
|
||||||
|
b_exp_2_vls = bayes_exp_2[:, 4]
|
||||||
|
b_exp_2_pre = bayes_exp_2[:, 5]
|
||||||
|
println("Training accuracy bayes 2 $(mean(b_exp_2_acc))")
|
||||||
|
println("Testing accuracy bayes 2 $(mean(b_exp_2_pre))")
|
||||||
|
|
||||||
|
b_exp_3_tls = bayes_exp_3[:, 2]
|
||||||
|
b_exp_3_acc = bayes_exp_3[:, 3]
|
||||||
|
b_exp_3_vls = bayes_exp_3[:, 4]
|
||||||
|
b_exp_3_pre = bayes_exp_3[:, 5]
|
||||||
|
println("Training accuracy bayes 3 $(mean(b_exp_3_acc))")
|
||||||
|
println("Testing accuracy bayes 3 $(mean(b_exp_3_pre))")
|
||||||
|
|
||||||
|
b_exp_4_tls = bayes_exp_4[:, 2]
|
||||||
|
b_exp_4_acc = bayes_exp_4[:, 3]
|
||||||
|
b_exp_4_vls = bayes_exp_4[:, 4]
|
||||||
|
b_exp_4_pre = bayes_exp_4[:, 5]
|
||||||
|
println("Training accuracy bayes 4 $(mean(b_exp_4_acc))")
|
||||||
|
println("Testing accuracy bayes 4 $(mean(b_exp_4_pre))")
|
||||||
|
|
||||||
|
b_exp_5_tls = bayes_exp_5[:, 2]
|
||||||
|
b_exp_5_acc = bayes_exp_5[:, 3]
|
||||||
|
b_exp_5_vls = bayes_exp_5[:, 4]
|
||||||
|
b_exp_5_pre = bayes_exp_5[:, 5]
|
||||||
|
println("Training accuracy bayes 5 $(mean(b_exp_5_acc))")
|
||||||
|
println("Testing accuracy bayes 5 $(mean(b_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound Bayesian 1x: $(size(bayes_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 2x: $(size(bayes_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 3x: $(size(bayes_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 4x: $(size(bayes_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 5x: $(size(bayes_exp_5)[1])")
|
||||||
|
|
||||||
|
cnn_exp_1 = load_pickle("$(folder)freq_exp_data_1.pkl");
|
||||||
|
cnn_exp_2 = load_pickle("$(folder)freq_exp_data_2.pkl");
|
||||||
|
cnn_exp_3 = load_pickle("$(folder)freq_exp_data_3.pkl");
|
||||||
|
cnn_exp_4 = load_pickle("$(folder)freq_exp_data_4.pkl");
|
||||||
|
cnn_exp_5 = load_pickle("$(folder)freq_exp_data_5.pkl");
|
||||||
|
|
||||||
|
f_exp_1_tls = cnn_exp_1[:, 2]
|
||||||
|
f_exp_1_acc = cnn_exp_1[:, 3]
|
||||||
|
f_exp_1_vls = cnn_exp_1[:, 4]
|
||||||
|
f_exp_1_pre = cnn_exp_1[:, 5]
|
||||||
|
println("Training accuracy freq 1 $(mean(f_exp_1_acc))")
|
||||||
|
println("Testing accuracy freq 1 $(mean(f_exp_1_pre))")
|
||||||
|
|
||||||
|
f_exp_2_tls = cnn_exp_2[:, 2]
|
||||||
|
f_exp_2_acc = cnn_exp_2[:, 3]
|
||||||
|
f_exp_2_vls = cnn_exp_2[:, 4]
|
||||||
|
f_exp_2_pre = cnn_exp_2[:, 5]
|
||||||
|
println("Training accuracy freq 2 $(mean(f_exp_2_acc))")
|
||||||
|
println("Testing accuracy freq 2 $(mean(f_exp_2_pre))")
|
||||||
|
|
||||||
|
f_exp_3_tls = cnn_exp_3[:, 2]
|
||||||
|
f_exp_3_acc = cnn_exp_3[:, 3]
|
||||||
|
f_exp_3_vls = cnn_exp_3[:, 4]
|
||||||
|
f_exp_3_pre = cnn_exp_3[:, 5]
|
||||||
|
println("Training accuracy freq 3 $(mean(f_exp_3_acc))")
|
||||||
|
println("Testing accuracy freq 3 $(mean(f_exp_3_pre))")
|
||||||
|
|
||||||
|
f_exp_4_tls = cnn_exp_4[:, 2]
|
||||||
|
f_exp_4_acc = cnn_exp_4[:, 3]
|
||||||
|
f_exp_4_vls = cnn_exp_4[:, 4]
|
||||||
|
f_exp_4_pre = cnn_exp_4[:, 5]
|
||||||
|
println("Training accuracy freq 4 $(mean(f_exp_4_acc))")
|
||||||
|
println("Testing accuracy freq 4 $(mean(f_exp_4_pre))")
|
||||||
|
|
||||||
|
f_exp_5_tls = cnn_exp_5[:, 2]
|
||||||
|
f_exp_5_acc = cnn_exp_5[:, 3]
|
||||||
|
f_exp_5_vls = cnn_exp_5[:, 4]
|
||||||
|
f_exp_5_pre = cnn_exp_5[:, 5]
|
||||||
|
println("Training accuracy freq 5 $(mean(f_exp_5_acc))")
|
||||||
|
println("Testing accuracy freq 5 $(mean(f_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound LeNet 1x: $(size(cnn_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 2x: $(size(cnn_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 3x: $(size(cnn_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 4x: $(size(cnn_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 5x: $(size(cnn_exp_5)[1])")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_acc,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_acc,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_acc,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_acc,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_acc,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_acc,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_acc,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_acc,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_acc,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_acc,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_eb_tacc.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_pre,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_pre,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_pre,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_pre,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_pre,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_pre,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_pre,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_pre,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_pre,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_pre,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_eb_tpre.png")
|
|
@ -0,0 +1,230 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
|
||||||
|
folder = "CIFAR_early_stop/"
|
||||||
|
|
||||||
|
bayes_exp_1 = load_pickle("$(folder)bayes_exp_data_1.pkl")
|
||||||
|
bayes_exp_2 = load_pickle("$(folder)bayes_exp_data_2.pkl")
|
||||||
|
bayes_exp_3 = load_pickle("$(folder)bayes_exp_data_3.pkl")
|
||||||
|
bayes_exp_4 = load_pickle("$(folder)bayes_exp_data_4.pkl")
|
||||||
|
bayes_exp_5 = load_pickle("$(folder)bayes_exp_data_5.pkl")
|
||||||
|
|
||||||
|
b_exp_1_tls = bayes_exp_1[:, 2]
|
||||||
|
b_exp_1_acc = bayes_exp_1[:, 3]
|
||||||
|
b_exp_1_vls = bayes_exp_1[:, 4]
|
||||||
|
b_exp_1_pre = bayes_exp_1[:, 5]
|
||||||
|
println("Training accuracy bayes 1 $(mean(b_exp_1_acc))")
|
||||||
|
println("Testing accuracy bayes 1 $(mean(b_exp_1_pre))")
|
||||||
|
|
||||||
|
b_exp_2_tls = bayes_exp_2[:, 2]
|
||||||
|
b_exp_2_acc = bayes_exp_2[:, 3]
|
||||||
|
b_exp_2_vls = bayes_exp_2[:, 4]
|
||||||
|
b_exp_2_pre = bayes_exp_2[:, 5]
|
||||||
|
println("Training accuracy bayes 2 $(mean(b_exp_2_acc))")
|
||||||
|
println("Testing accuracy bayes 2 $(mean(b_exp_2_pre))")
|
||||||
|
|
||||||
|
b_exp_3_tls = bayes_exp_3[:, 2]
|
||||||
|
b_exp_3_acc = bayes_exp_3[:, 3]
|
||||||
|
b_exp_3_vls = bayes_exp_3[:, 4]
|
||||||
|
b_exp_3_pre = bayes_exp_3[:, 5]
|
||||||
|
println("Training accuracy bayes 3 $(mean(b_exp_3_acc))")
|
||||||
|
println("Testing accuracy bayes 3 $(mean(b_exp_3_pre))")
|
||||||
|
|
||||||
|
b_exp_4_tls = bayes_exp_4[:, 2]
|
||||||
|
b_exp_4_acc = bayes_exp_4[:, 3]
|
||||||
|
b_exp_4_vls = bayes_exp_4[:, 4]
|
||||||
|
b_exp_4_pre = bayes_exp_4[:, 5]
|
||||||
|
println("Training accuracy bayes 4 $(mean(b_exp_4_acc))")
|
||||||
|
println("Testing accuracy bayes 4 $(mean(b_exp_4_pre))")
|
||||||
|
|
||||||
|
b_exp_5_tls = bayes_exp_5[:, 2]
|
||||||
|
b_exp_5_acc = bayes_exp_5[:, 3]
|
||||||
|
b_exp_5_vls = bayes_exp_5[:, 4]
|
||||||
|
b_exp_5_pre = bayes_exp_5[:, 5]
|
||||||
|
println("Training accuracy bayes 5 $(mean(b_exp_5_acc))")
|
||||||
|
println("Testing accuracy bayes 5 $(mean(b_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound Bayesian 1x: $(size(bayes_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 2x: $(size(bayes_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 3x: $(size(bayes_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 4x: $(size(bayes_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 5x: $(size(bayes_exp_5)[1])")
|
||||||
|
|
||||||
|
|
||||||
|
cnn_exp_1 = load_pickle("$(folder)freq_exp_data_1.pkl")
|
||||||
|
cnn_exp_2 = load_pickle("$(folder)freq_exp_data_2.pkl")
|
||||||
|
cnn_exp_3 = load_pickle("$(folder)freq_exp_data_3.pkl")
|
||||||
|
cnn_exp_4 = load_pickle("$(folder)freq_exp_data_4.pkl")
|
||||||
|
cnn_exp_5 = load_pickle("$(folder)freq_exp_data_5.pkl")
|
||||||
|
|
||||||
|
f_exp_1_tls = cnn_exp_1[:, 2]
|
||||||
|
f_exp_1_acc = cnn_exp_1[:, 3]
|
||||||
|
f_exp_1_vls = cnn_exp_1[:, 4]
|
||||||
|
f_exp_1_pre = cnn_exp_1[:, 5]
|
||||||
|
println("Training accuracy freq 1 $(mean(f_exp_1_acc))")
|
||||||
|
println("Testing accuracy freq 1 $(mean(f_exp_1_pre))")
|
||||||
|
|
||||||
|
f_exp_2_tls = cnn_exp_2[:, 2]
|
||||||
|
f_exp_2_acc = cnn_exp_2[:, 3]
|
||||||
|
f_exp_2_vls = cnn_exp_2[:, 4]
|
||||||
|
f_exp_2_pre = cnn_exp_2[:, 5]
|
||||||
|
println("Training accuracy freq 2 $(mean(f_exp_2_acc))")
|
||||||
|
println("Testing accuracy freq 2 $(mean(f_exp_2_pre))")
|
||||||
|
|
||||||
|
f_exp_3_tls = cnn_exp_3[:, 2]
|
||||||
|
f_exp_3_acc = cnn_exp_3[:, 3]
|
||||||
|
f_exp_3_vls = cnn_exp_3[:, 4]
|
||||||
|
f_exp_3_pre = cnn_exp_3[:, 5]
|
||||||
|
println("Training accuracy freq 3 $(mean(f_exp_3_acc))")
|
||||||
|
println("Testing accuracy freq 3 $(mean(f_exp_3_pre))")
|
||||||
|
|
||||||
|
f_exp_4_tls = cnn_exp_4[:, 2]
|
||||||
|
f_exp_4_acc = cnn_exp_4[:, 3]
|
||||||
|
f_exp_4_vls = cnn_exp_4[:, 4]
|
||||||
|
f_exp_4_pre = cnn_exp_4[:, 5]
|
||||||
|
println("Training accuracy freq 4 $(mean(f_exp_4_acc))")
|
||||||
|
println("Testing accuracy freq 4 $(mean(f_exp_4_pre))")
|
||||||
|
|
||||||
|
f_exp_5_tls = cnn_exp_5[:, 2]
|
||||||
|
f_exp_5_acc = cnn_exp_5[:, 3]
|
||||||
|
f_exp_5_vls = cnn_exp_5[:, 4]
|
||||||
|
f_exp_5_pre = cnn_exp_5[:, 5]
|
||||||
|
println("Training accuracy freq 5 $(mean(f_exp_5_acc))")
|
||||||
|
println("Testing accuracy freq 5 $(mean(f_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound LeNet 1x: $(size(cnn_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 2x: $(size(cnn_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 3x: $(size(cnn_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 4x: $(size(cnn_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 5x: $(size(cnn_exp_5)[1])")
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_acc,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_acc,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_acc,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_acc,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_acc,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_acc,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_acc,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_acc,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_acc,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_acc,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_es_tacc.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_pre,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_pre,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_pre,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_pre,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_pre,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_pre,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_pre,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_pre,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_pre,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_pre,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_es_tpre.png")
|
|
@ -0,0 +1,310 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using Statistics
|
||||||
|
using Plots
|
||||||
|
|
||||||
|
cif = "cifar";
|
||||||
|
mni = "mnist";
|
||||||
|
bay = "bayes";
|
||||||
|
wat = "cpu_watts";
|
||||||
|
frq = "freq";
|
||||||
|
ram = "ram_use";
|
||||||
|
_100 = "100";
|
||||||
|
acc = "acc";
|
||||||
|
es = "es";
|
||||||
|
wbud = "wbud";
|
||||||
|
|
||||||
|
|
||||||
|
bay_cif_acc_ene = readcpudata(cif, bay, wat, acc);
|
||||||
|
bay_cif_acc_ram = readcpudata(cif, bay, ram, acc);
|
||||||
|
|
||||||
|
bay_cif_es_ene = readcpudata(cif, bay, wat, es);
|
||||||
|
bay_cif_es_ram = readcpudata(cif, bay, ram, es);
|
||||||
|
|
||||||
|
bay_cif_wbud_ene = readcpudata(cif, bay, wat, wbud);
|
||||||
|
bay_cif_wbud_ram = readcpudata(cif, bay, ram, wbud);
|
||||||
|
|
||||||
|
bay_cif_100_ene = readcpudata(cif, bay, wat, _100);
|
||||||
|
bay_cif_100_ram = readcpudata(cif, bay, ram, _100);
|
||||||
|
|
||||||
|
|
||||||
|
bay_mni_acc_ene = readcpudata(mni, bay, wat, acc);
|
||||||
|
bay_mni_acc_ram = readcpudata(mni, bay, ram, acc);
|
||||||
|
|
||||||
|
bay_mni_es_ene = readcpudata(mni, bay, wat, es);
|
||||||
|
bay_mni_es_ram = readcpudata(mni, bay, ram, es);
|
||||||
|
|
||||||
|
bay_mni_wbud_ene = readcpudata(mni, bay, wat, wbud);
|
||||||
|
bay_mni_wbud_ram = readcpudata(mni, bay, ram, wbud);
|
||||||
|
|
||||||
|
bay_mni_100_ene = readcpudata(mni, bay, wat, _100);
|
||||||
|
bay_mni_100_ram = readcpudata(mni, bay, ram, _100);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
frq_cif_acc_ene = readcpudata(cif, frq, wat, acc);
|
||||||
|
frq_cif_acc_ram = readcpudata(cif, frq, ram, acc);
|
||||||
|
|
||||||
|
frq_cif_es_ene = readcpudata(cif, frq, wat, es);
|
||||||
|
frq_cif_es_ram = readcpudata(cif, frq, ram, es);
|
||||||
|
|
||||||
|
frq_cif_wbud_ene = readcpudata(cif, frq, wat, wbud);
|
||||||
|
frq_cif_wbud_ram = readcpudata(cif, frq, ram, wbud);
|
||||||
|
|
||||||
|
frq_cif_100_ene = readcpudata(cif, frq, wat, _100);
|
||||||
|
frq_cif_100_ram = readcpudata(cif, frq, ram, _100);
|
||||||
|
|
||||||
|
|
||||||
|
frq_mni_acc_ene = readcpudata(mni, frq, wat, acc);
|
||||||
|
frq_mni_acc_ram = readcpudata(mni, frq, ram, acc);
|
||||||
|
|
||||||
|
frq_mni_es_ene = readcpudata(mni, frq, wat, es);
|
||||||
|
frq_mni_es_ram = readcpudata(mni, frq, ram, es);
|
||||||
|
|
||||||
|
frq_mni_wbud_ene = readcpudata(mni, frq, wat, wbud);
|
||||||
|
frq_mni_wbud_ram = readcpudata(mni, frq, ram, wbud);
|
||||||
|
|
||||||
|
frq_mni_100_ene = readcpudata(mni, frq, wat, _100);
|
||||||
|
frq_mni_100_ram = readcpudata(mni, frq, ram, _100);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_cif_acc_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_cif_acc_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_cif_acc_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_cif_acc_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_cif_es_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_cif_es_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_cif_es_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_cif_es_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_cif_wbud_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_cif_wbud_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_cif_wbud_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_cif_wbud_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_cif_100_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_cif_100_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_cif_100_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_cif_100_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_mni_acc_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_mni_acc_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_mni_acc_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_mni_acc_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_mni_es_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_mni_es_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_mni_es_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_mni_es_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_mni_wbud_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_mni_wbud_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_mni_wbud_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_mni_wbud_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_mni_100_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_mni_100_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in bay_mni_100_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
bay_mni_100_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_cif_acc_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_cif_acc_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_cif_acc_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_cif_acc_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_cif_es_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_cif_es_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_cif_es_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_cif_es_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_cif_wbud_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_cif_wbud_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_cif_wbud_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_cif_wbud_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_cif_100_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_cif_100_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_cif_100_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_cif_100_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_mni_acc_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_mni_acc_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_mni_acc_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_mni_acc_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_mni_es_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_mni_es_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_mni_es_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_mni_es_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_mni_wbud_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_mni_wbud_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_mni_wbud_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_mni_wbud_ram = temp;
|
||||||
|
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_mni_100_ene
|
||||||
|
t = getcpuwatt(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_mni_100_ene = temp;
|
||||||
|
|
||||||
|
temp = Vector()
|
||||||
|
for vec in frq_mni_100_ram
|
||||||
|
t = getramuse(vec)
|
||||||
|
push!(temp, t)
|
||||||
|
end
|
||||||
|
frq_mni_100_ram = temp;
|
|
@ -0,0 +1,23 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using Plots
|
||||||
|
using FFTW
|
||||||
|
using DSP
|
||||||
|
|
||||||
|
folder = "exp_100_epochs/"
|
||||||
|
|
||||||
|
bay_watt_1 = load_pickle("$(folder)bayes_wattdata_1.pkl")
|
||||||
|
bay_watt_1 = removewatt(bay_watt_1[:, 1])
|
||||||
|
|
||||||
|
N = length(bay_watt_1) - 1
|
||||||
|
Ts = 1 / (1.1 * N)
|
||||||
|
t0 = 0
|
||||||
|
tmax = t0 + N * Ts
|
||||||
|
t = t0:Ts:tmax
|
||||||
|
|
||||||
|
bay_watt_1_fft = fft(bay_watt_1) |> fftshift
|
||||||
|
bay_watt_1_fft_f = fftfreq(length(t), 1.0 / Ts) |> fftshift
|
||||||
|
|
||||||
|
plot(bay_watt_1)
|
||||||
|
plot(bay_watt_1_fft_f, abs.(bay_watt_1_fft), title = "Spectrum")
|
||||||
|
|
||||||
|
length(t)
|
|
@ -0,0 +1,233 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
|
||||||
|
folder = "early_stop_res/"
|
||||||
|
|
||||||
|
bayes_exp_1 = load_pickle("$(folder)bayes_exp_data_1.pkl")
|
||||||
|
bayes_exp_2 = load_pickle("$(folder)bayes_exp_data_2.pkl")
|
||||||
|
bayes_exp_3 = load_pickle("$(folder)bayes_exp_data_3.pkl")
|
||||||
|
bayes_exp_4 = load_pickle("$(folder)bayes_exp_data_4.pkl")
|
||||||
|
bayes_exp_5 = load_pickle("$(folder)bayes_exp_data_5.pkl")
|
||||||
|
|
||||||
|
b_exp_1_tls = bayes_exp_1[:, 2]
|
||||||
|
b_exp_1_acc = bayes_exp_1[:, 3]
|
||||||
|
b_exp_1_vls = bayes_exp_1[:, 4]
|
||||||
|
b_exp_1_pre = bayes_exp_1[:, 5]
|
||||||
|
println("Training accuracy bayes 1 $(mean(b_exp_1_acc))")
|
||||||
|
println("Testing accuracy bayes 1 $(mean(b_exp_1_pre))")
|
||||||
|
|
||||||
|
b_exp_2_tls = bayes_exp_2[:, 2]
|
||||||
|
b_exp_2_acc = bayes_exp_2[:, 3]
|
||||||
|
b_exp_2_vls = bayes_exp_2[:, 4]
|
||||||
|
b_exp_2_pre = bayes_exp_2[:, 5]
|
||||||
|
println("Training accuracy bayes 2 $(mean(b_exp_2_acc))")
|
||||||
|
println("Testing accuracy bayes 2 $(mean(b_exp_2_pre))")
|
||||||
|
|
||||||
|
b_exp_3_tls = bayes_exp_3[:, 2]
|
||||||
|
b_exp_3_acc = bayes_exp_3[:, 3]
|
||||||
|
b_exp_3_vls = bayes_exp_3[:, 4]
|
||||||
|
b_exp_3_pre = bayes_exp_3[:, 5]
|
||||||
|
println("Training accuracy bayes 3 $(mean(b_exp_3_acc))")
|
||||||
|
println("Testing accuracy bayes 3 $(mean(b_exp_3_pre))")
|
||||||
|
|
||||||
|
b_exp_4_tls = bayes_exp_4[:, 2]
|
||||||
|
b_exp_4_acc = bayes_exp_4[:, 3]
|
||||||
|
b_exp_4_vls = bayes_exp_4[:, 4]
|
||||||
|
b_exp_4_pre = bayes_exp_4[:, 5]
|
||||||
|
println("Training accuracy bayes 4 $(mean(b_exp_4_acc))")
|
||||||
|
println("Testing accuracy bayes 4 $(mean(b_exp_4_pre))")
|
||||||
|
|
||||||
|
b_exp_5_tls = bayes_exp_5[:, 2]
|
||||||
|
b_exp_5_acc = bayes_exp_5[:, 3]
|
||||||
|
b_exp_5_vls = bayes_exp_5[:, 4]
|
||||||
|
b_exp_5_pre = bayes_exp_5[:, 5]
|
||||||
|
println("Training accuracy bayes 5 $(mean(b_exp_5_acc))")
|
||||||
|
println("Testing accuracy bayes 5 $(mean(b_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound Bayesian 1x: $(size(bayes_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 2x: $(size(bayes_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 3x: $(size(bayes_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 4x: $(size(bayes_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound Bayesian 5x: $(size(bayes_exp_5)[1])")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cnn_exp_1 = load_pickle("$(folder)freq_exp_data_1.pkl")
|
||||||
|
cnn_exp_2 = load_pickle("$(folder)freq_exp_data_2.pkl")
|
||||||
|
cnn_exp_3 = load_pickle("$(folder)freq_exp_data_3.pkl")
|
||||||
|
cnn_exp_4 = load_pickle("$(folder)freq_exp_data_4.pkl")
|
||||||
|
cnn_exp_5 = load_pickle("$(folder)freq_exp_data_5.pkl")
|
||||||
|
|
||||||
|
f_exp_1_tls = cnn_exp_1[:, 2]
|
||||||
|
f_exp_1_acc = cnn_exp_1[:, 3]
|
||||||
|
f_exp_1_vls = cnn_exp_1[:, 4]
|
||||||
|
f_exp_1_pre = cnn_exp_1[:, 5]
|
||||||
|
println("Training accuracy freq 1 $(mean(f_exp_1_acc))")
|
||||||
|
println("Testing accuracy freq 1 $(mean(f_exp_1_pre))")
|
||||||
|
|
||||||
|
f_exp_2_tls = cnn_exp_2[:, 2]
|
||||||
|
f_exp_2_acc = cnn_exp_2[:, 3]
|
||||||
|
f_exp_2_vls = cnn_exp_2[:, 4]
|
||||||
|
f_exp_2_pre = cnn_exp_2[:, 5]
|
||||||
|
println("Training accuracy freq 2 $(mean(f_exp_2_acc))")
|
||||||
|
println("Testing accuracy freq 2 $(mean(f_exp_2_pre))")
|
||||||
|
|
||||||
|
f_exp_3_tls = cnn_exp_3[:, 2]
|
||||||
|
f_exp_3_acc = cnn_exp_3[:, 3]
|
||||||
|
f_exp_3_vls = cnn_exp_3[:, 4]
|
||||||
|
f_exp_3_pre = cnn_exp_3[:, 5]
|
||||||
|
println("Training accuracy freq 3 $(mean(f_exp_3_acc))")
|
||||||
|
println("Testing accuracy freq 3 $(mean(f_exp_3_pre))")
|
||||||
|
|
||||||
|
f_exp_4_tls = cnn_exp_4[:, 2]
|
||||||
|
f_exp_4_acc = cnn_exp_4[:, 3]
|
||||||
|
f_exp_4_vls = cnn_exp_4[:, 4]
|
||||||
|
f_exp_4_pre = cnn_exp_4[:, 5]
|
||||||
|
println("Training accuracy freq 4 $(mean(f_exp_4_acc))")
|
||||||
|
println("Testing accuracy freq 4 $(mean(f_exp_4_pre))")
|
||||||
|
|
||||||
|
f_exp_5_tls = cnn_exp_5[:, 2]
|
||||||
|
f_exp_5_acc = cnn_exp_5[:, 3]
|
||||||
|
f_exp_5_vls = cnn_exp_5[:, 4]
|
||||||
|
f_exp_5_pre = cnn_exp_5[:, 5]
|
||||||
|
println("Training accuracy freq 5 $(mean(f_exp_5_acc))")
|
||||||
|
println("Testing accuracy freq 5 $(mean(f_exp_5_pre))")
|
||||||
|
|
||||||
|
println("Amount of epochs to reach bound LeNet 1x: $(size(cnn_exp_1)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 2x: $(size(cnn_exp_2)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 3x: $(size(cnn_exp_3)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 4x: $(size(cnn_exp_4)[1])")
|
||||||
|
println("Amount of epochs to reach bound LeNet 5x: $(size(cnn_exp_5)[1])")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_acc,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_acc,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_acc,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_acc,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_acc,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_acc,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_acc,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_acc,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_acc,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_acc,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_es_tacc.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
y = f_exp_1_pre,
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(color = "rgb(211,120,000)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_2_pre,
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(color = "rgb(255,170,017)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_3_pre,
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(color = "rgb(255,187,034)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_4_pre,
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(color = "rgb(255,204,051)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = f_exp_5_pre,
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(color = "rgb(255,221,068)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_1_pre,
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(color = "rgb(055,033,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_2_pre,
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(color = "rgb(033,081,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_3_pre,
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(color = "rgb(033,115,240)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_4_pre,
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(color = "rgb(151,177,255)"),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
y = b_exp_5_pre,
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(color = "rgb(051,215,255)"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "lines",
|
||||||
|
opacity = 0.4,
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Accuracy",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_es_tpre.png")
|
|
@ -0,0 +1,297 @@
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
using Statistics: mean, std
|
||||||
|
include("aux_func.jl")
|
||||||
|
|
||||||
|
data = load_pickle("efficiency_per_size.pkl");
|
||||||
|
|
||||||
|
#all_data_ene["mni"][s]["100"]["bay"]
|
||||||
|
|
||||||
|
data_type = ["mni", "cif"]
|
||||||
|
model_type = ["bay", "frq"]
|
||||||
|
experiment_type = ["100", "est", "acc", "wat"]
|
||||||
|
|
||||||
|
# MNIST 100 efficency
|
||||||
|
bayes_100_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_100_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
freqs_100_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_100_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# MNIST est efficency
|
||||||
|
bayes_est_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_est_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
freqs_est_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_est_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# MNIST wat efficency
|
||||||
|
bayes_wat_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_wat_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
freqs_wat_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_wat_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# MNIST acc efficency
|
||||||
|
bayes_acc_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_acc_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
freqs_acc_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_acc_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# CIFAR 100 efficency
|
||||||
|
bayes_100_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_100_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
for i = 1:5
|
||||||
|
t_std = std(bayes_100_cifar_eff)
|
||||||
|
if (bayes_100_cifar_eff[i] > 2 * t_std) || (bayes_100_cifar_eff[i] < 2 * t_std)
|
||||||
|
bayes_100_cifar_eff[i] = mean(bayes_100_cifar_eff)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
freqs_100_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_100_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
for i = 1:5
|
||||||
|
t_std = std(freqs_100_cifar_eff)
|
||||||
|
if (freqs_100_cifar_eff[i] > 2 * t_std) || (freqs_100_cifar_eff[i] < 2 * t_std)
|
||||||
|
freqs_100_cifar_eff[i] = mean(freqs_100_cifar_eff)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# CIFAR est efficency
|
||||||
|
bayes_est_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_est_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
freqs_est_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_est_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# CIFAR wat efficency
|
||||||
|
bayes_wat_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_wat_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
freqs_wat_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_wat_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# CIFAR acc efficency
|
||||||
|
bayes_acc_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_acc_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
freqs_acc_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_acc_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
avg_rate_bcnn = (-8.266684252643054e-5 * 1000)
|
||||||
|
avg_rate_fcnn = (0.00022035677966088333 * 1000)
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_fcnn .* freqs_100_mnist_eff),
|
||||||
|
name = "LeNet 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_fcnn .* freqs_est_mnist_eff),
|
||||||
|
name = "LeNet est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_fcnn .* freqs_wat_mnist_eff),
|
||||||
|
name = "LeNet wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_fcnn .* freqs_acc_mnist_eff),
|
||||||
|
name = "LeNet acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_bcnn .* bayes_100_mnist_eff),
|
||||||
|
name = "BCNN 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_bcnn .* bayes_est_mnist_eff),
|
||||||
|
name = "BCNN est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(033,081,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_bcnn .* bayes_wat_mnist_eff),
|
||||||
|
name = "BCNN wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(033,115,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_bcnn .* bayes_acc_mnist_eff),
|
||||||
|
name = "BCNN acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(151,177,255)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "ΔEfficency",
|
||||||
|
xaxis_title_text = "Size";
|
||||||
|
xaxis_range = [-1, 5],
|
||||||
|
xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_eff_exp.png")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_fcnn .* freqs_100_cifar_eff),
|
||||||
|
name = "LeNet 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_fcnn .* freqs_est_cifar_eff),
|
||||||
|
name = "LeNet est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_fcnn .* freqs_wat_cifar_eff),
|
||||||
|
name = "LeNet wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_fcnn .* freqs_acc_cifar_eff),
|
||||||
|
name = "LeNet acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_bcnn .* bayes_100_cifar_eff),
|
||||||
|
name = "BCNN 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_bcnn .* bayes_est_cifar_eff),
|
||||||
|
name = "BCNN est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(033,081,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_bcnn .* bayes_wat_cifar_eff),
|
||||||
|
name = "BCNN wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(033,115,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = (-avg_rate_bcnn .* bayes_acc_cifar_eff),
|
||||||
|
name = "BCNN acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(151,177,255)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "ΔEfficency",
|
||||||
|
xaxis_title_text = "Size";
|
||||||
|
xaxis_range = [-1, 5],
|
||||||
|
xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_eff_exp.png")
|
|
@ -0,0 +1,386 @@
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
using Statistics: mean, std
|
||||||
|
using DataFrames
|
||||||
|
include("aux_func.jl")
|
||||||
|
|
||||||
|
data = load_pickle("efficiency_per_size_sum.pkl");
|
||||||
|
|
||||||
|
#all_data_ene["mni"][s]["100"]["bay"]
|
||||||
|
|
||||||
|
data_type = ["mni", "cif"]
|
||||||
|
model_type = ["bay", "frq"]
|
||||||
|
experiment_type = ["100", "est", "acc", "wat"]
|
||||||
|
|
||||||
|
experiment_100=["100","100","100","100","100"]
|
||||||
|
experiment_est=["est","est","est","est","est"]
|
||||||
|
experiment_wat=["wat","wat","wat","wat","wat"]
|
||||||
|
experiment_acc=["acc","acc","acc","acc","acc"]
|
||||||
|
|
||||||
|
model_bayes = ["BCNN","BCNN","BCNN","BCNN","BCNN"]
|
||||||
|
model_lenet = ["LeNet","LeNet","LeNet","LeNet","LeNet"]
|
||||||
|
|
||||||
|
data_mnist = ["MNIST","MNIST","MNIST","MNIST","MNIST"]
|
||||||
|
data_cifar = ["CIFAR","CIFAR","CIFAR","CIFAR","CIFAR"]
|
||||||
|
|
||||||
|
sizes = [1,2,3,4,5]
|
||||||
|
|
||||||
|
# MNIST 100 efficency
|
||||||
|
bayes_100_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_100_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_100_mnist_eff = DataFrame(Efficiency=bayes_100_mnist_eff,Model=model_bayes,Experiment=experiment_100,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
freqs_100_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_100_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_100_mnist_eff = DataFrame(Efficiency=freqs_100_mnist_eff,Model=model_lenet,Experiment=experiment_100,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# MNIST est efficency
|
||||||
|
bayes_est_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_est_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_est_mnist_eff = DataFrame(Efficiency=bayes_est_mnist_eff,Model=model_bayes,Experiment=experiment_est,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
freqs_est_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_est_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_est_mnist_eff = DataFrame(Efficiency=freqs_est_mnist_eff,Model=model_lenet,Experiment=experiment_est,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# MNIST wat efficency
|
||||||
|
bayes_wat_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_wat_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_wat_mnist_eff = DataFrame(Efficiency=bayes_wat_mnist_eff,Model=model_bayes,Experiment=experiment_wat,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
freqs_wat_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_wat_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_wat_mnist_eff = DataFrame(Efficiency=freqs_wat_mnist_eff,Model=model_lenet,Experiment=experiment_wat,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# MNIST acc efficency
|
||||||
|
bayes_acc_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_acc_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_acc_mnist_eff = DataFrame(Efficiency=bayes_acc_mnist_eff,Model=model_bayes,Experiment=experiment_acc,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
freqs_acc_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_acc_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_acc_mnist_eff = DataFrame(Efficiency=freqs_acc_mnist_eff,Model=model_lenet,Experiment=experiment_acc,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# CIFAR 100 efficency
|
||||||
|
bayes_100_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_100_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_100_cifar_eff = DataFrame(Efficiency=bayes_100_cifar_eff,Model=model_bayes,Experiment=experiment_100,Dataset=data_cifar,Size=sizes)
|
||||||
|
#for i = 1:5
|
||||||
|
# t_std = std(bayes_100_cifar_eff)
|
||||||
|
# if (bayes_100_cifar_eff[i] > 2 * t_std) || (bayes_100_cifar_eff[i] < 2 * t_std)
|
||||||
|
# bayes_100_cifar_eff[i] = mean(bayes_100_cifar_eff)
|
||||||
|
# end
|
||||||
|
#end
|
||||||
|
|
||||||
|
freqs_100_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_100_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_100_cifar_eff = DataFrame(Efficiency=freqs_100_cifar_eff,Model=model_lenet,Experiment=experiment_100,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
#for i = 1:5
|
||||||
|
# t_std = std(freqs_100_cifar_eff)
|
||||||
|
# if (freqs_100_cifar_eff[i] > 2 * t_std) || (freqs_100_cifar_eff[i] < 2 * t_std)
|
||||||
|
# freqs_100_cifar_eff[i] = mean(freqs_100_cifar_eff)
|
||||||
|
# end
|
||||||
|
#end
|
||||||
|
|
||||||
|
# CIFAR est efficency
|
||||||
|
bayes_est_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_est_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_est_cifar_eff = DataFrame(Efficiency=bayes_est_cifar_eff,Model=model_bayes,Experiment=experiment_est,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
freqs_est_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_est_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_est_cifar_eff = DataFrame(Efficiency=freqs_est_cifar_eff,Model=model_lenet,Experiment=experiment_est,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# CIFAR wat efficency
|
||||||
|
bayes_wat_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_wat_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_wat_cifar_eff = DataFrame(Efficiency=bayes_wat_cifar_eff,Model=model_bayes,Experiment=experiment_wat,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
freqs_wat_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_wat_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_wat_cifar_eff = DataFrame(Efficiency=freqs_wat_cifar_eff,Model=model_lenet,Experiment=experiment_wat,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# CIFAR acc efficency
|
||||||
|
bayes_acc_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_acc_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_acc_cifar_eff = DataFrame(Efficiency=bayes_acc_cifar_eff,Model=model_bayes,Experiment=experiment_acc,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
freqs_acc_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_acc_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_acc_cifar_eff = DataFrame(Efficiency=freqs_acc_cifar_eff,Model=model_lenet,Experiment=experiment_acc,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
mnist_dataframe = vcat(bayes_100_mnist_eff,freqs_100_mnist_eff,bayes_est_mnist_eff,freqs_est_mnist_eff,bayes_acc_mnist_eff,freqs_acc_mnist_eff,bayes_wat_mnist_eff,freqs_wat_mnist_eff)
|
||||||
|
|
||||||
|
cifar_dataframe = vcat(bayes_100_cifar_eff,freqs_100_cifar_eff,bayes_est_cifar_eff,freqs_est_cifar_eff,bayes_acc_cifar_eff,freqs_acc_cifar_eff,bayes_wat_cifar_eff,freqs_wat_cifar_eff)
|
||||||
|
|
||||||
|
#avg_rate_bcnn = (-8.266684252643054e-5 * 1000)
|
||||||
|
#avg_rate_fcnn = (0.00022035677966088333 * 1000)
|
||||||
|
|
||||||
|
#=
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_100_mnist_eff),
|
||||||
|
y = freqs_100_mnist_eff.Efficiency,
|
||||||
|
name = "LeNet 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_est_mnist_eff),
|
||||||
|
y = freqs_est_mnist_eff.Efficiency,
|
||||||
|
name = "LeNet est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_wat_mnist_eff),
|
||||||
|
y = freqs_wat_mnist_eff.Efficiency,
|
||||||
|
name = "LeNet wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_acc_mnist_eff),
|
||||||
|
y = freqs_acc_mnist_eff.Efficiency,
|
||||||
|
name = "LeNet acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_100_mnist_eff),
|
||||||
|
y = bayes_100_mnist_eff.Efficiency,
|
||||||
|
name = "BCNN 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_est_mnist_eff),
|
||||||
|
y = bayes_est_mnist_eff.Efficiency,
|
||||||
|
name = "BCNN est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(033,081,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_wat_mnist_eff),
|
||||||
|
y = bayes_wat_mnist_eff.Efficiency,
|
||||||
|
name = "BCNN wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(033,115,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_acc_mnist_eff),
|
||||||
|
y = bayes_acc_mnist_eff.Efficiency,
|
||||||
|
name = "BCNN acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(151,177,255)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Efficiency",
|
||||||
|
xaxis_title_text = "Size";
|
||||||
|
xaxis_range = [-1, 5],
|
||||||
|
xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_eff_exp_sum.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_100_cifar_eff),
|
||||||
|
y = freqs_100_cifar_eff.Efficiency,
|
||||||
|
name = "LeNet 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_est_cifar_eff),
|
||||||
|
y = freqs_est_cifar_eff.Efficiency,
|
||||||
|
name = "LeNet est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_wat_cifar_eff),
|
||||||
|
y = freqs_wat_cifar_eff.Efficiency,
|
||||||
|
name = "LeNet wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_acc_cifar_eff),
|
||||||
|
y = freqs_acc_cifar_eff.Efficiency,
|
||||||
|
name = "LeNet acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_100_cifar_eff),
|
||||||
|
y = bayes_100_cifar_eff.Efficiency,
|
||||||
|
name = "BCNN 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_est_cifar_eff),
|
||||||
|
y = bayes_est_cifar_eff.Efficiency,
|
||||||
|
name = "BCNN est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(033,081,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_wat_cifar_eff),
|
||||||
|
y = bayes_wat_cifar_eff.Efficiency,
|
||||||
|
name = "BCNN wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(033,115,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_acc_cifar_eff),
|
||||||
|
y = bayes_acc_cifar_eff.Efficiency,
|
||||||
|
name = "BCNN acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(151,177,255)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Efficiency",
|
||||||
|
xaxis_title_text = "Size";
|
||||||
|
xaxis_range = [-1, 5],
|
||||||
|
xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_eff_exp_sum.png")
|
||||||
|
=#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#en_plot = plot(mnist_dataframe, x=:Experiment, y=:Efficiency, boxpoints="all", kind="box")
|
||||||
|
en_plot = plot(
|
||||||
|
mnist_dataframe, x=:Experiment, y=:Efficiency,kind="scatter",mode="markers",color=:Model,
|
||||||
|
quartilemethod="exclusive",
|
||||||
|
marker=attr(size=:Size, sizeref=maximum(mnist_dataframe.Size) / (10^2), sizemode="area")
|
||||||
|
#marker=attr(size=:Size, sizeref=0.1, sizemode="area")
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_scatter_size.png")
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
mnist_dataframe, x=:Experiment, y=:Efficiency,kind="box", boxpoints="all",color=:Model,
|
||||||
|
quartilemethod="exclusive",
|
||||||
|
marker=attr(size=:Size, sizeref=maximum(mnist_dataframe.Size) / (10^2), sizemode="area")
|
||||||
|
#marker=attr(size=:Size, sizeref=0.1, sizemode="area")
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_box_size.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
cifar_dataframe, x=:Experiment, y=:Efficiency,kind="scatter",mode="markers",color=:Model,
|
||||||
|
quartilemethod="exclusive",
|
||||||
|
marker=attr(size=:Size, sizeref=maximum(mnist_dataframe.Size) / (10^2), sizemode="area")
|
||||||
|
#marker=attr(size=:Size, sizeref=0.1, sizemode="area")
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_scatter_size.png")
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
cifar_dataframe, x=:Experiment, y=:Efficiency,kind="box", boxpoints="all",color=:Model,
|
||||||
|
quartilemethod="exclusive",
|
||||||
|
marker=attr(size=:Size, sizeref=maximum(mnist_dataframe.Size) / (10^2), sizemode="area")
|
||||||
|
#marker=attr(size=:Size, sizeref=0.1, sizemode="area")
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_box_size.png")
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,985 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using LinearAlgebra
|
||||||
|
using Statistics
|
||||||
|
|
||||||
|
#=
|
||||||
|
Obtain energy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
#mni_folder_1 = "ini_exp_data/"
|
||||||
|
|
||||||
|
|
||||||
|
mni_folder_100 = "exp_100_epochs/";
|
||||||
|
cif_folder_100 = "CIFAR_100_epoch/";
|
||||||
|
|
||||||
|
mni_folder_acc = "data_bounded/";
|
||||||
|
cif_folder_acc = "CIFAR_acc_bound/";
|
||||||
|
|
||||||
|
mni_folder_wat = "data_budget/";
|
||||||
|
cif_folder_wat = "CIFAR_energy_bound/";
|
||||||
|
|
||||||
|
mni_folder_est = "early_stop_res/";
|
||||||
|
cif_folder_est = "CIFAR_early_stop/";
|
||||||
|
|
||||||
|
bayes_model = "bayes";
|
||||||
|
freq_model = "freq";
|
||||||
|
w_type = "watt";
|
||||||
|
e_type = "exp";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load GPU data
|
||||||
|
=#
|
||||||
|
mni_100_bay_ene = getgpudata(mni_folder_100, bayes_model, w_type, "eo");
|
||||||
|
mni_100_fre_ene = getgpudata(mni_folder_100, freq_model, w_type, "eo");
|
||||||
|
cif_100_bay_ene = getgpudata(cif_folder_100, bayes_model, w_type, "eo");
|
||||||
|
cif_100_fre_ene = getgpudata(cif_folder_100, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_acc_bay_ene = getgpudata(mni_folder_acc, bayes_model, w_type, "eo");
|
||||||
|
mni_acc_fre_ene = getgpudata(mni_folder_acc, freq_model, w_type, "eo");
|
||||||
|
cif_acc_bay_ene = getgpudata(cif_folder_acc, bayes_model, w_type, "eo");
|
||||||
|
cif_acc_fre_ene = getgpudata(cif_folder_acc, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_wat_bay_ene = getgpudata(mni_folder_wat, bayes_model, w_type, "eo");
|
||||||
|
mni_wat_fre_ene = getgpudata(mni_folder_wat, freq_model, w_type, "eo");
|
||||||
|
cif_wat_bay_ene = getgpudata(cif_folder_wat, bayes_model, w_type, "eo");
|
||||||
|
cif_wat_fre_ene = getgpudata(cif_folder_wat, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_est_bay_ene = getgpudata(mni_folder_est, bayes_model, w_type, "eo");
|
||||||
|
mni_est_fre_ene = getgpudata(mni_folder_est, freq_model, w_type, "eo");
|
||||||
|
cif_est_bay_ene = getgpudata(cif_folder_est, bayes_model, w_type, "eo");
|
||||||
|
cif_est_fre_ene = getgpudata(cif_folder_est, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Define CPU paths
|
||||||
|
=#
|
||||||
|
cif = "cifar";
|
||||||
|
mni = "mnist";
|
||||||
|
bay = "bayes";
|
||||||
|
wat = "cpu_watts";
|
||||||
|
frq = "freq";
|
||||||
|
ram = "ram_use";
|
||||||
|
_100 = "100";
|
||||||
|
acc = "acc";
|
||||||
|
es = "es";
|
||||||
|
wbud = "wbud";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load CPU data
|
||||||
|
=#
|
||||||
|
bay_cif_100_ene = readcpudata(cif, bay, wat, _100);
|
||||||
|
bay_mni_100_ene = readcpudata(mni, bay, wat, _100);
|
||||||
|
frq_cif_100_ene = readcpudata(cif, frq, wat, _100);
|
||||||
|
frq_mni_100_ene = readcpudata(mni, frq, wat, _100);
|
||||||
|
|
||||||
|
bay_cif_acc_ene = readcpudata(cif, bay, wat, acc);
|
||||||
|
bay_mni_acc_ene = readcpudata(mni, bay, wat, acc);
|
||||||
|
frq_cif_acc_ene = readcpudata(cif, frq, wat, acc);
|
||||||
|
frq_mni_acc_ene = readcpudata(mni, frq, wat, acc);
|
||||||
|
|
||||||
|
|
||||||
|
bay_cif_wbu_ene = readcpudata(cif, bay, wat, wbud);
|
||||||
|
bay_mni_wbu_ene = readcpudata(mni, bay, wat, wbud);
|
||||||
|
frq_cif_wbu_ene = readcpudata(cif, frq, wat, wbud);
|
||||||
|
frq_mni_wbu_ene = readcpudata(mni, frq, wat, wbud);
|
||||||
|
|
||||||
|
bay_mni_est_ene = readcpudata(mni, bay, wat, es);
|
||||||
|
bay_cif_est_ene = readcpudata(cif, bay, wat, es);
|
||||||
|
frq_cif_est_ene = readcpudata(cif, frq, wat, es);
|
||||||
|
frq_mni_est_ene = readcpudata(mni, frq, wat, es);
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
bay_cif_acc_ene[s] = round.(getcpuwatt(bay_cif_acc_ene[s]))
|
||||||
|
bay_cif_est_ene[s] = round.(getcpuwatt(bay_cif_est_ene[s]))
|
||||||
|
bay_cif_wbu_ene[s] = round.(getcpuwatt(bay_cif_wbu_ene[s]))
|
||||||
|
bay_cif_100_ene[s] = round.(getcpuwatt(bay_cif_100_ene[s]))
|
||||||
|
|
||||||
|
bay_mni_acc_ene[s] = round.(getcpuwatt(bay_mni_acc_ene[s]))
|
||||||
|
bay_mni_est_ene[s] = round.(getcpuwatt(bay_mni_est_ene[s]))
|
||||||
|
bay_mni_wbu_ene[s] = round.(getcpuwatt(bay_mni_wbu_ene[s]))
|
||||||
|
bay_mni_100_ene[s] = round.(getcpuwatt(bay_mni_100_ene[s]))
|
||||||
|
|
||||||
|
frq_cif_acc_ene[s] = round.(getcpuwatt(frq_cif_acc_ene[s]))
|
||||||
|
frq_cif_est_ene[s] = round.(getcpuwatt(frq_cif_est_ene[s]))
|
||||||
|
frq_cif_wbu_ene[s] = round.(getcpuwatt(frq_cif_wbu_ene[s]))
|
||||||
|
frq_cif_100_ene[s] = round.(getcpuwatt(frq_cif_100_ene[s]))
|
||||||
|
|
||||||
|
frq_mni_acc_ene[s] = round.(getcpuwatt(frq_mni_acc_ene[s]))
|
||||||
|
frq_mni_est_ene[s] = round.(getcpuwatt(frq_mni_est_ene[s]))
|
||||||
|
frq_mni_wbu_ene[s] = round.(getcpuwatt(frq_mni_wbu_ene[s]))
|
||||||
|
frq_mni_100_ene[s] = round.(getcpuwatt(frq_mni_100_ene[s]))
|
||||||
|
end
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
mni_100_bay_ene[s]["Ene"] = vcat(mni_100_bay_ene[s]["Ene"], bay_mni_100_ene[s])
|
||||||
|
mni_100_fre_ene[s]["Ene"] = vcat(mni_100_fre_ene[s]["Ene"], frq_mni_100_ene[s])
|
||||||
|
cif_100_bay_ene[s]["Ene"] = vcat(cif_100_bay_ene[s]["Ene"], bay_cif_100_ene[s])
|
||||||
|
cif_100_fre_ene[s]["Ene"] = vcat(cif_100_fre_ene[s]["Ene"], frq_cif_100_ene[s])
|
||||||
|
|
||||||
|
mni_acc_bay_ene[s]["Ene"] = vcat(mni_acc_bay_ene[s]["Ene"], bay_mni_acc_ene[s])
|
||||||
|
mni_acc_fre_ene[s]["Ene"] = vcat(mni_acc_fre_ene[s]["Ene"], frq_mni_acc_ene[s])
|
||||||
|
cif_acc_bay_ene[s]["Ene"] = vcat(cif_acc_bay_ene[s]["Ene"], bay_cif_acc_ene[s])
|
||||||
|
cif_acc_fre_ene[s]["Ene"] = vcat(cif_acc_fre_ene[s]["Ene"], frq_cif_acc_ene[s])
|
||||||
|
|
||||||
|
|
||||||
|
mni_wat_bay_ene[s]["Ene"] = vcat(mni_wat_bay_ene[s]["Ene"], bay_mni_wbu_ene[s])
|
||||||
|
mni_wat_fre_ene[s]["Ene"] = vcat(mni_wat_fre_ene[s]["Ene"], frq_mni_wbu_ene[s])
|
||||||
|
cif_wat_bay_ene[s]["Ene"] = vcat(cif_wat_bay_ene[s]["Ene"], bay_cif_wbu_ene[s])
|
||||||
|
cif_wat_fre_ene[s]["Ene"] = vcat(cif_wat_fre_ene[s]["Ene"], frq_cif_wbu_ene[s])
|
||||||
|
|
||||||
|
mni_est_bay_ene[s]["Ene"] = vcat(mni_est_bay_ene[s]["Ene"], bay_mni_est_ene[s])
|
||||||
|
mni_est_fre_ene[s]["Ene"] = vcat(mni_est_fre_ene[s]["Ene"], frq_mni_est_ene[s])
|
||||||
|
cif_est_bay_ene[s]["Ene"] = vcat(cif_est_bay_ene[s]["Ene"], bay_cif_est_ene[s])
|
||||||
|
cif_est_fre_ene[s]["Ene"] = vcat(cif_est_fre_ene[s]["Ene"], frq_cif_est_ene[s])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
all_data_ene = Dict(
|
||||||
|
"mni" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"cif" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
all_data_ene["mni"][s]["100"]["bay"] = sum(mni_100_bay_ene[s]["Ene"])
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Mean energy size $(s) 100: $(all_data_ene["mni"][s]["100"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_ene["mni"][s]["100"]["frq"] = sum(mni_100_fre_ene[s]["Ene"])
|
||||||
|
println("MNIST Freq Mean energy size $(s) 100: $(all_data_ene["mni"][s]["100"]["frq"])")
|
||||||
|
all_data_ene["cif"][s]["100"]["bay"] = sum(cif_100_bay_ene[s]["Ene"])
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Mean energy size $(s) 100: $(all_data_ene["cif"][s]["100"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_ene["cif"][s]["100"]["frq"] = sum(cif_100_fre_ene[s]["Ene"])
|
||||||
|
println("CIFAR Freq Mean energy size $(s) 100: $(all_data_ene["cif"][s]["100"]["frq"])")
|
||||||
|
|
||||||
|
all_data_ene["mni"][s]["acc"]["bay"] = sum(mni_acc_bay_ene[s]["Ene"])
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Mean energy size $(s) Acc: $(all_data_ene["mni"][s]["acc"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_ene["mni"][s]["acc"]["frq"] = sum(mni_acc_fre_ene[s]["Ene"])
|
||||||
|
println("MNIST Freq Mean energy size $(s) Acc: $(all_data_ene["mni"][s]["acc"]["frq"])")
|
||||||
|
all_data_ene["cif"][s]["acc"]["bay"] = sum(cif_acc_bay_ene[s]["Ene"])
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Mean energy size $(s) Acc: $(all_data_ene["cif"][s]["acc"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_ene["cif"][s]["acc"]["frq"] = sum(cif_acc_fre_ene[s]["Ene"])
|
||||||
|
println("CIFAR Freq Mean energy size $(s) Acc: $(all_data_ene["cif"][s]["acc"]["frq"])")
|
||||||
|
|
||||||
|
|
||||||
|
all_data_ene["mni"][s]["wat"]["bay"] = sum(mni_wat_bay_ene[s]["Ene"])
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Mean energy size $(s) Wat: $(all_data_ene["mni"][s]["wat"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_ene["mni"][s]["wat"]["frq"] = sum(mni_wat_fre_ene[s]["Ene"])
|
||||||
|
println("MNIST Freq Mean energy size $(s) Wat: $(all_data_ene["mni"][s]["wat"]["frq"])")
|
||||||
|
all_data_ene["cif"][s]["wat"]["bay"] = sum(cif_wat_bay_ene[s]["Ene"])
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Mean energy size $(s) Wat: $(all_data_ene["cif"][s]["wat"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_ene["cif"][s]["wat"]["frq"] = sum(cif_wat_fre_ene[s]["Ene"])
|
||||||
|
println("CIFAR Freq Mean energy size $(s) Wat: $(all_data_ene["cif"][s]["wat"]["frq"])")
|
||||||
|
|
||||||
|
all_data_ene["mni"][s]["est"]["bay"] = sum(mni_est_bay_ene[s]["Ene"])
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Mean energy size $(s) Est: $(all_data_ene["mni"][s]["est"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_ene["mni"][s]["est"]["frq"] = sum(mni_est_fre_ene[s]["Ene"])
|
||||||
|
println("MNIST Freq Mean energy size $(s) Est: $(all_data_ene["mni"][s]["est"]["frq"])")
|
||||||
|
all_data_ene["cif"][s]["est"]["bay"] = sum(cif_est_bay_ene[s]["Ene"])
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Mean energy size $(s) Est: $(all_data_ene["cif"][s]["est"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_ene["cif"][s]["est"]["frq"] = sum(cif_est_fre_ene[s]["Ene"])
|
||||||
|
println("CIFAR Freq Mean energy size $(s) Est: $(all_data_ene["cif"][s]["est"]["frq"])")
|
||||||
|
end
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load Accuracy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
mni_100_bay_exp = getgpudata(mni_folder_100, bayes_model, e_type, "eo");
|
||||||
|
mni_100_fre_exp = getgpudata(mni_folder_100, freq_model, e_type, "eo");
|
||||||
|
cif_100_bay_exp = getgpudata(cif_folder_100, bayes_model, e_type, "eo");
|
||||||
|
cif_100_fre_exp = getgpudata(cif_folder_100, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
mni_acc_bay_exp = getgpudata(mni_folder_acc, bayes_model, e_type, "eo");
|
||||||
|
mni_acc_fre_exp = getgpudata(mni_folder_acc, freq_model, e_type, "eo");
|
||||||
|
cif_acc_bay_exp = getgpudata(cif_folder_acc, bayes_model, e_type, "eo");
|
||||||
|
cif_acc_fre_exp = getgpudata(cif_folder_acc, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
mni_wat_bay_exp = getgpudata(mni_folder_wat, bayes_model, e_type, "eo");
|
||||||
|
mni_wat_fre_exp = getgpudata(mni_folder_wat, freq_model, e_type, "eo");
|
||||||
|
cif_wat_bay_exp = getgpudata(cif_folder_wat, bayes_model, e_type, "eo");
|
||||||
|
cif_wat_fre_exp = getgpudata(cif_folder_wat, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
mni_est_bay_exp = getgpudata(mni_folder_est, bayes_model, e_type, "eo");
|
||||||
|
mni_est_fre_exp = getgpudata(mni_folder_est, freq_model, e_type, "eo");
|
||||||
|
cif_est_bay_exp = getgpudata(cif_folder_est, bayes_model, e_type, "eo");
|
||||||
|
cif_est_fre_exp = getgpudata(cif_folder_est, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1:5
|
||||||
|
mni_100_bay_exp[i] = expdatatodict(mni_100_bay_exp[i])
|
||||||
|
mni_100_fre_exp[i] = expdatatodict(mni_100_fre_exp[i])
|
||||||
|
cif_100_bay_exp[i] = expdatatodict(cif_100_bay_exp[i])
|
||||||
|
cif_100_fre_exp[i] = expdatatodict(cif_100_fre_exp[i])
|
||||||
|
|
||||||
|
mni_acc_bay_exp[i] = expdatatodict(mni_acc_bay_exp[i])
|
||||||
|
mni_acc_fre_exp[i] = expdatatodict(mni_acc_fre_exp[i])
|
||||||
|
cif_acc_bay_exp[i] = expdatatodict(cif_acc_bay_exp[i])
|
||||||
|
cif_acc_fre_exp[i] = expdatatodict(cif_acc_fre_exp[i])
|
||||||
|
|
||||||
|
mni_wat_bay_exp[i] = expdatatodict(mni_wat_bay_exp[i])
|
||||||
|
mni_wat_fre_exp[i] = expdatatodict(mni_wat_fre_exp[i])
|
||||||
|
cif_wat_bay_exp[i] = expdatatodict(cif_wat_bay_exp[i])
|
||||||
|
cif_wat_fre_exp[i] = expdatatodict(cif_wat_fre_exp[i])
|
||||||
|
|
||||||
|
mni_est_bay_exp[i] = expdatatodict(mni_est_bay_exp[i])
|
||||||
|
mni_est_fre_exp[i] = expdatatodict(mni_est_fre_exp[i])
|
||||||
|
cif_est_bay_exp[i] = expdatatodict(cif_est_bay_exp[i])
|
||||||
|
cif_est_fre_exp[i] = expdatatodict(cif_est_fre_exp[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
all_data_exp = Dict(
|
||||||
|
"mni" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"cif" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
all_data_exp["mni"][s]["100"]["bay"] =
|
||||||
|
(mean(mni_100_bay_exp[s]["acc"]) + mean(mni_100_bay_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Mean accuracy size $(s) 100: $(all_data_exp["mni"][s]["100"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_exp["mni"][s]["100"]["frq"] =
|
||||||
|
(mean(mni_100_fre_exp[s]["acc"]) + mean(mni_100_fre_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"MNIST Freq Mean accuracy size $(s) 100: $(all_data_exp["mni"][s]["100"]["frq"])",
|
||||||
|
)
|
||||||
|
all_data_exp["cif"][s]["100"]["bay"] =
|
||||||
|
(mean(cif_100_bay_exp[s]["acc"]) + mean(cif_100_bay_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Mean accuracy size $(s) 100: $(all_data_exp["cif"][s]["100"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_exp["cif"][s]["100"]["frq"] =
|
||||||
|
(mean(cif_100_fre_exp[s]["acc"]) + mean(cif_100_fre_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"CIFAR Freq Mean accuracy size $(s) 100: $(all_data_exp["cif"][s]["100"]["frq"])",
|
||||||
|
)
|
||||||
|
|
||||||
|
all_data_exp["mni"][s]["acc"]["bay"] =
|
||||||
|
(mean(mni_acc_bay_exp[s]["acc"]) + mean(mni_acc_bay_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Mean accuracy size $(s) Acc: $(all_data_exp["mni"][s]["acc"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_exp["mni"][s]["acc"]["frq"] =
|
||||||
|
(mean(mni_acc_fre_exp[s]["acc"]) + mean(mni_acc_fre_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"MNIST Freq Mean accuracy size $(s) Acc: $(all_data_exp["mni"][s]["acc"]["frq"])",
|
||||||
|
)
|
||||||
|
all_data_exp["cif"][s]["acc"]["bay"] =
|
||||||
|
(mean(cif_acc_bay_exp[s]["acc"]) + mean(cif_acc_bay_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Mean accuracy size $(s) Acc: $(all_data_exp["cif"][s]["acc"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_exp["cif"][s]["acc"]["frq"] =
|
||||||
|
(mean(cif_acc_fre_exp[s]["acc"]) + mean(cif_acc_fre_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"CIFAR Freq Mean accuracy size $(s) Acc: $(all_data_exp["cif"][s]["acc"]["frq"])",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
all_data_exp["mni"][s]["wat"]["bay"] =
|
||||||
|
(mean(mni_wat_bay_exp[s]["acc"]) + mean(mni_wat_bay_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Mean accuracy size $(s) Wat: $(all_data_exp["mni"][s]["wat"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_exp["mni"][s]["wat"]["frq"] =
|
||||||
|
(mean(mni_wat_fre_exp[s]["acc"]) + mean(mni_wat_fre_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"MNIST Freq Mean accuracy size $(s) Wat: $(all_data_exp["mni"][s]["wat"]["frq"])",
|
||||||
|
)
|
||||||
|
all_data_exp["cif"][s]["wat"]["bay"] =
|
||||||
|
(mean(cif_wat_bay_exp[s]["acc"]) + mean(cif_wat_bay_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Mean accuracy size $(s) Wat: $(all_data_exp["cif"][s]["wat"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_exp["cif"][s]["wat"]["frq"] =
|
||||||
|
(mean(cif_wat_fre_exp[s]["acc"]) + mean(cif_wat_fre_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"CIFAR Freq Mean accuracy size $(s) Wat: $(all_data_exp["cif"][s]["wat"]["frq"])",
|
||||||
|
)
|
||||||
|
|
||||||
|
all_data_exp["mni"][s]["est"]["bay"] =
|
||||||
|
(mean(mni_est_bay_exp[s]["acc"]) + mean(mni_est_bay_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Mean accuracy size $(s) Est: $(all_data_exp["mni"][s]["est"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_exp["mni"][s]["est"]["frq"] =
|
||||||
|
(mean(mni_est_fre_exp[s]["acc"]) + mean(mni_est_fre_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"MNIST Freq Mean accuracy size $(s) Est: $(all_data_exp["mni"][s]["est"]["frq"])",
|
||||||
|
)
|
||||||
|
all_data_exp["cif"][s]["est"]["bay"] =
|
||||||
|
(mean(cif_est_bay_exp[s]["acc"]) + mean(cif_est_bay_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Mean accuracy size $(s) Est: $(all_data_exp["cif"][s]["est"]["bay"])",
|
||||||
|
)
|
||||||
|
all_data_exp["cif"][s]["est"]["frq"] =
|
||||||
|
(mean(cif_est_fre_exp[s]["acc"]) + mean(cif_est_fre_exp[s]["pre"])) / 2
|
||||||
|
println(
|
||||||
|
"CIFAR Freq Mean accuracy size $(s) Est: $(all_data_exp["cif"][s]["est"]["frq"])",
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
# Per size efficiency
|
||||||
|
=#
|
||||||
|
|
||||||
|
efficiency_per_size = Dict(
|
||||||
|
"frq" => Dict(
|
||||||
|
"mni" => Dict(
|
||||||
|
"100" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"est" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"acc" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"wat" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
),
|
||||||
|
"cif" => Dict(
|
||||||
|
"100" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"est" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"acc" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"wat" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"bay" => Dict(
|
||||||
|
"mni" => Dict(
|
||||||
|
"100" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"est" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"acc" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"wat" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
),
|
||||||
|
"cif" => Dict(
|
||||||
|
"100" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"est" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"acc" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
"wat" => Dict("1" => 0.0, "2" => 0.0, "3" => 0.0, "4" => 0.0, "5" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
data_type = ["mni", "cif"]
|
||||||
|
model_type = ["bay", "frq"]
|
||||||
|
experiment_type = ["100", "est", "acc", "wat"]
|
||||||
|
|
||||||
|
what = collect(Iterators.product(model_type, data_type, experiment_type, 1:5))
|
||||||
|
|
||||||
|
for t in what
|
||||||
|
#println("model: $(t[1]), data: $(t[2]), experiment: $(t[3]), size: $(t[4])")
|
||||||
|
#println(all_data_exp[t[2]][t[4]][t[3]][t[1]]/all_data_ene[t[2]][t[4]][t[3]][t[1]] * 100)
|
||||||
|
efficiency_per_size[t[1]][t[2]][t[3]][string(t[4])] =
|
||||||
|
all_data_exp[t[2]][t[4]][t[3]][t[1]] / all_data_ene[t[2]][t[4]][t[3]][t[1]] * 100
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
save_pickle("efficiency_per_size.pkl", efficiency_per_size)
|
||||||
|
save_pickle("energy_complete.pkl", all_data_ene)
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
# Accuracy means
|
||||||
|
=#
|
||||||
|
|
||||||
|
comp_exp = Dict(
|
||||||
|
"mni" => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
"cif" => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
comp_exp["mni"]["100"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_exp["mni"][1]["100"]["frq"] +
|
||||||
|
all_data_exp["mni"][2]["100"]["frq"] +
|
||||||
|
all_data_exp["mni"][3]["100"]["frq"] +
|
||||||
|
all_data_exp["mni"][4]["100"]["frq"] +
|
||||||
|
all_data_exp["mni"][5]["100"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_exp["mni"]["100"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_exp["mni"][1]["100"]["bay"] +
|
||||||
|
all_data_exp["mni"][2]["100"]["bay"] +
|
||||||
|
all_data_exp["mni"][3]["100"]["bay"] +
|
||||||
|
all_data_exp["mni"][4]["100"]["bay"] +
|
||||||
|
all_data_exp["mni"][5]["100"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
comp_exp["cif"]["100"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_exp["cif"][1]["100"]["frq"] +
|
||||||
|
all_data_exp["cif"][2]["100"]["frq"] +
|
||||||
|
all_data_exp["cif"][3]["100"]["frq"] +
|
||||||
|
all_data_exp["cif"][4]["100"]["frq"] +
|
||||||
|
all_data_exp["cif"][5]["100"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_exp["cif"]["100"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_exp["cif"][1]["100"]["bay"] +
|
||||||
|
all_data_exp["cif"][2]["100"]["bay"] +
|
||||||
|
all_data_exp["cif"][3]["100"]["bay"] +
|
||||||
|
all_data_exp["cif"][4]["100"]["bay"] +
|
||||||
|
all_data_exp["cif"][5]["100"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
|
||||||
|
comp_exp["mni"]["acc"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_exp["mni"][1]["acc"]["frq"] +
|
||||||
|
all_data_exp["mni"][2]["acc"]["frq"] +
|
||||||
|
all_data_exp["mni"][3]["acc"]["frq"] +
|
||||||
|
all_data_exp["mni"][4]["acc"]["frq"] +
|
||||||
|
all_data_exp["mni"][5]["acc"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_exp["mni"]["acc"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_exp["mni"][1]["acc"]["bay"] +
|
||||||
|
all_data_exp["mni"][2]["acc"]["bay"] +
|
||||||
|
all_data_exp["mni"][3]["acc"]["bay"] +
|
||||||
|
all_data_exp["mni"][4]["acc"]["bay"] +
|
||||||
|
all_data_exp["mni"][5]["acc"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
comp_exp["cif"]["acc"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_exp["cif"][1]["acc"]["frq"] +
|
||||||
|
all_data_exp["cif"][2]["acc"]["frq"] +
|
||||||
|
all_data_exp["cif"][3]["acc"]["frq"] +
|
||||||
|
all_data_exp["cif"][4]["acc"]["frq"] +
|
||||||
|
all_data_exp["cif"][5]["acc"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_exp["cif"]["acc"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_exp["cif"][1]["acc"]["bay"] +
|
||||||
|
all_data_exp["cif"][2]["acc"]["bay"] +
|
||||||
|
all_data_exp["cif"][3]["acc"]["bay"] +
|
||||||
|
all_data_exp["cif"][4]["acc"]["bay"] +
|
||||||
|
all_data_exp["cif"][5]["acc"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
comp_exp["mni"]["wat"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_exp["mni"][1]["wat"]["frq"] +
|
||||||
|
all_data_exp["mni"][2]["wat"]["frq"] +
|
||||||
|
all_data_exp["mni"][3]["wat"]["frq"] +
|
||||||
|
all_data_exp["mni"][4]["wat"]["frq"] +
|
||||||
|
all_data_exp["mni"][5]["wat"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_exp["mni"]["wat"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_exp["mni"][1]["wat"]["bay"] +
|
||||||
|
all_data_exp["mni"][2]["wat"]["bay"] +
|
||||||
|
all_data_exp["mni"][3]["wat"]["bay"] +
|
||||||
|
all_data_exp["mni"][4]["wat"]["bay"] +
|
||||||
|
all_data_exp["mni"][5]["wat"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
comp_exp["cif"]["wat"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_exp["cif"][1]["wat"]["frq"] +
|
||||||
|
all_data_exp["cif"][2]["wat"]["frq"] +
|
||||||
|
all_data_exp["cif"][3]["wat"]["frq"] +
|
||||||
|
all_data_exp["cif"][4]["wat"]["frq"] +
|
||||||
|
all_data_exp["cif"][5]["wat"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_exp["cif"]["wat"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_exp["cif"][1]["wat"]["bay"] +
|
||||||
|
all_data_exp["cif"][2]["wat"]["bay"] +
|
||||||
|
all_data_exp["cif"][3]["wat"]["bay"] +
|
||||||
|
all_data_exp["cif"][4]["wat"]["bay"] +
|
||||||
|
all_data_exp["cif"][5]["wat"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
|
||||||
|
comp_exp["mni"]["est"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_exp["mni"][1]["est"]["frq"] +
|
||||||
|
all_data_exp["mni"][2]["est"]["frq"] +
|
||||||
|
all_data_exp["mni"][3]["est"]["frq"] +
|
||||||
|
all_data_exp["mni"][4]["est"]["frq"] +
|
||||||
|
all_data_exp["mni"][5]["est"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_exp["mni"]["est"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_exp["mni"][1]["est"]["bay"] +
|
||||||
|
all_data_exp["mni"][2]["est"]["bay"] +
|
||||||
|
all_data_exp["mni"][3]["est"]["bay"] +
|
||||||
|
all_data_exp["mni"][4]["est"]["bay"] +
|
||||||
|
all_data_exp["mni"][5]["est"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
comp_exp["cif"]["est"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_exp["cif"][1]["est"]["frq"] +
|
||||||
|
all_data_exp["cif"][2]["est"]["frq"] +
|
||||||
|
all_data_exp["cif"][3]["est"]["frq"] +
|
||||||
|
all_data_exp["cif"][4]["est"]["frq"] +
|
||||||
|
all_data_exp["cif"][5]["est"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_exp["cif"]["est"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_exp["cif"][1]["est"]["bay"] +
|
||||||
|
all_data_exp["cif"][2]["est"]["bay"] +
|
||||||
|
all_data_exp["cif"][3]["est"]["bay"] +
|
||||||
|
all_data_exp["cif"][4]["est"]["bay"] +
|
||||||
|
all_data_exp["cif"][5]["est"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
# Energy means
|
||||||
|
=#
|
||||||
|
|
||||||
|
comp_ene = Dict(
|
||||||
|
"mni" => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
"cif" => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
comp_ene["mni"]["100"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_ene["mni"][1]["100"]["frq"] +
|
||||||
|
all_data_ene["mni"][2]["100"]["frq"] +
|
||||||
|
all_data_ene["mni"][3]["100"]["frq"] +
|
||||||
|
all_data_ene["mni"][4]["100"]["frq"] +
|
||||||
|
all_data_ene["mni"][5]["100"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_ene["mni"]["100"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_ene["mni"][1]["100"]["bay"] +
|
||||||
|
all_data_ene["mni"][2]["100"]["bay"] +
|
||||||
|
all_data_ene["mni"][3]["100"]["bay"] +
|
||||||
|
all_data_ene["mni"][4]["100"]["bay"] +
|
||||||
|
all_data_ene["mni"][5]["100"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
comp_ene["cif"]["100"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_ene["cif"][1]["100"]["frq"] +
|
||||||
|
all_data_ene["cif"][2]["100"]["frq"] +
|
||||||
|
all_data_ene["cif"][3]["100"]["frq"] +
|
||||||
|
all_data_ene["cif"][4]["100"]["frq"] +
|
||||||
|
all_data_ene["cif"][5]["100"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_ene["cif"]["100"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_ene["cif"][1]["100"]["bay"] +
|
||||||
|
all_data_ene["cif"][2]["100"]["bay"] +
|
||||||
|
all_data_ene["cif"][3]["100"]["bay"] +
|
||||||
|
all_data_ene["cif"][4]["100"]["bay"] +
|
||||||
|
all_data_ene["cif"][5]["100"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
|
||||||
|
comp_ene["mni"]["acc"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_ene["mni"][1]["acc"]["frq"] +
|
||||||
|
all_data_ene["mni"][2]["acc"]["frq"] +
|
||||||
|
all_data_ene["mni"][3]["acc"]["frq"] +
|
||||||
|
all_data_ene["mni"][4]["acc"]["frq"] +
|
||||||
|
all_data_ene["mni"][5]["acc"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_ene["mni"]["acc"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_ene["mni"][1]["acc"]["bay"] +
|
||||||
|
all_data_ene["mni"][2]["acc"]["bay"] +
|
||||||
|
all_data_ene["mni"][3]["acc"]["bay"] +
|
||||||
|
all_data_ene["mni"][4]["acc"]["bay"] +
|
||||||
|
all_data_ene["mni"][5]["acc"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
comp_ene["cif"]["acc"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_ene["cif"][1]["acc"]["frq"] +
|
||||||
|
all_data_ene["cif"][2]["acc"]["frq"] +
|
||||||
|
all_data_ene["cif"][3]["acc"]["frq"] +
|
||||||
|
all_data_ene["cif"][4]["acc"]["frq"] +
|
||||||
|
all_data_ene["cif"][5]["acc"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_ene["cif"]["acc"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_ene["cif"][1]["acc"]["bay"] +
|
||||||
|
all_data_ene["cif"][2]["acc"]["bay"] +
|
||||||
|
all_data_ene["cif"][3]["acc"]["bay"] +
|
||||||
|
all_data_ene["cif"][4]["acc"]["bay"] +
|
||||||
|
all_data_ene["cif"][5]["acc"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
comp_ene["mni"]["wat"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_ene["mni"][1]["wat"]["frq"] +
|
||||||
|
all_data_ene["mni"][2]["wat"]["frq"] +
|
||||||
|
all_data_ene["mni"][3]["wat"]["frq"] +
|
||||||
|
all_data_ene["mni"][4]["wat"]["frq"] +
|
||||||
|
all_data_ene["mni"][5]["wat"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_ene["mni"]["wat"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_ene["mni"][1]["wat"]["bay"] +
|
||||||
|
all_data_ene["mni"][2]["wat"]["bay"] +
|
||||||
|
all_data_ene["mni"][3]["wat"]["bay"] +
|
||||||
|
all_data_ene["mni"][4]["wat"]["bay"] +
|
||||||
|
all_data_ene["mni"][5]["wat"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
comp_ene["cif"]["wat"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_ene["cif"][1]["wat"]["frq"] +
|
||||||
|
all_data_ene["cif"][2]["wat"]["frq"] +
|
||||||
|
all_data_ene["cif"][3]["wat"]["frq"] +
|
||||||
|
all_data_ene["cif"][4]["wat"]["frq"] +
|
||||||
|
all_data_ene["cif"][5]["wat"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_ene["cif"]["wat"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_ene["cif"][1]["wat"]["bay"] +
|
||||||
|
all_data_ene["cif"][2]["wat"]["bay"] +
|
||||||
|
all_data_ene["cif"][3]["wat"]["bay"] +
|
||||||
|
all_data_ene["cif"][4]["wat"]["bay"] +
|
||||||
|
all_data_ene["cif"][5]["wat"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
|
||||||
|
comp_ene["mni"]["est"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_ene["mni"][1]["est"]["frq"] +
|
||||||
|
all_data_ene["mni"][2]["est"]["frq"] +
|
||||||
|
all_data_ene["mni"][3]["est"]["frq"] +
|
||||||
|
all_data_ene["mni"][4]["est"]["frq"] +
|
||||||
|
all_data_ene["mni"][5]["est"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_ene["mni"]["est"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_ene["mni"][1]["est"]["bay"] +
|
||||||
|
all_data_ene["mni"][2]["est"]["bay"] +
|
||||||
|
all_data_ene["mni"][3]["est"]["bay"] +
|
||||||
|
all_data_ene["mni"][4]["est"]["bay"] +
|
||||||
|
all_data_ene["mni"][5]["est"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
comp_ene["cif"]["est"]["frq"] =
|
||||||
|
(
|
||||||
|
all_data_ene["cif"][1]["est"]["frq"] +
|
||||||
|
all_data_ene["cif"][2]["est"]["frq"] +
|
||||||
|
all_data_ene["cif"][3]["est"]["frq"] +
|
||||||
|
all_data_ene["cif"][4]["est"]["frq"] +
|
||||||
|
all_data_ene["cif"][5]["est"]["frq"]
|
||||||
|
) / 5
|
||||||
|
comp_ene["cif"]["est"]["bay"] =
|
||||||
|
(
|
||||||
|
all_data_ene["cif"][1]["est"]["bay"] +
|
||||||
|
all_data_ene["cif"][2]["est"]["bay"] +
|
||||||
|
all_data_ene["cif"][3]["est"]["bay"] +
|
||||||
|
all_data_ene["cif"][4]["est"]["bay"] +
|
||||||
|
all_data_ene["cif"][5]["est"]["bay"]
|
||||||
|
) / 5
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Final Metric per experiment
|
||||||
|
=#
|
||||||
|
|
||||||
|
println(
|
||||||
|
"MNIST LeNet 100, Accuracy: $(comp_exp["mni"]["100"]["frq"]), Energy: $(comp_ene["mni"]["100"]["frq"]), Ratio: $((comp_exp["mni"]["100"]["frq"] / comp_ene["mni"]["100"]["frq"]) * 100)",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"MNIST Bayes 100, Accuracy: $(comp_exp["mni"]["100"]["bay"]), Energy: $(comp_ene["mni"]["100"]["bay"]), Ratio: $((comp_exp["mni"]["100"]["bay"] / comp_ene["mni"]["100"]["bay"]) * 100)",
|
||||||
|
)
|
||||||
|
|
||||||
|
println(
|
||||||
|
"CIFAR LeNet 100, Accuracy: $(comp_exp["cif"]["100"]["frq"]), Energy: $(comp_ene["cif"]["100"]["frq"]), Ratio: $((comp_exp["cif"]["100"]["frq"] / comp_ene["cif"]["100"]["frq"]) * 100)",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes 100, Accuracy: $(comp_exp["cif"]["100"]["bay"]), Energy: $(comp_ene["cif"]["100"]["bay"]), Ratio: $((comp_exp["cif"]["100"]["bay"] / comp_ene["cif"]["100"]["bay"]) * 100)",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
println(
|
||||||
|
"MNIST LeNet Acc, Accuracy: $(comp_exp["mni"]["acc"]["frq"]), Energy: $(comp_ene["mni"]["acc"]["frq"]), Ratio: $((comp_exp["mni"]["acc"]["frq"] / comp_ene["mni"]["acc"]["frq"]) * 100)",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Acc, Accuracy: $(comp_exp["mni"]["acc"]["bay"]), Energy: $(comp_ene["mni"]["acc"]["bay"]), Ratio: $((comp_exp["mni"]["acc"]["bay"] / comp_ene["mni"]["acc"]["bay"]) * 100)",
|
||||||
|
)
|
||||||
|
|
||||||
|
println(
|
||||||
|
"CIFAR LeNet Acc, Accuracy: $(comp_exp["cif"]["acc"]["frq"]), Energy: $(comp_ene["cif"]["acc"]["frq"]), Ratio: $((comp_exp["cif"]["acc"]["frq"] / comp_ene["cif"]["acc"]["frq"]) * 100)",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Acc, Accuracy: $(comp_exp["cif"]["acc"]["bay"]), Energy: $(comp_ene["cif"]["acc"]["bay"]), Ratio: $((comp_exp["cif"]["acc"]["bay"] / comp_ene["cif"]["acc"]["bay"]) * 100)",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
println(
|
||||||
|
"MNIST LeNet Wat, Accuracy: $(comp_exp["mni"]["wat"]["frq"]), Energy: $(comp_ene["mni"]["wat"]["frq"]), Ratio: $((comp_exp["mni"]["wat"]["frq"] / comp_ene["mni"]["wat"]["frq"]) * 100)",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Wat, Accuracy: $(comp_exp["mni"]["wat"]["bay"]), Energy: $(comp_ene["mni"]["wat"]["bay"]), Ratio: $((comp_exp["mni"]["wat"]["bay"] / comp_ene["mni"]["wat"]["bay"]) * 100)",
|
||||||
|
)
|
||||||
|
|
||||||
|
println(
|
||||||
|
"CIFAR LeNet Wat, Accuracy: $(comp_exp["cif"]["wat"]["frq"]), Energy: $(comp_ene["cif"]["wat"]["frq"]), Ratio: $((comp_exp["cif"]["wat"]["frq"] / comp_ene["cif"]["wat"]["frq"]) * 100)",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Wat, Accuracy: $(comp_exp["cif"]["wat"]["bay"]), Energy: $(comp_ene["cif"]["wat"]["bay"]), Ratio: $((comp_exp["cif"]["wat"]["bay"] / comp_ene["cif"]["wat"]["bay"]) * 100)",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
println(
|
||||||
|
"MNIST LeNet Est, Accuracy: $(comp_exp["mni"]["est"]["frq"]), Energy: $(comp_ene["mni"]["est"]["frq"]), Ratio: $((comp_exp["mni"]["est"]["frq"] / comp_ene["mni"]["est"]["frq"]) * 100)",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Est, Accuracy: $(comp_exp["mni"]["est"]["bay"]), Energy: $(comp_ene["mni"]["est"]["bay"]), Ratio: $((comp_exp["mni"]["est"]["bay"] / comp_ene["mni"]["est"]["bay"]) * 100)",
|
||||||
|
)
|
||||||
|
|
||||||
|
println(
|
||||||
|
"CIFAR LeNet Est, Accuracy: $(comp_exp["cif"]["est"]["frq"]), Energy: $(comp_ene["cif"]["est"]["frq"]), Ratio: $((comp_exp["cif"]["est"]["frq"] / comp_ene["cif"]["est"]["frq"]) * 100)",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Est, Accuracy: $(comp_exp["cif"]["est"]["bay"]), Energy: $(comp_ene["cif"]["est"]["bay"]), Ratio: $((comp_exp["cif"]["est"]["bay"] / comp_ene["cif"]["est"]["bay"]) * 100)",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Final Metric
|
||||||
|
=#
|
||||||
|
|
||||||
|
mni_tot_frq_exp =
|
||||||
|
(
|
||||||
|
comp_exp["mni"]["100"]["frq"] +
|
||||||
|
comp_exp["mni"]["acc"]["frq"] +
|
||||||
|
comp_exp["mni"]["wat"]["frq"] +
|
||||||
|
comp_exp["mni"]["est"]["frq"]
|
||||||
|
) / 4
|
||||||
|
|
||||||
|
mni_tot_bay_exp =
|
||||||
|
(
|
||||||
|
comp_exp["mni"]["100"]["bay"] +
|
||||||
|
comp_exp["mni"]["acc"]["bay"] +
|
||||||
|
comp_exp["mni"]["wat"]["bay"] +
|
||||||
|
comp_exp["mni"]["est"]["bay"]
|
||||||
|
) / 4
|
||||||
|
|
||||||
|
|
||||||
|
cif_tot_frq_exp =
|
||||||
|
(
|
||||||
|
comp_exp["cif"]["100"]["frq"] +
|
||||||
|
comp_exp["cif"]["acc"]["frq"] +
|
||||||
|
comp_exp["cif"]["wat"]["frq"] +
|
||||||
|
comp_exp["cif"]["est"]["frq"]
|
||||||
|
) / 4
|
||||||
|
|
||||||
|
cif_tot_bay_exp =
|
||||||
|
(
|
||||||
|
comp_exp["cif"]["100"]["bay"] +
|
||||||
|
comp_exp["cif"]["acc"]["bay"] +
|
||||||
|
comp_exp["cif"]["wat"]["bay"] +
|
||||||
|
comp_exp["cif"]["est"]["bay"]
|
||||||
|
) / 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
mni_tot_frq_ene =
|
||||||
|
(
|
||||||
|
comp_ene["mni"]["100"]["frq"] +
|
||||||
|
comp_ene["mni"]["acc"]["frq"] +
|
||||||
|
comp_ene["mni"]["wat"]["frq"] +
|
||||||
|
comp_ene["mni"]["est"]["frq"]
|
||||||
|
) / 4
|
||||||
|
|
||||||
|
mni_tot_bay_ene =
|
||||||
|
(
|
||||||
|
comp_ene["mni"]["100"]["bay"] +
|
||||||
|
comp_ene["mni"]["acc"]["bay"] +
|
||||||
|
comp_ene["mni"]["wat"]["bay"] +
|
||||||
|
comp_ene["mni"]["est"]["bay"]
|
||||||
|
) / 4
|
||||||
|
|
||||||
|
|
||||||
|
cif_tot_frq_ene =
|
||||||
|
(
|
||||||
|
comp_ene["cif"]["100"]["frq"] +
|
||||||
|
comp_ene["cif"]["acc"]["frq"] +
|
||||||
|
comp_ene["cif"]["wat"]["frq"] +
|
||||||
|
comp_ene["cif"]["est"]["frq"]
|
||||||
|
) / 4
|
||||||
|
|
||||||
|
cif_tot_bay_ene =
|
||||||
|
(
|
||||||
|
comp_ene["cif"]["100"]["bay"] +
|
||||||
|
comp_ene["cif"]["acc"]["bay"] +
|
||||||
|
comp_ene["cif"]["wat"]["bay"] +
|
||||||
|
comp_ene["cif"]["est"]["bay"]
|
||||||
|
) / 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
println("LeNet-5 on MNIST Efficiency Metric: $((mni_tot_frq_exp * 100) / mni_tot_frq_ene)")
|
||||||
|
println("LeNet-5 on CIFAR Efficiency Metric: $((cif_tot_frq_exp * 100) / cif_tot_frq_ene)")
|
||||||
|
|
||||||
|
println("BCNN on MNIST Efficiency Metric: $((mni_tot_bay_exp * 100) / mni_tot_bay_ene)")
|
||||||
|
println("BCNN on CIFAR Efficiency Metric: $((cif_tot_bay_exp * 100) / cif_tot_bay_ene)")
|
|
@ -0,0 +1,508 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
using Random
|
||||||
|
|
||||||
|
#=
|
||||||
|
Obtain energy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
#mni_folder_1 = "ini_exp_data/"
|
||||||
|
|
||||||
|
|
||||||
|
mni_folder_100 = "exp_100_epochs/";
|
||||||
|
cif_folder_100 = "CIFAR_100_epoch/";
|
||||||
|
|
||||||
|
mni_folder_acc = "data_bounded/";
|
||||||
|
cif_folder_acc = "CIFAR_acc_bound/";
|
||||||
|
|
||||||
|
mni_folder_wat = "data_budget/";
|
||||||
|
cif_folder_wat = "CIFAR_energy_bound/";
|
||||||
|
|
||||||
|
mni_folder_est = "early_stop_res/";
|
||||||
|
cif_folder_est = "CIFAR_early_stop/";
|
||||||
|
|
||||||
|
bayes_model = "bayes";
|
||||||
|
freq_model = "freq";
|
||||||
|
w_type = "watt";
|
||||||
|
e_type = "exp";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load GPU data
|
||||||
|
=#
|
||||||
|
mni_100_bay_ene = getgpudata(mni_folder_100, bayes_model, w_type, "eo");
|
||||||
|
mni_100_fre_ene = getgpudata(mni_folder_100, freq_model, w_type, "eo");
|
||||||
|
cif_100_bay_ene = getgpudata(cif_folder_100, bayes_model, w_type, "eo");
|
||||||
|
cif_100_fre_ene = getgpudata(cif_folder_100, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Define CPU paths
|
||||||
|
=#
|
||||||
|
cif = "cifar";
|
||||||
|
mni = "mnist";
|
||||||
|
bay = "bayes";
|
||||||
|
wat = "cpu_watts";
|
||||||
|
frq = "freq";
|
||||||
|
ram = "ram_use";
|
||||||
|
_100 = "100";
|
||||||
|
acc = "acc";
|
||||||
|
es = "es";
|
||||||
|
wbud = "wbud";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load CPU data
|
||||||
|
=#
|
||||||
|
bay_cif_100_ene = readcpudata(cif, bay, wat, _100);
|
||||||
|
bay_mni_100_ene = readcpudata(mni, bay, wat, _100);
|
||||||
|
frq_cif_100_ene = readcpudata(cif, frq, wat, _100);
|
||||||
|
frq_mni_100_ene = readcpudata(mni, frq, wat, _100);
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
bay_cif_100_ene[s] = round.(getcpuwatt(bay_cif_100_ene[s]))
|
||||||
|
bay_mni_100_ene[s] = round.(getcpuwatt(bay_mni_100_ene[s]))
|
||||||
|
frq_cif_100_ene[s] = round.(getcpuwatt(frq_cif_100_ene[s]))
|
||||||
|
frq_mni_100_ene[s] = round.(getcpuwatt(frq_mni_100_ene[s]))
|
||||||
|
end
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
mni_100_bay_ene[s]["Ene"] = vcat(mni_100_bay_ene[s]["Ene"], bay_mni_100_ene[s])
|
||||||
|
mni_100_fre_ene[s]["Ene"] = vcat(mni_100_fre_ene[s]["Ene"], frq_mni_100_ene[s])
|
||||||
|
cif_100_bay_ene[s]["Ene"] = vcat(cif_100_bay_ene[s]["Ene"], bay_cif_100_ene[s])
|
||||||
|
cif_100_fre_ene[s]["Ene"] = vcat(cif_100_fre_ene[s]["Ene"], frq_cif_100_ene[s])
|
||||||
|
end
|
||||||
|
|
||||||
|
ene_data = Dict("mni" => Dict("bay" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"fre" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])),
|
||||||
|
"cif" => Dict("bay" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"fre" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])))
|
||||||
|
|
||||||
|
#ene_data = Dict("mni" => Dict("bay" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
# "fre" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)),
|
||||||
|
# "cif" => Dict("bay" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
# "fre" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)))
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
ene_data["mni"]["bay"][s] = sum.(join_vectors(resize1(makechunks(shuffle(mni_100_bay_ene[s]["Ene"]), 100))))
|
||||||
|
ene_data["mni"]["fre"][s] = sum.(join_vectors(resize1(makechunks(shuffle(mni_100_fre_ene[s]["Ene"]), 100))))
|
||||||
|
ene_data["cif"]["bay"][s] = sum.(join_vectors(resize1(makechunks(shuffle(cif_100_bay_ene[s]["Ene"]), 100))))
|
||||||
|
ene_data["cif"]["fre"][s] = sum.(join_vectors(resize1(makechunks(shuffle(cif_100_fre_ene[s]["Ene"]), 100))))
|
||||||
|
end
|
||||||
|
|
||||||
|
#for s = 1:5
|
||||||
|
# ene_data["mni"]["bay"][s] = sum(mni_100_bay_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["mni"]["fre"][s] = sum(mni_100_fre_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["cif"]["bay"][s] = sum(cif_100_bay_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["cif"]["fre"][s] = sum(cif_100_fre_ene[s]["Ene"]) / 100
|
||||||
|
#end
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load Accuracy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
mni_100_bay_exp = getgpudata(mni_folder_100, bayes_model, e_type, "eo");
|
||||||
|
mni_100_fre_exp = getgpudata(mni_folder_100, freq_model, e_type, "eo");
|
||||||
|
cif_100_bay_exp = getgpudata(cif_folder_100, bayes_model, e_type, "eo");
|
||||||
|
cif_100_fre_exp = getgpudata(cif_folder_100, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1:5
|
||||||
|
mni_100_bay_exp[i] = expdatatodict(mni_100_bay_exp[i])
|
||||||
|
mni_100_fre_exp[i] = expdatatodict(mni_100_fre_exp[i])
|
||||||
|
cif_100_bay_exp[i] = expdatatodict(cif_100_bay_exp[i])
|
||||||
|
cif_100_fre_exp[i] = expdatatodict(cif_100_fre_exp[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
original_vectors = Dict("LeNet" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])),
|
||||||
|
"BCNN" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])))
|
||||||
|
|
||||||
|
#=
|
||||||
|
delta_vectors = Dict("LeNet" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])),
|
||||||
|
"BCNN" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])))
|
||||||
|
|
||||||
|
delta2_vectors = Dict("LeNet" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])),
|
||||||
|
"BCNN" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])))
|
||||||
|
=#
|
||||||
|
|
||||||
|
delta_values = Dict("LeNet" => Dict("MNIST" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
"CIFAR" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)),
|
||||||
|
"BCNN" => Dict("MNIST" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
"CIFAR" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)))
|
||||||
|
|
||||||
|
|
||||||
|
for i in 1:5
|
||||||
|
original_vectors["LeNet"]["MNIST"][i] = (mni_100_fre_exp[i]["acc"] ./ ene_data["mni"]["fre"][i]) * 100
|
||||||
|
original_vectors["BCNN"]["MNIST"][i] = (mni_100_bay_exp[i]["acc"] ./ ene_data["mni"]["bay"][i]) * 100
|
||||||
|
original_vectors["LeNet"]["CIFAR"][i] = (cif_100_fre_exp[i]["acc"] ./ ene_data["cif"]["fre"][i]) * 100
|
||||||
|
original_vectors["BCNN"]["CIFAR"][i] = (cif_100_bay_exp[i]["acc"] ./ ene_data["cif"]["bay"][i]) * 100
|
||||||
|
end
|
||||||
|
|
||||||
|
for i in 1:5
|
||||||
|
delta_values["LeNet"]["MNIST"][i] = mean(approx_δ(original_vectors["LeNet"]["MNIST"][i]))
|
||||||
|
delta_values["BCNN"]["MNIST"][i] = mean(approx_δ(original_vectors["BCNN"]["MNIST"][i]))
|
||||||
|
delta_values["LeNet"]["CIFAR"][i] = mean(approx_δ(original_vectors["LeNet"]["CIFAR"][i]))
|
||||||
|
delta_values["BCNN"]["CIFAR"][i] = mean(approx_δ(original_vectors["BCNN"]["CIFAR"][i]))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
lenet_mnist = zeros(5)
|
||||||
|
bcnn_mnist = zeros(5)
|
||||||
|
|
||||||
|
lenet_cifar = zeros(5)
|
||||||
|
bcnn_cifar = zeros(5)
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
for i in 1:5
|
||||||
|
println("LeNet MNIST Size $(i): $(delta_values["LeNet"]["MNIST"][i])")
|
||||||
|
println("BCNN MNIST Size $(i): $(delta_values["BCNN"]["MNIST"][i])")
|
||||||
|
println("LeNet CIFAR Size $(i): $(delta_values["LeNet"]["CIFAR"][i])")
|
||||||
|
println("BCNN CIFAR Size $(i): $(delta_values["BCNN"]["CIFAR"][i])")
|
||||||
|
end
|
||||||
|
=#
|
||||||
|
|
||||||
|
for i in 1:5
|
||||||
|
lenet_mnist[i] = delta_values["LeNet"]["MNIST"][i]
|
||||||
|
bcnn_mnist[i] = delta_values["BCNN"]["MNIST"][i]
|
||||||
|
lenet_cifar[i] = delta_values["LeNet"]["CIFAR"][i]
|
||||||
|
bcnn_cifar[i] = delta_values["BCNN"]["CIFAR"][i]
|
||||||
|
end
|
||||||
|
|
||||||
|
println("MNIST LeNet Δ: $(mean(lenet_mnist))")
|
||||||
|
println("MNIST BCNN Δ: $(mean(bcnn_mnist))")
|
||||||
|
println("CIFAR LeNet Δ: $(mean(lenet_cifar))")
|
||||||
|
println("CIFAR BCNN Δ: $(mean(bcnn_cifar))")
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["LeNet"]["MNIST"][1],
|
||||||
|
name = "LeNet 1 MNIST",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["LeNet"]["MNIST"][2],
|
||||||
|
name = "LeNet 2 MNIST",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["LeNet"]["MNIST"][3],
|
||||||
|
name = "LeNet 3 MNIST",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["LeNet"]["MNIST"][4],
|
||||||
|
name = "LeNet 4 MNIST",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["LeNet"]["MNIST"][5],
|
||||||
|
name = "LeNet 5 MNIST",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(255,195,001)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["LeNet"]["CIFAR"][1],
|
||||||
|
name = "LeNet 1 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["LeNet"]["CIFAR"][2],
|
||||||
|
name = "LeNet 2 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,094,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["LeNet"]["CIFAR"][3],
|
||||||
|
name = "LeNet 3 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,126,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["LeNet"]["CIFAR"][4],
|
||||||
|
name = "LeNet 4 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,150,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["LeNet"]["CIFAR"][5],
|
||||||
|
name = "LeNet 5 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,167,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "ΔEfficency",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
opacity = 0.9,
|
||||||
|
xaxis_range = [0, 20],
|
||||||
|
#xaxis_range = [-1, 5],
|
||||||
|
#xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "lenet_dE_epoch.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["BCNN"]["MNIST"][1],
|
||||||
|
name = "BCNN 1 MNIST",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["BCNN"]["MNIST"][2],
|
||||||
|
name = "BCNN 2 MNIST",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["BCNN"]["MNIST"][3],
|
||||||
|
name = "BCNN 3 MNIST",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["BCNN"]["MNIST"][4],
|
||||||
|
name = "BCNN 4 MNIST",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["BCNN"]["MNIST"][5],
|
||||||
|
name = "BCNN 5 MNIST",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(255,195,001)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["BCNN"]["CIFAR"][1],
|
||||||
|
name = "BCNN 1 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["BCNN"]["CIFAR"][2],
|
||||||
|
name = "BCNN 2 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,094,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["BCNN"]["CIFAR"][3],
|
||||||
|
name = "BCNN 3 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,126,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["BCNN"]["CIFAR"][4],
|
||||||
|
name = "BCNN 4 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,150,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta_vectors["BCNN"]["CIFAR"][5],
|
||||||
|
name = "BCNN 5 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,167,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "ΔEfficency",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
opacity = 0.9,
|
||||||
|
xaxis_range = [0, 20],
|
||||||
|
#xaxis_range = [-1, 5],
|
||||||
|
#xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "bcnn_dE_epoch.png")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["LeNet"]["MNIST"][1],
|
||||||
|
name = "LeNet 1 MNIST",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["LeNet"]["MNIST"][2],
|
||||||
|
name = "LeNet 2 MNIST",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["LeNet"]["MNIST"][3],
|
||||||
|
name = "LeNet 3 MNIST",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["LeNet"]["MNIST"][4],
|
||||||
|
name = "LeNet 4 MNIST",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["LeNet"]["MNIST"][5],
|
||||||
|
name = "LeNet 5 MNIST",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(255,195,001)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["LeNet"]["CIFAR"][1],
|
||||||
|
name = "LeNet 1 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["LeNet"]["CIFAR"][2],
|
||||||
|
name = "LeNet 2 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,094,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["LeNet"]["CIFAR"][3],
|
||||||
|
name = "LeNet 3 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,126,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["LeNet"]["CIFAR"][4],
|
||||||
|
name = "LeNet 4 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,150,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["LeNet"]["CIFAR"][5],
|
||||||
|
name = "LeNet 5 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,167,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "ΔΔEfficency",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
opacity = 0.9,
|
||||||
|
xaxis_range = [0, 20],
|
||||||
|
#xaxis_range = [-1, 5],
|
||||||
|
#xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "lenet_ddE_epoch.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["BCNN"]["MNIST"][1],
|
||||||
|
name = "BCNN 1 MNIST",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["BCNN"]["MNIST"][2],
|
||||||
|
name = "BCNN 2 MNIST",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["BCNN"]["MNIST"][3],
|
||||||
|
name = "BCNN 3 MNIST",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["BCNN"]["MNIST"][4],
|
||||||
|
name = "BCNN 4 MNIST",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["BCNN"]["MNIST"][5],
|
||||||
|
name = "BCNN 5 MNIST",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(255,195,001)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["BCNN"]["CIFAR"][1],
|
||||||
|
name = "BCNN 1 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["BCNN"]["CIFAR"][2],
|
||||||
|
name = "BCNN 2 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,094,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["BCNN"]["CIFAR"][3],
|
||||||
|
name = "BCNN 3 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,126,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["BCNN"]["CIFAR"][4],
|
||||||
|
name = "BCNN 4 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,150,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = delta2_vectors["BCNN"]["CIFAR"][5],
|
||||||
|
name = "BCNN 5 CIFAR",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,167,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "ΔΔEfficency",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
opacity = 0.9,
|
||||||
|
xaxis_range = [0, 20],
|
||||||
|
#xaxis_range = [-1, 5],
|
||||||
|
#xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "bcnn_ddE_epoch.png")
|
||||||
|
=#
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,399 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using LinearAlgebra
|
||||||
|
using Statistics
|
||||||
|
using DataFrames
|
||||||
|
using Latexify
|
||||||
|
|
||||||
|
#=
|
||||||
|
Obtain energy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
#mni_folder_1 = "ini_exp_data/"
|
||||||
|
|
||||||
|
|
||||||
|
mni_folder_100 = "exp_100_epochs/";
|
||||||
|
cif_folder_100 = "CIFAR_100_epoch/";
|
||||||
|
|
||||||
|
mni_folder_acc = "data_bounded/";
|
||||||
|
cif_folder_acc = "CIFAR_acc_bound/";
|
||||||
|
|
||||||
|
mni_folder_wat = "data_budget/";
|
||||||
|
cif_folder_wat = "CIFAR_energy_bound/";
|
||||||
|
|
||||||
|
mni_folder_est = "early_stop_res/";
|
||||||
|
cif_folder_est = "CIFAR_early_stop/";
|
||||||
|
|
||||||
|
bayes_model = "bayes";
|
||||||
|
freq_model = "freq";
|
||||||
|
w_type = "watt";
|
||||||
|
e_type = "exp";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load GPU data
|
||||||
|
=#
|
||||||
|
mni_100_bay_ene = getgpudata(mni_folder_100, bayes_model, w_type, "eo");
|
||||||
|
mni_100_fre_ene = getgpudata(mni_folder_100, freq_model, w_type, "eo");
|
||||||
|
cif_100_bay_ene = getgpudata(cif_folder_100, bayes_model, w_type, "eo");
|
||||||
|
cif_100_fre_ene = getgpudata(cif_folder_100, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_acc_bay_ene = getgpudata(mni_folder_acc, bayes_model, w_type, "eo");
|
||||||
|
mni_acc_fre_ene = getgpudata(mni_folder_acc, freq_model, w_type, "eo");
|
||||||
|
cif_acc_bay_ene = getgpudata(cif_folder_acc, bayes_model, w_type, "eo");
|
||||||
|
cif_acc_fre_ene = getgpudata(cif_folder_acc, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_wat_bay_ene = getgpudata(mni_folder_wat, bayes_model, w_type, "eo");
|
||||||
|
mni_wat_fre_ene = getgpudata(mni_folder_wat, freq_model, w_type, "eo");
|
||||||
|
cif_wat_bay_ene = getgpudata(cif_folder_wat, bayes_model, w_type, "eo");
|
||||||
|
cif_wat_fre_ene = getgpudata(cif_folder_wat, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_est_bay_ene = getgpudata(mni_folder_est, bayes_model, w_type, "eo");
|
||||||
|
mni_est_fre_ene = getgpudata(mni_folder_est, freq_model, w_type, "eo");
|
||||||
|
cif_est_bay_ene = getgpudata(cif_folder_est, bayes_model, w_type, "eo");
|
||||||
|
cif_est_fre_ene = getgpudata(cif_folder_est, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Define CPU paths
|
||||||
|
=#
|
||||||
|
cif = "cifar";
|
||||||
|
mni = "mnist";
|
||||||
|
bay = "bayes";
|
||||||
|
wat = "cpu_watts";
|
||||||
|
frq = "freq";
|
||||||
|
ram = "ram_use";
|
||||||
|
_100 = "100";
|
||||||
|
acc = "acc";
|
||||||
|
es = "es";
|
||||||
|
wbud = "wbud";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load CPU data
|
||||||
|
=#
|
||||||
|
bay_cif_100_ene = readcpudata(cif, bay, wat, _100);
|
||||||
|
bay_mni_100_ene = readcpudata(mni, bay, wat, _100);
|
||||||
|
frq_cif_100_ene = readcpudata(cif, frq, wat, _100);
|
||||||
|
frq_mni_100_ene = readcpudata(mni, frq, wat, _100);
|
||||||
|
|
||||||
|
bay_cif_acc_ene = readcpudata(cif, bay, wat, acc);
|
||||||
|
bay_mni_acc_ene = readcpudata(mni, bay, wat, acc);
|
||||||
|
frq_cif_acc_ene = readcpudata(cif, frq, wat, acc);
|
||||||
|
frq_mni_acc_ene = readcpudata(mni, frq, wat, acc);
|
||||||
|
|
||||||
|
|
||||||
|
bay_cif_wbu_ene = readcpudata(cif, bay, wat, wbud);
|
||||||
|
bay_mni_wbu_ene = readcpudata(mni, bay, wat, wbud);
|
||||||
|
frq_cif_wbu_ene = readcpudata(cif, frq, wat, wbud);
|
||||||
|
frq_mni_wbu_ene = readcpudata(mni, frq, wat, wbud);
|
||||||
|
|
||||||
|
bay_mni_est_ene = readcpudata(mni, bay, wat, es);
|
||||||
|
bay_cif_est_ene = readcpudata(cif, bay, wat, es);
|
||||||
|
frq_cif_est_ene = readcpudata(cif, frq, wat, es);
|
||||||
|
frq_mni_est_ene = readcpudata(mni, frq, wat, es);
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
bay_cif_acc_ene[s] = round.(getcpuwatt(bay_cif_acc_ene[s]))
|
||||||
|
bay_cif_est_ene[s] = round.(getcpuwatt(bay_cif_est_ene[s]))
|
||||||
|
bay_cif_wbu_ene[s] = round.(getcpuwatt(bay_cif_wbu_ene[s]))
|
||||||
|
bay_cif_100_ene[s] = round.(getcpuwatt(bay_cif_100_ene[s]))
|
||||||
|
|
||||||
|
bay_mni_acc_ene[s] = round.(getcpuwatt(bay_mni_acc_ene[s]))
|
||||||
|
bay_mni_est_ene[s] = round.(getcpuwatt(bay_mni_est_ene[s]))
|
||||||
|
bay_mni_wbu_ene[s] = round.(getcpuwatt(bay_mni_wbu_ene[s]))
|
||||||
|
bay_mni_100_ene[s] = round.(getcpuwatt(bay_mni_100_ene[s]))
|
||||||
|
|
||||||
|
frq_cif_acc_ene[s] = round.(getcpuwatt(frq_cif_acc_ene[s]))
|
||||||
|
frq_cif_est_ene[s] = round.(getcpuwatt(frq_cif_est_ene[s]))
|
||||||
|
frq_cif_wbu_ene[s] = round.(getcpuwatt(frq_cif_wbu_ene[s]))
|
||||||
|
frq_cif_100_ene[s] = round.(getcpuwatt(frq_cif_100_ene[s]))
|
||||||
|
|
||||||
|
frq_mni_acc_ene[s] = round.(getcpuwatt(frq_mni_acc_ene[s]))
|
||||||
|
frq_mni_est_ene[s] = round.(getcpuwatt(frq_mni_est_ene[s]))
|
||||||
|
frq_mni_wbu_ene[s] = round.(getcpuwatt(frq_mni_wbu_ene[s]))
|
||||||
|
frq_mni_100_ene[s] = round.(getcpuwatt(frq_mni_100_ene[s]))
|
||||||
|
end
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
mni_100_bay_ene[s]["Ene"] = vcat(mni_100_bay_ene[s]["Ene"], bay_mni_100_ene[s])
|
||||||
|
mni_100_fre_ene[s]["Ene"] = vcat(mni_100_fre_ene[s]["Ene"], frq_mni_100_ene[s])
|
||||||
|
cif_100_bay_ene[s]["Ene"] = vcat(cif_100_bay_ene[s]["Ene"], bay_cif_100_ene[s])
|
||||||
|
cif_100_fre_ene[s]["Ene"] = vcat(cif_100_fre_ene[s]["Ene"], frq_cif_100_ene[s])
|
||||||
|
|
||||||
|
mni_acc_bay_ene[s]["Ene"] = vcat(mni_acc_bay_ene[s]["Ene"], bay_mni_acc_ene[s])
|
||||||
|
mni_acc_fre_ene[s]["Ene"] = vcat(mni_acc_fre_ene[s]["Ene"], frq_mni_acc_ene[s])
|
||||||
|
cif_acc_bay_ene[s]["Ene"] = vcat(cif_acc_bay_ene[s]["Ene"], bay_cif_acc_ene[s])
|
||||||
|
cif_acc_fre_ene[s]["Ene"] = vcat(cif_acc_fre_ene[s]["Ene"], frq_cif_acc_ene[s])
|
||||||
|
|
||||||
|
|
||||||
|
mni_wat_bay_ene[s]["Ene"] = vcat(mni_wat_bay_ene[s]["Ene"], bay_mni_wbu_ene[s])
|
||||||
|
mni_wat_fre_ene[s]["Ene"] = vcat(mni_wat_fre_ene[s]["Ene"], frq_mni_wbu_ene[s])
|
||||||
|
cif_wat_bay_ene[s]["Ene"] = vcat(cif_wat_bay_ene[s]["Ene"], bay_cif_wbu_ene[s])
|
||||||
|
cif_wat_fre_ene[s]["Ene"] = vcat(cif_wat_fre_ene[s]["Ene"], frq_cif_wbu_ene[s])
|
||||||
|
|
||||||
|
mni_est_bay_ene[s]["Ene"] = vcat(mni_est_bay_ene[s]["Ene"], bay_mni_est_ene[s])
|
||||||
|
mni_est_fre_ene[s]["Ene"] = vcat(mni_est_fre_ene[s]["Ene"], frq_mni_est_ene[s])
|
||||||
|
cif_est_bay_ene[s]["Ene"] = vcat(cif_est_bay_ene[s]["Ene"], bay_cif_est_ene[s])
|
||||||
|
cif_est_fre_ene[s]["Ene"] = vcat(cif_est_fre_ene[s]["Ene"], frq_cif_est_ene[s])
|
||||||
|
end
|
||||||
|
|
||||||
|
mnist_freq_100_ene = zeros(5)
|
||||||
|
mnist_freq_est_ene = zeros(5)
|
||||||
|
mnist_freq_wat_ene = zeros(5)
|
||||||
|
mnist_freq_acc_ene = zeros(5)
|
||||||
|
|
||||||
|
mnist_baye_100_ene = zeros(5)
|
||||||
|
mnist_baye_est_ene = zeros(5)
|
||||||
|
mnist_baye_wat_ene = zeros(5)
|
||||||
|
mnist_baye_acc_ene = zeros(5)
|
||||||
|
|
||||||
|
cifar_freq_100_ene = zeros(5)
|
||||||
|
cifar_freq_est_ene = zeros(5)
|
||||||
|
cifar_freq_wat_ene = zeros(5)
|
||||||
|
cifar_freq_acc_ene = zeros(5)
|
||||||
|
|
||||||
|
cifar_baye_100_ene = zeros(5)
|
||||||
|
cifar_baye_est_ene = zeros(5)
|
||||||
|
cifar_baye_wat_ene = zeros(5)
|
||||||
|
cifar_baye_acc_ene = zeros(5)
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
mnist_baye_100_ene[s] = sum(mni_100_bay_ene[s]["Ene"])
|
||||||
|
mnist_freq_100_ene[s] = sum(mni_100_fre_ene[s]["Ene"])
|
||||||
|
cifar_baye_100_ene[s] = sum(cif_100_bay_ene[s]["Ene"])
|
||||||
|
cifar_freq_100_ene[s] = sum(cif_100_fre_ene[s]["Ene"])
|
||||||
|
|
||||||
|
mnist_baye_acc_ene[s] = sum(mni_acc_bay_ene[s]["Ene"])
|
||||||
|
mnist_freq_acc_ene[s] = sum(mni_acc_fre_ene[s]["Ene"])
|
||||||
|
cifar_baye_acc_ene[s] = sum(cif_acc_bay_ene[s]["Ene"])
|
||||||
|
cifar_freq_acc_ene[s] = sum(cif_acc_fre_ene[s]["Ene"])
|
||||||
|
|
||||||
|
mnist_baye_wat_ene[s] = sum(mni_wat_bay_ene[s]["Ene"])
|
||||||
|
mnist_freq_wat_ene[s] = sum(mni_wat_fre_ene[s]["Ene"])
|
||||||
|
cifar_baye_wat_ene[s] = sum(cif_wat_bay_ene[s]["Ene"])
|
||||||
|
cifar_freq_wat_ene[s] = sum(cif_wat_fre_ene[s]["Ene"])
|
||||||
|
|
||||||
|
mnist_baye_est_ene[s] = sum(mni_est_bay_ene[s]["Ene"])
|
||||||
|
mnist_freq_est_ene[s] = sum(mni_est_fre_ene[s]["Ene"])
|
||||||
|
cifar_baye_est_ene[s] = sum(cif_est_bay_ene[s]["Ene"])
|
||||||
|
cifar_freq_est_ene[s] = sum(cif_est_fre_ene[s]["Ene"])
|
||||||
|
end
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load Accuracy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
mni_100_bay_exp = getgpudata(mni_folder_100, bayes_model, e_type, "eo");
|
||||||
|
mni_100_fre_exp = getgpudata(mni_folder_100, freq_model, e_type, "eo");
|
||||||
|
cif_100_bay_exp = getgpudata(cif_folder_100, bayes_model, e_type, "eo");
|
||||||
|
cif_100_fre_exp = getgpudata(cif_folder_100, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
mni_acc_bay_exp = getgpudata(mni_folder_acc, bayes_model, e_type, "eo");
|
||||||
|
mni_acc_fre_exp = getgpudata(mni_folder_acc, freq_model, e_type, "eo");
|
||||||
|
cif_acc_bay_exp = getgpudata(cif_folder_acc, bayes_model, e_type, "eo");
|
||||||
|
cif_acc_fre_exp = getgpudata(cif_folder_acc, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
mni_wat_bay_exp = getgpudata(mni_folder_wat, bayes_model, e_type, "eo");
|
||||||
|
mni_wat_fre_exp = getgpudata(mni_folder_wat, freq_model, e_type, "eo");
|
||||||
|
cif_wat_bay_exp = getgpudata(cif_folder_wat, bayes_model, e_type, "eo");
|
||||||
|
cif_wat_fre_exp = getgpudata(cif_folder_wat, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
mni_est_bay_exp = getgpudata(mni_folder_est, bayes_model, e_type, "eo");
|
||||||
|
mni_est_fre_exp = getgpudata(mni_folder_est, freq_model, e_type, "eo");
|
||||||
|
cif_est_bay_exp = getgpudata(cif_folder_est, bayes_model, e_type, "eo");
|
||||||
|
cif_est_fre_exp = getgpudata(cif_folder_est, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1:5
|
||||||
|
mni_100_bay_exp[i] = expdatatodict(mni_100_bay_exp[i])
|
||||||
|
mni_100_fre_exp[i] = expdatatodict(mni_100_fre_exp[i])
|
||||||
|
cif_100_bay_exp[i] = expdatatodict(cif_100_bay_exp[i])
|
||||||
|
cif_100_fre_exp[i] = expdatatodict(cif_100_fre_exp[i])
|
||||||
|
|
||||||
|
mni_acc_bay_exp[i] = expdatatodict(mni_acc_bay_exp[i])
|
||||||
|
mni_acc_fre_exp[i] = expdatatodict(mni_acc_fre_exp[i])
|
||||||
|
cif_acc_bay_exp[i] = expdatatodict(cif_acc_bay_exp[i])
|
||||||
|
cif_acc_fre_exp[i] = expdatatodict(cif_acc_fre_exp[i])
|
||||||
|
|
||||||
|
mni_wat_bay_exp[i] = expdatatodict(mni_wat_bay_exp[i])
|
||||||
|
mni_wat_fre_exp[i] = expdatatodict(mni_wat_fre_exp[i])
|
||||||
|
cif_wat_bay_exp[i] = expdatatodict(cif_wat_bay_exp[i])
|
||||||
|
cif_wat_fre_exp[i] = expdatatodict(cif_wat_fre_exp[i])
|
||||||
|
|
||||||
|
mni_est_bay_exp[i] = expdatatodict(mni_est_bay_exp[i])
|
||||||
|
mni_est_fre_exp[i] = expdatatodict(mni_est_fre_exp[i])
|
||||||
|
cif_est_bay_exp[i] = expdatatodict(cif_est_bay_exp[i])
|
||||||
|
cif_est_fre_exp[i] = expdatatodict(cif_est_fre_exp[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
mnist_freq_100_exp = zeros(5)
|
||||||
|
mnist_freq_est_exp = zeros(5)
|
||||||
|
mnist_freq_wat_exp = zeros(5)
|
||||||
|
mnist_freq_acc_exp = zeros(5)
|
||||||
|
|
||||||
|
mnist_baye_100_exp = zeros(5)
|
||||||
|
mnist_baye_est_exp = zeros(5)
|
||||||
|
mnist_baye_wat_exp = zeros(5)
|
||||||
|
mnist_baye_acc_exp = zeros(5)
|
||||||
|
|
||||||
|
|
||||||
|
cifar_freq_100_exp = zeros(5)
|
||||||
|
cifar_freq_est_exp = zeros(5)
|
||||||
|
cifar_freq_wat_exp = zeros(5)
|
||||||
|
cifar_freq_acc_exp = zeros(5)
|
||||||
|
|
||||||
|
cifar_baye_100_exp = zeros(5)
|
||||||
|
cifar_baye_est_exp = zeros(5)
|
||||||
|
cifar_baye_wat_exp = zeros(5)
|
||||||
|
cifar_baye_acc_exp = zeros(5)
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
mnist_baye_100_exp[s] = (mean(mni_100_bay_exp[s]["acc"]) + mean(mni_100_bay_exp[s]["pre"])) / 2
|
||||||
|
mnist_freq_100_exp[s] = (mean(mni_100_fre_exp[s]["acc"]) + mean(mni_100_fre_exp[s]["pre"])) / 2
|
||||||
|
cifar_baye_100_exp[s] = (mean(cif_100_bay_exp[s]["acc"]) + mean(cif_100_bay_exp[s]["pre"])) / 2
|
||||||
|
cifar_freq_100_exp[s] = (mean(cif_100_fre_exp[s]["acc"]) + mean(cif_100_fre_exp[s]["pre"])) / 2
|
||||||
|
|
||||||
|
mnist_baye_acc_exp[s] = (mean(mni_acc_bay_exp[s]["acc"]) + mean(mni_acc_bay_exp[s]["pre"])) / 2
|
||||||
|
mnist_freq_acc_exp[s] = (mean(mni_acc_fre_exp[s]["acc"]) + mean(mni_acc_fre_exp[s]["pre"])) / 2
|
||||||
|
cifar_baye_acc_exp[s] = (mean(cif_acc_bay_exp[s]["acc"]) + mean(cif_acc_bay_exp[s]["pre"])) / 2
|
||||||
|
cifar_freq_acc_exp[s] = (mean(cif_acc_fre_exp[s]["acc"]) + mean(cif_acc_fre_exp[s]["pre"])) / 2
|
||||||
|
|
||||||
|
|
||||||
|
mnist_baye_wat_exp[s] = (mean(mni_wat_bay_exp[s]["acc"]) + mean(mni_wat_bay_exp[s]["pre"])) / 2
|
||||||
|
mnist_freq_wat_exp[s] = (mean(mni_wat_fre_exp[s]["acc"]) + mean(mni_wat_fre_exp[s]["pre"])) / 2
|
||||||
|
cifar_baye_wat_exp[s] = (mean(cif_wat_bay_exp[s]["acc"]) + mean(cif_wat_bay_exp[s]["pre"])) / 2
|
||||||
|
cifar_freq_wat_exp[s] = (mean(cif_wat_fre_exp[s]["acc"]) + mean(cif_wat_fre_exp[s]["pre"])) / 2
|
||||||
|
|
||||||
|
mnist_baye_est_exp[s] = (mean(mni_est_bay_exp[s]["acc"]) + mean(mni_est_bay_exp[s]["pre"])) / 2
|
||||||
|
mnist_freq_est_exp[s] = (mean(mni_est_fre_exp[s]["acc"]) + mean(mni_est_fre_exp[s]["pre"])) / 2
|
||||||
|
cifar_baye_est_exp[s] = (mean(cif_est_bay_exp[s]["acc"]) + mean(cif_est_bay_exp[s]["pre"])) / 2
|
||||||
|
cifar_freq_est_exp[s] = (mean(cif_est_fre_exp[s]["acc"]) + mean(cif_est_fre_exp[s]["pre"])) / 2
|
||||||
|
end
|
||||||
|
|
||||||
|
all_data_exp = Dict(
|
||||||
|
"mni" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"cif" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
mnist_freq_100_df = DataFrame(Accuracy=mnist_freq_100_exp,Energy=mnist_freq_100_ene)
|
||||||
|
mnist_freq_est_df = DataFrame(Accuracy=mnist_freq_est_exp,Energy=mnist_freq_est_ene)
|
||||||
|
mnist_freq_wat_df = DataFrame(Accuracy=mnist_freq_wat_exp,Energy=mnist_freq_wat_ene)
|
||||||
|
mnist_freq_acc_df = DataFrame(Accuracy=mnist_freq_acc_exp,Energy=mnist_freq_acc_ene)
|
||||||
|
|
||||||
|
mnist_baye_100_df = DataFrame(Accuracy=mnist_baye_100_exp,Energy=mnist_baye_100_ene)
|
||||||
|
mnist_baye_est_df = DataFrame(Accuracy=mnist_baye_est_exp,Energy=mnist_baye_est_ene)
|
||||||
|
mnist_baye_wat_df = DataFrame(Accuracy=mnist_baye_wat_exp,Energy=mnist_baye_wat_ene)
|
||||||
|
mnist_baye_acc_df = DataFrame(Accuracy=mnist_baye_acc_exp,Energy=mnist_baye_acc_ene)
|
||||||
|
|
||||||
|
|
||||||
|
cifar_freq_100_df = DataFrame(Accuracy=cifar_freq_100_exp,Energy=cifar_freq_100_ene)
|
||||||
|
cifar_freq_est_df = DataFrame(Accuracy=cifar_freq_est_exp,Energy=cifar_freq_est_ene)
|
||||||
|
cifar_freq_wat_df = DataFrame(Accuracy=cifar_freq_wat_exp,Energy=cifar_freq_wat_ene)
|
||||||
|
cifar_freq_acc_df = DataFrame(Accuracy=cifar_freq_acc_exp,Energy=cifar_freq_acc_ene)
|
||||||
|
|
||||||
|
cifar_baye_100_df = DataFrame(Accuracy=cifar_baye_100_exp,Energy=cifar_baye_100_ene)
|
||||||
|
cifar_baye_est_df = DataFrame(Accuracy=cifar_baye_est_exp,Energy=cifar_baye_est_ene)
|
||||||
|
cifar_baye_wat_df = DataFrame(Accuracy=cifar_baye_wat_exp,Energy=cifar_baye_wat_ene)
|
||||||
|
cifar_baye_acc_df = DataFrame(Accuracy=cifar_baye_acc_exp,Energy=cifar_baye_acc_ene)
|
||||||
|
|
||||||
|
|
||||||
|
println("MNIST 100 Stopping")
|
||||||
|
latexify(mnist_baye_100_df,env=:table) |> print
|
||||||
|
latexify(mnist_freq_100_df,env=:table) |> print
|
||||||
|
|
||||||
|
println("CIFAR 100 Stopping")
|
||||||
|
latexify(cifar_baye_100_df,env=:table) |> print
|
||||||
|
latexify(cifar_freq_100_df,env=:table) |> print
|
||||||
|
|
||||||
|
|
||||||
|
println("MNIST Early Stopping")
|
||||||
|
latexify(mnist_baye_est_df,env=:table) |> print
|
||||||
|
latexify(mnist_freq_est_df,env=:table) |> print
|
||||||
|
|
||||||
|
println("CIFAR Early Stopping")
|
||||||
|
latexify(cifar_baye_est_df,env=:table) |> print
|
||||||
|
latexify(cifar_freq_est_df,env=:table) |> print
|
||||||
|
|
||||||
|
|
||||||
|
println("MNIST Energy bound")
|
||||||
|
latexify(mnist_baye_wat_df,env=:table) |> print
|
||||||
|
latexify(mnist_freq_wat_df,env=:table) |> print
|
||||||
|
|
||||||
|
println("CIFAR Energy bound")
|
||||||
|
latexify(cifar_baye_wat_df,env=:table) |> print
|
||||||
|
latexify(cifar_freq_wat_df,env=:table) |> print
|
||||||
|
|
||||||
|
|
||||||
|
println("MNIST Accuracy bound")
|
||||||
|
latexify(mnist_baye_acc_df,env=:table) |> print
|
||||||
|
latexify(mnist_freq_acc_df,env=:table) |> print
|
||||||
|
|
||||||
|
println("CIFAR Accuracy bound")
|
||||||
|
latexify(cifar_baye_acc_df,env=:table) |> print
|
||||||
|
latexify(cifar_freq_acc_df,env=:table) |> print
|
||||||
|
|
|
@ -0,0 +1,367 @@
|
||||||
|
###########################################################################
|
||||||
|
# #
|
||||||
|
# FLOPS Computations #
|
||||||
|
# #
|
||||||
|
###########################################################################
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
|
||||||
|
flops_bcnn_100_mnist =
|
||||||
|
[5.5e11 * 100, 5.5e11 * 200, 5.5e11 * 300, 5.5e11 * 400, 5.5e11 * 500]
|
||||||
|
flops_freq_100_mnist =
|
||||||
|
[2.58e11 * 100, 2.58e11 * 200, 2.58e11 * 300, 2.58e11 * 400, 2.58e11 * 500]
|
||||||
|
|
||||||
|
flops_bcnn_est_mnist =
|
||||||
|
[5.5e11 * 65, 5.5e11 * 21 * 2, 5.5e11 * 37 * 3, 5.5e11 * 53 * 4, 5.5e11 * 65 * 5]
|
||||||
|
flops_freq_est_mnist =
|
||||||
|
[2.58e11 * 16, 2.58e11 * 12 * 2, 2.58e11 * 56 * 3, 2.58e11 * 28 * 4, 2.58e11 * 20 * 5]
|
||||||
|
|
||||||
|
flops_bcnn_wat_mnist =
|
||||||
|
[5.5e11 * 19, 5.5e11 * 2 * 13, 5.5e11 * 3 * 10, 5.5e11 * 4 * 8, 5.5e11 * 5 * 6]
|
||||||
|
flops_freq_wat_mnist =
|
||||||
|
[2.58e11 * 43, 2.58e11 * 2 * 39, 2.58e11 * 3 * 27, 2.58e11 * 4 * 23, 2.58e11 * 5 * 21]
|
||||||
|
|
||||||
|
flops_bcnn_acc_mnist =
|
||||||
|
[5.5e11 * 72, 5.5e11 * 2 * 69, 5.5e11 * 3 * 69, 5.5e11 * 4 * 77, 5.5e11 * 5 * 80]
|
||||||
|
flops_freq_acc_mnist =
|
||||||
|
[2.58e11 * 12, 2.58e11 * 2 * 8, 2.58e11 * 3 * 6, 2.58e11 * 4 * 6, 2.58e11 * 5 * 4]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
flops_bcnn_100_cifar = [
|
||||||
|
5.5e11 * 100 * 16.3,
|
||||||
|
5.5e11 * 200 * 16.3,
|
||||||
|
5.5e11 * 300 * 16.3,
|
||||||
|
5.5e11 * 400 * 16.3,
|
||||||
|
5.5e11 * 500 * 16.3,
|
||||||
|
]
|
||||||
|
flops_freq_100_cifar = [
|
||||||
|
2.58e11 * 100 * 16.3,
|
||||||
|
2.58e11 * 200 * 16.3,
|
||||||
|
2.58e11 * 300 * 16.3,
|
||||||
|
2.58e11 * 400 * 16.3,
|
||||||
|
2.58e11 * 500 * 16.3,
|
||||||
|
]
|
||||||
|
|
||||||
|
flops_bcnn_est_cifar = [
|
||||||
|
5.5e11 * 61 * 16.3,
|
||||||
|
5.5e11 * 2 * 41 * 16.3,
|
||||||
|
5.5e11 * 3 * 41 * 16.3,
|
||||||
|
5.5e11 * 4 * 21 * 16.3,
|
||||||
|
5.5e11 * 5 * 81 * 16.3,
|
||||||
|
]
|
||||||
|
flops_freq_est_cifar = [
|
||||||
|
2.58e11 * 56 * 16.3,
|
||||||
|
2.58e11 * 2 * 40 * 16.3,
|
||||||
|
2.58e11 * 3 * 24 * 16.3,
|
||||||
|
2.58e11 * 4 * 24 * 16.3,
|
||||||
|
2.58e11 * 5 * 28 * 16.3,
|
||||||
|
]
|
||||||
|
|
||||||
|
flops_bcnn_wat_cifar = [
|
||||||
|
5.5e11 * 16.3 * 19,
|
||||||
|
5.5e11 * 2 * 16.3 * 14,
|
||||||
|
5.5e11 * 3 * 16.3 * 11,
|
||||||
|
5.5e11 * 4 * 16.3 * 9,
|
||||||
|
5.5e11 * 5 * 16.3 * 7,
|
||||||
|
]
|
||||||
|
flops_freq_wat_cifar = [
|
||||||
|
2.58e11 * 16.3 * 39,
|
||||||
|
2.58e11 * 2 * 16.3 * 36,
|
||||||
|
2.58e11 * 3 * 16.3 * 32,
|
||||||
|
2.58e11 * 4 * 16.3 * 25,
|
||||||
|
2.58e11 * 5 * 16.3 * 21,
|
||||||
|
]
|
||||||
|
|
||||||
|
flops_bcnn_acc_cifar = [
|
||||||
|
5.5e11 * 16.3 * 51,
|
||||||
|
5.5e11 * 2 * 16.3 * 37,
|
||||||
|
5.5e11 * 3 * 16.3 * 30,
|
||||||
|
5.5e11 * 4 * 16.3 * 36,
|
||||||
|
5.5e11 * 5 * 16.3 * 33,
|
||||||
|
]
|
||||||
|
flops_freq_acc_cifar = [
|
||||||
|
2.58e11 * 16.3 * 7,
|
||||||
|
2.58e11 * 2 * 16.3 * 4,
|
||||||
|
2.58e11 * 3 * 16.3 * 4,
|
||||||
|
2.58e11 * 4 * 16.3 * 3,
|
||||||
|
2.58e11 * 5 * 16.3 * 3,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
println("MNIST BCNN 100 FLOPS $(flops_bcnn_100_mnist)")
|
||||||
|
println("MNIST FREQ 100 FLOPS $(flops_freq_100_mnist)")
|
||||||
|
|
||||||
|
println("MNIST BCNN est FLOPS $(flops_bcnn_est_mnist)")
|
||||||
|
println("MNIST FREQ est FLOPS $(flops_freq_est_mnist)")
|
||||||
|
|
||||||
|
println("MNIST BCNN wat FLOPS $(flops_bcnn_wat_mnist)")
|
||||||
|
println("MNIST FREQ wat FLOPS $(flops_freq_wat_mnist)")
|
||||||
|
|
||||||
|
println("MNIST BCNN acc FLOPS $(flops_bcnn_acc_mnist)")
|
||||||
|
println("MNIST FREQ acc FLOPS $(flops_freq_acc_mnist)")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
println("CIFAR BCNN 100 FLOPS $(flops_bcnn_100_cifar)")
|
||||||
|
println("CIFAR FREQ 100 FLOPS $(flops_freq_100_cifar)")
|
||||||
|
|
||||||
|
println("CIFAR BCNN est FLOPS $(flops_bcnn_est_cifar)")
|
||||||
|
println("CIFAR FREQ est FLOPS $(flops_freq_est_cifar)")
|
||||||
|
|
||||||
|
println("CIFAR BCNN wat FLOPS $(flops_bcnn_wat_cifar)")
|
||||||
|
println("CIFAR FREQ wat FLOPS $(flops_freq_wat_cifar)")
|
||||||
|
|
||||||
|
println("CIFAR BCNN acc FLOPS $(flops_bcnn_acc_cifar)")
|
||||||
|
println("CIFAR FREQ acc FLOPS $(flops_freq_acc_cifar)")
|
||||||
|
=#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
watts_bcnn_100_mnist = [384367.0, 354604.0, 578490.0, 598499.0, 659321.0]
|
||||||
|
watts_freq_100_mnist = [818766.0, 1.639863e6, 1.826163e6, 1.961074e6, 2.018758e6]
|
||||||
|
|
||||||
|
watts_bcnn_est_mnist = [75998.0, 167339.0, 92658.0, 118200.0, 157475.0]
|
||||||
|
watts_freq_est_mnist = [919386.0, 368970.0, 466917.0, 294907.0, 1.068331e6]
|
||||||
|
|
||||||
|
watts_bcnn_wat_mnist = [116516.0, 115347.0, 116225.0, 117989.0, 175601.0]
|
||||||
|
watts_freq_wat_mnist = [146912.0, 136441.0, 114160.0, 131887.0, 119364.0]
|
||||||
|
|
||||||
|
watts_bcnn_acc_mnist = [57569.0, 37169.0, 43488.0, 390792.0, 50428.0]
|
||||||
|
watts_freq_acc_mnist = [1.332701e6, 498486.0, 532690.0, 1.344363e6, 832005.0]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
watts_bcnn_100_cifar = [310789.0, 332406.0, 354631.0, 390792.0, 545941.0]
|
||||||
|
watts_freq_100_cifar = [1.128901e6, 1.213355e6, 1.29992e6, 1.344363e6, 1.35644e6]
|
||||||
|
|
||||||
|
watts_bcnn_est_cifar = [164841.0, 167339.0, 92658.0, 118200.0, 157475.0]
|
||||||
|
watts_freq_est_cifar = [358373.0, 368970.0, 466917.0, 294907.0, 1.068331e6]
|
||||||
|
|
||||||
|
watts_bcnn_wat_cifar = [118621.0, 115347.0, 116225.0, 117989.0, 175601.0]
|
||||||
|
watts_freq_wat_cifar = [149356.0, 136441.0, 114160.0, 131887.0, 119364.0]
|
||||||
|
|
||||||
|
watts_bcnn_acc_cifar = [60415.0, 37169.0, 43488.0, 390792.0, 50428.0]
|
||||||
|
watts_freq_acc_cifar = [578846.0, 498486.0, 532690.0, 1.344363e6, 832005.0]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
println("MNIST BCNN 100 WATTS $(watts_bcnn_100_mnist)")
|
||||||
|
println("MNIST FREQ 100 WATTS $(watts_freq_100_mnist)")
|
||||||
|
|
||||||
|
println("MNIST BCNN est WATTS $(watts_bcnn_est_mnist)")
|
||||||
|
println("MNIST FREQ est WATTS $(watts_freq_est_mnist)")
|
||||||
|
|
||||||
|
println("MNIST BCNN wat WATTS $(watts_bcnn_wat_mnist)")
|
||||||
|
println("MNIST FREQ wat WATTS $(watts_freq_wat_mnist)")
|
||||||
|
|
||||||
|
println("MNIST BCNN acc WATTS $(watts_bcnn_acc_mnist)")
|
||||||
|
println("MNIST FREQ acc WATTS $(watts_freq_acc_mnist)")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
println("CIFAR BCNN 100 WATTS $(watts_bcnn_100_cifar)")
|
||||||
|
println("CIFAR FREQ 100 WATTS $(watts_freq_100_cifar)")
|
||||||
|
|
||||||
|
println("CIFAR BCNN est WATTS $(watts_bcnn_est_cifar)")
|
||||||
|
println("CIFAR FREQ est WATTS $(watts_freq_est_cifar)")
|
||||||
|
|
||||||
|
println("CIFAR BCNN wat WATTS $(watts_bcnn_wat_cifar)")
|
||||||
|
println("CIFAR FREQ wat WATTS $(watts_freq_wat_cifar)")
|
||||||
|
|
||||||
|
println("CIFAR BCNN acc WATTS $(watts_bcnn_acc_cifar)")
|
||||||
|
println("CIFAR FREQ acc WATTS $(watts_freq_acc_cifar)")
|
||||||
|
=#
|
||||||
|
|
||||||
|
println("MNIST BCNN 100 FLOPS/W $(flops_bcnn_100_mnist ./ watts_bcnn_100_mnist)")
|
||||||
|
println("MNIST FREQ 100 FLOPS/W $(flops_freq_100_mnist ./ watts_freq_100_mnist)")
|
||||||
|
|
||||||
|
println("MNIST BCNN est FLOPS/W $(flops_bcnn_est_mnist ./ watts_bcnn_est_mnist)")
|
||||||
|
println("MNIST FREQ est FLOPS/W $(flops_freq_est_mnist ./ watts_freq_est_mnist)")
|
||||||
|
|
||||||
|
println("MNIST BCNN wat FLOPS/W $(flops_bcnn_wat_mnist ./ watts_bcnn_wat_mnist)")
|
||||||
|
println("MNIST FREQ wat FLOPS/W $(flops_freq_wat_mnist ./ watts_freq_wat_mnist)")
|
||||||
|
|
||||||
|
println("MNIST BCNN acc FLOPS/W $(flops_bcnn_acc_mnist ./ watts_bcnn_acc_mnist)")
|
||||||
|
println("MNIST FREQ acc FLOPS/W $(flops_freq_acc_mnist ./ watts_freq_acc_mnist)")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
println("CIFAR BCNN 100 FLOPS/W $(flops_bcnn_100_cifar ./ watts_bcnn_100_cifar)")
|
||||||
|
println("CIFAR FREQ 100 FLOPS/W $(flops_freq_100_cifar ./ watts_freq_100_cifar)")
|
||||||
|
|
||||||
|
println("CIFAR BCNN est FLOPS/W $(flops_bcnn_est_cifar ./ watts_bcnn_est_cifar)")
|
||||||
|
println("CIFAR FREQ est FLOPS/W $(flops_freq_est_cifar ./ watts_freq_est_cifar)")
|
||||||
|
|
||||||
|
println("CIFAR BCNN wat FLOPS/W $(flops_bcnn_wat_cifar ./ watts_bcnn_wat_cifar)")
|
||||||
|
println("CIFAR FREQ wat FLOPS/W $(flops_freq_wat_cifar ./ watts_freq_wat_cifar)")
|
||||||
|
|
||||||
|
println("CIFAR BCNN acc FLOPS/W $(flops_bcnn_acc_cifar ./ watts_bcnn_acc_cifar)")
|
||||||
|
println("CIFAR FREQ acc FLOPS/W $(flops_freq_acc_cifar ./ watts_freq_acc_cifar)")
|
||||||
|
|
||||||
|
|
||||||
|
flops_w_bcnn_100_mnist = flops_bcnn_100_mnist ./ watts_bcnn_100_mnist
|
||||||
|
flops_w_freq_100_mnist = flops_freq_100_mnist ./ watts_freq_100_mnist
|
||||||
|
|
||||||
|
flops_w_bcnn_est_mnist = flops_bcnn_est_mnist ./ watts_bcnn_est_mnist
|
||||||
|
flops_w_freq_est_mnist = flops_freq_est_mnist ./ watts_freq_est_mnist
|
||||||
|
|
||||||
|
flops_w_bcnn_wat_mnist = flops_bcnn_wat_mnist ./ watts_bcnn_wat_mnist
|
||||||
|
flops_w_freq_wat_mnist = flops_freq_wat_mnist ./ watts_freq_wat_mnist
|
||||||
|
|
||||||
|
flops_w_bcnn_acc_mnist = flops_bcnn_acc_mnist ./ watts_bcnn_acc_mnist
|
||||||
|
flops_w_freq_acc_mnist = flops_freq_acc_mnist ./ watts_freq_acc_mnist
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
flops_w_bcnn_100_cifar = flops_bcnn_100_cifar ./ watts_bcnn_100_cifar
|
||||||
|
flops_w_freq_100_cifar = flops_freq_100_cifar ./ watts_freq_100_cifar
|
||||||
|
|
||||||
|
flops_w_bcnn_est_cifar = flops_bcnn_est_cifar ./ watts_bcnn_est_cifar
|
||||||
|
flops_w_freq_est_cifar = flops_freq_est_cifar ./ watts_freq_est_cifar
|
||||||
|
|
||||||
|
flops_w_bcnn_wat_cifar = flops_bcnn_wat_cifar ./ watts_bcnn_wat_cifar
|
||||||
|
flops_w_freq_wat_cifar = flops_freq_wat_cifar ./ watts_freq_wat_cifar
|
||||||
|
|
||||||
|
flops_w_bcnn_acc_cifar = flops_bcnn_acc_cifar ./ watts_bcnn_acc_cifar
|
||||||
|
flops_w_freq_acc_cifar = flops_freq_acc_cifar ./ watts_freq_acc_cifar
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_freq_100_mnist,
|
||||||
|
name = "LeNet Exp 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_freq_est_mnist,
|
||||||
|
name = "LeNet Exp 2",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_freq_wat_mnist,
|
||||||
|
name = "LeNet Exp 3",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_freq_acc_mnist,
|
||||||
|
name = "LeNet Exp 4",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_bcnn_100_mnist,
|
||||||
|
name = "BCNN Exp 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_bcnn_est_mnist,
|
||||||
|
name = "BCNN Exp 2",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(033,081,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_bcnn_wat_mnist,
|
||||||
|
name = "BCNN Exp 3",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(033,115,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_bcnn_acc_mnist,
|
||||||
|
name = "BCNN Exp 4",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(151,177,255)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "FLOPS/W",
|
||||||
|
xaxis_title_text = "Size";
|
||||||
|
xaxis_range = [-1, 5],
|
||||||
|
xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_f_w_exp.png")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_freq_100_cifar,
|
||||||
|
name = "LeNet Exp 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_freq_est_cifar,
|
||||||
|
name = "LeNet Exp 2",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_freq_wat_cifar,
|
||||||
|
name = "LeNet Exp 3",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_freq_acc_cifar,
|
||||||
|
name = "LeNet Exp 4",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_bcnn_100_cifar,
|
||||||
|
name = "BCNN Exp 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_bcnn_est_cifar,
|
||||||
|
name = "BCNN Exp 2",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(033,081,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_bcnn_wat_cifar,
|
||||||
|
name = "BCNN Exp 3",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(033,115,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = flops_w_bcnn_acc_cifar,
|
||||||
|
name = "BCNN Exp 4",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(151,177,255)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "FLOPS/W",
|
||||||
|
xaxis_title_text = "Size";
|
||||||
|
xaxis_range = [-1, 5],
|
||||||
|
xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_f_w_exp.png")
|
|
@ -0,0 +1,390 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using LinearAlgebra
|
||||||
|
using Statistics
|
||||||
|
|
||||||
|
#=
|
||||||
|
Obtain energy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
#mni_folder_1 = "ini_exp_data/"
|
||||||
|
|
||||||
|
|
||||||
|
mni_folder_100 = "exp_100_epochs/";
|
||||||
|
cif_folder_100 = "CIFAR_100_epoch/";
|
||||||
|
|
||||||
|
mni_folder_acc = "data_bounded/";
|
||||||
|
cif_folder_acc = "CIFAR_acc_bound/";
|
||||||
|
|
||||||
|
mni_folder_wat = "data_budget/";
|
||||||
|
cif_folder_wat = "CIFAR_energy_bound/";
|
||||||
|
|
||||||
|
mni_folder_est = "early_stop_res/";
|
||||||
|
cif_folder_est = "CIFAR_early_stop/";
|
||||||
|
|
||||||
|
bayes_model = "bayes";
|
||||||
|
freq_model = "freq";
|
||||||
|
w_type = "watt";
|
||||||
|
e_type = "exp";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load GPU data
|
||||||
|
=#
|
||||||
|
mni_100_bay_ene = getgpudata(mni_folder_100, bayes_model, w_type, "eo");
|
||||||
|
mni_100_fre_ene = getgpudata(mni_folder_100, freq_model, w_type, "eo");
|
||||||
|
cif_100_bay_ene = getgpudata(cif_folder_100, bayes_model, w_type, "eo");
|
||||||
|
cif_100_fre_ene = getgpudata(cif_folder_100, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_acc_bay_ene = getgpudata(mni_folder_acc, bayes_model, w_type, "eo");
|
||||||
|
mni_acc_fre_ene = getgpudata(mni_folder_acc, freq_model, w_type, "eo");
|
||||||
|
cif_acc_bay_ene = getgpudata(cif_folder_acc, bayes_model, w_type, "eo");
|
||||||
|
cif_acc_fre_ene = getgpudata(cif_folder_acc, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_wat_bay_ene = getgpudata(mni_folder_wat, bayes_model, w_type, "eo");
|
||||||
|
mni_wat_fre_ene = getgpudata(mni_folder_wat, freq_model, w_type, "eo");
|
||||||
|
cif_wat_bay_ene = getgpudata(cif_folder_wat, bayes_model, w_type, "eo");
|
||||||
|
cif_wat_fre_ene = getgpudata(cif_folder_wat, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_est_bay_ene = getgpudata(mni_folder_est, bayes_model, w_type, "eo");
|
||||||
|
mni_est_fre_ene = getgpudata(mni_folder_est, freq_model, w_type, "eo");
|
||||||
|
cif_est_bay_ene = getgpudata(cif_folder_est, bayes_model, w_type, "eo");
|
||||||
|
cif_est_fre_ene = getgpudata(cif_folder_est, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Define CPU paths
|
||||||
|
=#
|
||||||
|
cif = "cifar";
|
||||||
|
mni = "mnist";
|
||||||
|
bay = "bayes";
|
||||||
|
wat = "cpu_watts";
|
||||||
|
frq = "freq";
|
||||||
|
ram = "ram_use";
|
||||||
|
_100 = "100";
|
||||||
|
acc = "acc";
|
||||||
|
es = "es";
|
||||||
|
wbud = "wbud";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load CPU data
|
||||||
|
=#
|
||||||
|
bay_cif_100_ene = readcpudata(cif, bay, wat, _100);
|
||||||
|
bay_mni_100_ene = readcpudata(mni, bay, wat, _100);
|
||||||
|
frq_cif_100_ene = readcpudata(cif, frq, wat, _100);
|
||||||
|
frq_mni_100_ene = readcpudata(mni, frq, wat, _100);
|
||||||
|
|
||||||
|
bay_cif_acc_ene = readcpudata(cif, bay, wat, acc);
|
||||||
|
bay_mni_acc_ene = readcpudata(mni, bay, wat, acc);
|
||||||
|
frq_cif_acc_ene = readcpudata(cif, frq, wat, acc);
|
||||||
|
frq_mni_acc_ene = readcpudata(mni, frq, wat, acc);
|
||||||
|
|
||||||
|
|
||||||
|
bay_cif_wbu_ene = readcpudata(cif, bay, wat, wbud);
|
||||||
|
bay_mni_wbu_ene = readcpudata(mni, bay, wat, wbud);
|
||||||
|
frq_cif_wbu_ene = readcpudata(cif, frq, wat, wbud);
|
||||||
|
frq_mni_wbu_ene = readcpudata(mni, frq, wat, wbud);
|
||||||
|
|
||||||
|
bay_mni_est_ene = readcpudata(mni, bay, wat, es);
|
||||||
|
bay_cif_est_ene = readcpudata(cif, bay, wat, es);
|
||||||
|
frq_cif_est_ene = readcpudata(cif, frq, wat, es);
|
||||||
|
frq_mni_est_ene = readcpudata(mni, frq, wat, es);
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
bay_cif_acc_ene[s] = round.(getcpuwatt(bay_cif_acc_ene[s]))
|
||||||
|
bay_cif_est_ene[s] = round.(getcpuwatt(bay_cif_est_ene[s]))
|
||||||
|
bay_cif_wbu_ene[s] = round.(getcpuwatt(bay_cif_wbu_ene[s]))
|
||||||
|
bay_cif_100_ene[s] = round.(getcpuwatt(bay_cif_100_ene[s]))
|
||||||
|
|
||||||
|
bay_mni_acc_ene[s] = round.(getcpuwatt(bay_mni_acc_ene[s]))
|
||||||
|
bay_mni_est_ene[s] = round.(getcpuwatt(bay_mni_est_ene[s]))
|
||||||
|
bay_mni_wbu_ene[s] = round.(getcpuwatt(bay_mni_wbu_ene[s]))
|
||||||
|
bay_mni_100_ene[s] = round.(getcpuwatt(bay_mni_100_ene[s]))
|
||||||
|
|
||||||
|
frq_cif_acc_ene[s] = round.(getcpuwatt(frq_cif_acc_ene[s]))
|
||||||
|
frq_cif_est_ene[s] = round.(getcpuwatt(frq_cif_est_ene[s]))
|
||||||
|
frq_cif_wbu_ene[s] = round.(getcpuwatt(frq_cif_wbu_ene[s]))
|
||||||
|
frq_cif_100_ene[s] = round.(getcpuwatt(frq_cif_100_ene[s]))
|
||||||
|
|
||||||
|
frq_mni_acc_ene[s] = round.(getcpuwatt(frq_mni_acc_ene[s]))
|
||||||
|
frq_mni_est_ene[s] = round.(getcpuwatt(frq_mni_est_ene[s]))
|
||||||
|
frq_mni_wbu_ene[s] = round.(getcpuwatt(frq_mni_wbu_ene[s]))
|
||||||
|
frq_mni_100_ene[s] = round.(getcpuwatt(frq_mni_100_ene[s]))
|
||||||
|
end
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
mni_100_bay_ene[s]["Ene"] = vcat(mni_100_bay_ene[s]["Ene"], bay_mni_100_ene[s])
|
||||||
|
mni_100_fre_ene[s]["Ene"] = vcat(mni_100_fre_ene[s]["Ene"], frq_mni_100_ene[s])
|
||||||
|
cif_100_bay_ene[s]["Ene"] = vcat(cif_100_bay_ene[s]["Ene"], bay_cif_100_ene[s])
|
||||||
|
cif_100_fre_ene[s]["Ene"] = vcat(cif_100_fre_ene[s]["Ene"], frq_cif_100_ene[s])
|
||||||
|
|
||||||
|
mni_acc_bay_ene[s]["Ene"] = vcat(mni_acc_bay_ene[s]["Ene"], bay_mni_acc_ene[s])
|
||||||
|
mni_acc_fre_ene[s]["Ene"] = vcat(mni_acc_fre_ene[s]["Ene"], frq_mni_acc_ene[s])
|
||||||
|
cif_acc_bay_ene[s]["Ene"] = vcat(cif_acc_bay_ene[s]["Ene"], bay_cif_acc_ene[s])
|
||||||
|
cif_acc_fre_ene[s]["Ene"] = vcat(cif_acc_fre_ene[s]["Ene"], frq_cif_acc_ene[s])
|
||||||
|
|
||||||
|
|
||||||
|
mni_wat_bay_ene[s]["Ene"] = vcat(mni_wat_bay_ene[s]["Ene"], bay_mni_wbu_ene[s])
|
||||||
|
mni_wat_fre_ene[s]["Ene"] = vcat(mni_wat_fre_ene[s]["Ene"], frq_mni_wbu_ene[s])
|
||||||
|
cif_wat_bay_ene[s]["Ene"] = vcat(cif_wat_bay_ene[s]["Ene"], bay_cif_wbu_ene[s])
|
||||||
|
cif_wat_fre_ene[s]["Ene"] = vcat(cif_wat_fre_ene[s]["Ene"], frq_cif_wbu_ene[s])
|
||||||
|
|
||||||
|
mni_est_bay_ene[s]["Ene"] = vcat(mni_est_bay_ene[s]["Ene"], bay_mni_est_ene[s])
|
||||||
|
mni_est_fre_ene[s]["Ene"] = vcat(mni_est_fre_ene[s]["Ene"], frq_mni_est_ene[s])
|
||||||
|
cif_est_bay_ene[s]["Ene"] = vcat(cif_est_bay_ene[s]["Ene"], bay_cif_est_ene[s])
|
||||||
|
cif_est_fre_ene[s]["Ene"] = vcat(cif_est_fre_ene[s]["Ene"], frq_cif_est_ene[s])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
all_data_ene = Dict(
|
||||||
|
"mni" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"cif" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
all_data_ene["mni"][s]["100"]["bay"] = mean(mni_100_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["mni"][s]["100"]["frq"] = mean(mni_100_fre_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["100"]["bay"] = mean(cif_100_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["100"]["frq"] = mean(cif_100_fre_ene[s]["Ene"])
|
||||||
|
|
||||||
|
all_data_ene["mni"][s]["acc"]["bay"] = mean(mni_acc_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["mni"][s]["acc"]["frq"] = mean(mni_acc_fre_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["acc"]["bay"] = mean(cif_acc_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["acc"]["frq"] = mean(cif_acc_fre_ene[s]["Ene"])
|
||||||
|
|
||||||
|
|
||||||
|
all_data_ene["mni"][s]["wat"]["bay"] = mean(mni_wat_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["mni"][s]["wat"]["frq"] = mean(mni_wat_fre_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["wat"]["bay"] = mean(cif_wat_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["wat"]["frq"] = mean(cif_wat_fre_ene[s]["Ene"])
|
||||||
|
|
||||||
|
all_data_ene["mni"][s]["est"]["bay"] = mean(mni_est_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["mni"][s]["est"]["frq"] = mean(mni_est_fre_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["est"]["bay"] = mean(cif_est_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["est"]["frq"] = mean(cif_est_fre_ene[s]["Ene"])
|
||||||
|
end
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load Accuracy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
mni_100_bay_exp = getgpudata(mni_folder_100, bayes_model, e_type, "eo");
|
||||||
|
mni_100_fre_exp = getgpudata(mni_folder_100, freq_model, e_type, "eo");
|
||||||
|
cif_100_bay_exp = getgpudata(cif_folder_100, bayes_model, e_type, "eo");
|
||||||
|
cif_100_fre_exp = getgpudata(cif_folder_100, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
mni_acc_bay_exp = getgpudata(mni_folder_acc, bayes_model, e_type, "eo");
|
||||||
|
mni_acc_fre_exp = getgpudata(mni_folder_acc, freq_model, e_type, "eo");
|
||||||
|
cif_acc_bay_exp = getgpudata(cif_folder_acc, bayes_model, e_type, "eo");
|
||||||
|
cif_acc_fre_exp = getgpudata(cif_folder_acc, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
mni_wat_bay_exp = getgpudata(mni_folder_wat, bayes_model, e_type, "eo");
|
||||||
|
mni_wat_fre_exp = getgpudata(mni_folder_wat, freq_model, e_type, "eo");
|
||||||
|
cif_wat_bay_exp = getgpudata(cif_folder_wat, bayes_model, e_type, "eo");
|
||||||
|
cif_wat_fre_exp = getgpudata(cif_folder_wat, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
mni_est_bay_exp = getgpudata(mni_folder_est, bayes_model, e_type, "eo");
|
||||||
|
mni_est_fre_exp = getgpudata(mni_folder_est, freq_model, e_type, "eo");
|
||||||
|
cif_est_bay_exp = getgpudata(cif_folder_est, bayes_model, e_type, "eo");
|
||||||
|
cif_est_fre_exp = getgpudata(cif_folder_est, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1:5
|
||||||
|
mni_100_bay_exp[i] = expdatatodict(mni_100_bay_exp[i])
|
||||||
|
mni_100_fre_exp[i] = expdatatodict(mni_100_fre_exp[i])
|
||||||
|
cif_100_bay_exp[i] = expdatatodict(cif_100_bay_exp[i])
|
||||||
|
cif_100_fre_exp[i] = expdatatodict(cif_100_fre_exp[i])
|
||||||
|
|
||||||
|
mni_acc_bay_exp[i] = expdatatodict(mni_acc_bay_exp[i])
|
||||||
|
mni_acc_fre_exp[i] = expdatatodict(mni_acc_fre_exp[i])
|
||||||
|
cif_acc_bay_exp[i] = expdatatodict(cif_acc_bay_exp[i])
|
||||||
|
cif_acc_fre_exp[i] = expdatatodict(cif_acc_fre_exp[i])
|
||||||
|
|
||||||
|
mni_wat_bay_exp[i] = expdatatodict(mni_wat_bay_exp[i])
|
||||||
|
mni_wat_fre_exp[i] = expdatatodict(mni_wat_fre_exp[i])
|
||||||
|
cif_wat_bay_exp[i] = expdatatodict(cif_wat_bay_exp[i])
|
||||||
|
cif_wat_fre_exp[i] = expdatatodict(cif_wat_fre_exp[i])
|
||||||
|
|
||||||
|
mni_est_bay_exp[i] = expdatatodict(mni_est_bay_exp[i])
|
||||||
|
mni_est_fre_exp[i] = expdatatodict(mni_est_fre_exp[i])
|
||||||
|
cif_est_bay_exp[i] = expdatatodict(cif_est_bay_exp[i])
|
||||||
|
cif_est_fre_exp[i] = expdatatodict(cif_est_fre_exp[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
all_data_exp = Dict(
|
||||||
|
"mni" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"cif" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
all_data_exp["mni"][s]["100"]["bay"] =
|
||||||
|
(mean(mni_100_bay_exp[s]["acc"]) + mean(mni_100_bay_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["mni"][s]["100"]["frq"] =
|
||||||
|
(mean(mni_100_fre_exp[s]["acc"]) + mean(mni_100_fre_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["cif"][s]["100"]["bay"] =
|
||||||
|
(mean(cif_100_bay_exp[s]["acc"]) + mean(cif_100_bay_exp[s]["pre"])) / 2
|
||||||
|
all_data_ene["cif"][s]["100"]["frq"] =
|
||||||
|
(mean(cif_100_fre_exp[s]["acc"]) + mean(cif_100_fre_exp[s]["pre"])) / 2
|
||||||
|
|
||||||
|
all_data_exp["mni"][s]["acc"]["bay"] =
|
||||||
|
(mean(mni_acc_bay_exp[s]["acc"]) + mean(mni_acc_bay_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["mni"][s]["acc"]["frq"] =
|
||||||
|
(mean(mni_acc_fre_exp[s]["acc"]) + mean(mni_acc_fre_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["cif"][s]["acc"]["bay"] =
|
||||||
|
(mean(cif_acc_bay_exp[s]["acc"]) + mean(cif_acc_bay_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["cif"][s]["acc"]["frq"] =
|
||||||
|
(mean(cif_acc_fre_exp[s]["acc"]) + mean(cif_acc_fre_exp[s]["pre"])) / 2
|
||||||
|
|
||||||
|
|
||||||
|
all_data_exp["mni"][s]["wat"]["bay"] =
|
||||||
|
(mean(mni_wat_bay_exp[s]["acc"]) + mean(mni_wat_bay_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["mni"][s]["wat"]["frq"] =
|
||||||
|
(mean(mni_wat_fre_exp[s]["acc"]) + mean(mni_wat_fre_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["cif"][s]["wat"]["bay"] =
|
||||||
|
(mean(cif_wat_bay_exp[s]["acc"]) + mean(cif_wat_bay_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["cif"][s]["wat"]["frq"] =
|
||||||
|
(mean(cif_wat_fre_exp[s]["acc"]) + mean(cif_wat_fre_exp[s]["pre"])) / 2
|
||||||
|
|
||||||
|
all_data_exp["mni"][s]["est"]["bay"] =
|
||||||
|
(mean(mni_est_bay_exp[s]["acc"]) + mean(mni_est_bay_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["mni"][s]["est"]["frq"] =
|
||||||
|
(mean(mni_est_fre_exp[s]["acc"]) + mean(mni_est_fre_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["cif"][s]["est"]["bay"] =
|
||||||
|
(mean(cif_est_bay_exp[s]["acc"]) + mean(cif_est_bay_exp[s]["pre"])) / 2
|
||||||
|
all_data_exp["cif"][s]["est"]["frq"] =
|
||||||
|
(mean(cif_est_fre_exp[s]["acc"]) + mean(cif_est_fre_exp[s]["pre"])) / 2
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
# means
|
||||||
|
=#
|
||||||
|
|
||||||
|
(all_data_exp["mni"][5]["100"]["bay"] * 100) / all_data_ene["mni"][5]["100"]["bay"]
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,285 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
using Random
|
||||||
|
|
||||||
|
#=
|
||||||
|
Obtain energy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
#mni_folder_1 = "ini_exp_data/"
|
||||||
|
|
||||||
|
|
||||||
|
mni_folder_100 = "exp_100_epochs/";
|
||||||
|
cif_folder_100 = "CIFAR_100_epoch/";
|
||||||
|
|
||||||
|
mni_folder_acc = "data_bounded/";
|
||||||
|
cif_folder_acc = "CIFAR_acc_bound/";
|
||||||
|
|
||||||
|
mni_folder_wat = "data_budget/";
|
||||||
|
cif_folder_wat = "CIFAR_energy_bound/";
|
||||||
|
|
||||||
|
mni_folder_est = "early_stop_res/";
|
||||||
|
cif_folder_est = "CIFAR_early_stop/";
|
||||||
|
|
||||||
|
bayes_model = "bayes";
|
||||||
|
freq_model = "freq";
|
||||||
|
w_type = "watt";
|
||||||
|
e_type = "exp";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load GPU data
|
||||||
|
=#
|
||||||
|
mni_100_bay_ene = getgpudata(mni_folder_100, bayes_model, w_type, "eo");
|
||||||
|
mni_100_fre_ene = getgpudata(mni_folder_100, freq_model, w_type, "eo");
|
||||||
|
cif_100_bay_ene = getgpudata(cif_folder_100, bayes_model, w_type, "eo");
|
||||||
|
cif_100_fre_ene = getgpudata(cif_folder_100, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Define CPU paths
|
||||||
|
=#
|
||||||
|
cif = "cifar";
|
||||||
|
mni = "mnist";
|
||||||
|
bay = "bayes";
|
||||||
|
wat = "cpu_watts";
|
||||||
|
frq = "freq";
|
||||||
|
ram = "ram_use";
|
||||||
|
_100 = "100";
|
||||||
|
acc = "acc";
|
||||||
|
es = "es";
|
||||||
|
wbud = "wbud";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load CPU data
|
||||||
|
=#
|
||||||
|
bay_cif_100_ene = readcpudata(cif, bay, wat, _100);
|
||||||
|
bay_mni_100_ene = readcpudata(mni, bay, wat, _100);
|
||||||
|
frq_cif_100_ene = readcpudata(cif, frq, wat, _100);
|
||||||
|
frq_mni_100_ene = readcpudata(mni, frq, wat, _100);
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
bay_cif_100_ene[s] = round.(getcpuwatt(bay_cif_100_ene[s]))
|
||||||
|
bay_mni_100_ene[s] = round.(getcpuwatt(bay_mni_100_ene[s]))
|
||||||
|
frq_cif_100_ene[s] = round.(getcpuwatt(frq_cif_100_ene[s]))
|
||||||
|
frq_mni_100_ene[s] = round.(getcpuwatt(frq_mni_100_ene[s]))
|
||||||
|
end
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
mni_100_bay_ene[s]["Ene"] = vcat(mni_100_bay_ene[s]["Ene"], bay_mni_100_ene[s])
|
||||||
|
mni_100_fre_ene[s]["Ene"] = vcat(mni_100_fre_ene[s]["Ene"], frq_mni_100_ene[s])
|
||||||
|
cif_100_bay_ene[s]["Ene"] = vcat(cif_100_bay_ene[s]["Ene"], bay_cif_100_ene[s])
|
||||||
|
cif_100_fre_ene[s]["Ene"] = vcat(cif_100_fre_ene[s]["Ene"], frq_cif_100_ene[s])
|
||||||
|
end
|
||||||
|
|
||||||
|
ene_data = Dict("mni" => Dict("bay" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"fre" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])),
|
||||||
|
"cif" => Dict("bay" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"fre" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])))
|
||||||
|
|
||||||
|
#ene_data = Dict("mni" => Dict("bay" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
# "fre" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)),
|
||||||
|
# "cif" => Dict("bay" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
# "fre" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)))
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
ene_data["mni"]["bay"][s] = sum.(join_vectors(resize1(makechunks(shuffle(mni_100_bay_ene[s]["Ene"]), 100))[1:50]))
|
||||||
|
ene_data["mni"]["fre"][s] = sum.(join_vectors(resize1(makechunks(shuffle(mni_100_fre_ene[s]["Ene"]), 100))[1:50]))
|
||||||
|
ene_data["cif"]["bay"][s] = sum.(join_vectors(resize1(makechunks(shuffle(cif_100_bay_ene[s]["Ene"]), 100))[1:50]))
|
||||||
|
ene_data["cif"]["fre"][s] = sum.(join_vectors(resize1(makechunks(shuffle(cif_100_fre_ene[s]["Ene"]), 100))[1:50]))
|
||||||
|
end
|
||||||
|
|
||||||
|
#for s = 1:5
|
||||||
|
# ene_data["mni"]["bay"][s] = sum(mni_100_bay_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["mni"]["fre"][s] = sum(mni_100_fre_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["cif"]["bay"][s] = sum(cif_100_bay_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["cif"]["fre"][s] = sum(cif_100_fre_ene[s]["Ene"]) / 100
|
||||||
|
#end
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load Accuracy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
mni_100_bay_exp = getgpudata(mni_folder_100, bayes_model, e_type, "eo");
|
||||||
|
mni_100_fre_exp = getgpudata(mni_folder_100, freq_model, e_type, "eo");
|
||||||
|
cif_100_bay_exp = getgpudata(cif_folder_100, bayes_model, e_type, "eo");
|
||||||
|
cif_100_fre_exp = getgpudata(cif_folder_100, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1:5
|
||||||
|
mni_100_bay_exp[i] = expdatatodict(mni_100_bay_exp[i])
|
||||||
|
mni_100_fre_exp[i] = expdatatodict(mni_100_fre_exp[i])
|
||||||
|
cif_100_bay_exp[i] = expdatatodict(cif_100_bay_exp[i])
|
||||||
|
cif_100_fre_exp[i] = expdatatodict(cif_100_fre_exp[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
original_vectors = Dict("LeNet" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])),
|
||||||
|
"BCNN" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])))
|
||||||
|
|
||||||
|
|
||||||
|
for i in 1:5
|
||||||
|
original_vectors["LeNet"]["MNIST"][i] = (mni_100_fre_exp[i]["acc"][1:50] ./ ene_data["mni"]["fre"][i]) * 100
|
||||||
|
original_vectors["BCNN"]["MNIST"][i] = (mni_100_bay_exp[i]["acc"][1:50] ./ ene_data["mni"]["bay"][i]) * 100
|
||||||
|
original_vectors["LeNet"]["CIFAR"][i] = (cif_100_fre_exp[i]["acc"][1:50] ./ ene_data["cif"]["fre"][i]) * 100
|
||||||
|
original_vectors["BCNN"]["CIFAR"][i] = (cif_100_bay_exp[i]["acc"][1:50] ./ ene_data["cif"]["bay"][i]) * 100
|
||||||
|
end
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["LeNet"]["MNIST"][1],
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["LeNet"]["MNIST"][2],
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["LeNet"]["MNIST"][3],
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["LeNet"]["MNIST"][4],
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["LeNet"]["MNIST"][5],
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(255,195,001)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["BCNN"]["MNIST"][1],
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["BCNN"]["MNIST"][2],
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,094,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["BCNN"]["MNIST"][3],
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,126,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["BCNN"]["MNIST"][4],
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,150,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["BCNN"]["MNIST"][5],
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,167,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Efficency",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
opacity = 0.9,
|
||||||
|
#xaxis_range = [-1, 5],
|
||||||
|
#xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_efficiency_epoch.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["LeNet"]["CIFAR"][1],
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["LeNet"]["CIFAR"][2],
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["LeNet"]["CIFAR"][3],
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["LeNet"]["CIFAR"][4],
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["LeNet"]["CIFAR"][5],
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(255,195,001)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["BCNN"]["CIFAR"][1],
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["BCNN"]["CIFAR"][2],
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,094,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["BCNN"]["CIFAR"][3],
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,126,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["BCNN"]["CIFAR"][4],
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,150,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors["BCNN"]["CIFAR"][5],
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,167,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Efficency",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
opacity = 0.9,
|
||||||
|
#xaxis_range = [-1, 5],
|
||||||
|
#xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_efficiency_epoch.png")
|
||||||
|
|
|
@ -0,0 +1,455 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
using Random
|
||||||
|
|
||||||
|
#=
|
||||||
|
Obtain energy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
#mni_folder_1 = "ini_exp_data/"
|
||||||
|
|
||||||
|
|
||||||
|
mni_folder_100 = "exp_100_epochs/";
|
||||||
|
cif_folder_100 = "CIFAR_100_epoch/";
|
||||||
|
|
||||||
|
mni_folder_acc = "data_bounded/";
|
||||||
|
cif_folder_acc = "CIFAR_acc_bound/";
|
||||||
|
|
||||||
|
mni_folder_wat = "data_budget/";
|
||||||
|
cif_folder_wat = "CIFAR_energy_bound/";
|
||||||
|
|
||||||
|
mni_folder_est = "early_stop_res/";
|
||||||
|
cif_folder_est = "CIFAR_early_stop/";
|
||||||
|
|
||||||
|
bayes_model = "bayes";
|
||||||
|
freq_model = "freq";
|
||||||
|
w_type = "watt";
|
||||||
|
e_type = "exp";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load GPU data
|
||||||
|
=#
|
||||||
|
mni_100_bay_ene = getgpudata(mni_folder_100, bayes_model, w_type, "eo");
|
||||||
|
mni_100_fre_ene = getgpudata(mni_folder_100, freq_model, w_type, "eo");
|
||||||
|
cif_100_bay_ene = getgpudata(cif_folder_100, bayes_model, w_type, "eo");
|
||||||
|
cif_100_fre_ene = getgpudata(cif_folder_100, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Define CPU paths
|
||||||
|
=#
|
||||||
|
cif = "cifar";
|
||||||
|
mni = "mnist";
|
||||||
|
bay = "bayes";
|
||||||
|
wat = "cpu_watts";
|
||||||
|
frq = "freq";
|
||||||
|
ram = "ram_use";
|
||||||
|
_100 = "100";
|
||||||
|
acc = "acc";
|
||||||
|
es = "es";
|
||||||
|
wbud = "wbud";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load CPU data
|
||||||
|
=#
|
||||||
|
bay_cif_100_ene = readcpudata(cif, bay, wat, _100);
|
||||||
|
bay_mni_100_ene = readcpudata(mni, bay, wat, _100);
|
||||||
|
frq_cif_100_ene = readcpudata(cif, frq, wat, _100);
|
||||||
|
frq_mni_100_ene = readcpudata(mni, frq, wat, _100);
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
bay_cif_100_ene[s] = round.(getcpuwatt(bay_cif_100_ene[s]))
|
||||||
|
bay_mni_100_ene[s] = round.(getcpuwatt(bay_mni_100_ene[s]))
|
||||||
|
frq_cif_100_ene[s] = round.(getcpuwatt(frq_cif_100_ene[s]))
|
||||||
|
frq_mni_100_ene[s] = round.(getcpuwatt(frq_mni_100_ene[s]))
|
||||||
|
end
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
mni_100_bay_ene[s]["Ene"] = vcat(mni_100_bay_ene[s]["Ene"], bay_mni_100_ene[s])
|
||||||
|
mni_100_fre_ene[s]["Ene"] = vcat(mni_100_fre_ene[s]["Ene"], frq_mni_100_ene[s])
|
||||||
|
cif_100_bay_ene[s]["Ene"] = vcat(cif_100_bay_ene[s]["Ene"], bay_cif_100_ene[s])
|
||||||
|
cif_100_fre_ene[s]["Ene"] = vcat(cif_100_fre_ene[s]["Ene"], frq_cif_100_ene[s])
|
||||||
|
end
|
||||||
|
|
||||||
|
ene_data = Dict("mni" => Dict("bay" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"fre" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])),
|
||||||
|
"cif" => Dict("bay" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"fre" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])))
|
||||||
|
|
||||||
|
#ene_data = Dict("mni" => Dict("bay" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
# "fre" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)),
|
||||||
|
# "cif" => Dict("bay" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
# "fre" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)))
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
ene_data["mni"]["bay"][s] = sum.(join_vectors(resize1(makechunks(shuffle(mni_100_bay_ene[s]["Ene"]), 100))[1:50]))
|
||||||
|
ene_data["mni"]["fre"][s] = sum.(join_vectors(resize1(makechunks(shuffle(mni_100_fre_ene[s]["Ene"]), 100))[1:50]))
|
||||||
|
ene_data["cif"]["bay"][s] = sum.(join_vectors(resize1(makechunks(shuffle(cif_100_bay_ene[s]["Ene"]), 100))[1:50]))
|
||||||
|
ene_data["cif"]["fre"][s] = sum.(join_vectors(resize1(makechunks(shuffle(cif_100_fre_ene[s]["Ene"]), 100))[1:50]))
|
||||||
|
end
|
||||||
|
|
||||||
|
#for s = 1:5
|
||||||
|
# ene_data["mni"]["bay"][s] = sum(mni_100_bay_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["mni"]["fre"][s] = sum(mni_100_fre_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["cif"]["bay"][s] = sum(cif_100_bay_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["cif"]["fre"][s] = sum(cif_100_fre_ene[s]["Ene"]) / 100
|
||||||
|
#end
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load Accuracy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
mni_100_bay_exp = getgpudata(mni_folder_100, bayes_model, e_type, "eo");
|
||||||
|
mni_100_fre_exp = getgpudata(mni_folder_100, freq_model, e_type, "eo");
|
||||||
|
cif_100_bay_exp = getgpudata(cif_folder_100, bayes_model, e_type, "eo");
|
||||||
|
cif_100_fre_exp = getgpudata(cif_folder_100, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1:5
|
||||||
|
mni_100_bay_exp[i] = expdatatodict(mni_100_bay_exp[i])
|
||||||
|
mni_100_fre_exp[i] = expdatatodict(mni_100_fre_exp[i])
|
||||||
|
cif_100_bay_exp[i] = expdatatodict(cif_100_bay_exp[i])
|
||||||
|
cif_100_fre_exp[i] = expdatatodict(cif_100_fre_exp[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
original_vectors_acc = Dict("LeNet" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])),
|
||||||
|
"BCNN" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])))
|
||||||
|
|
||||||
|
|
||||||
|
for i in 1:5
|
||||||
|
original_vectors_acc["LeNet"]["MNIST"][i] = mni_100_fre_exp[i]["acc"][1:50]
|
||||||
|
original_vectors_acc["BCNN"]["MNIST"][i] = mni_100_bay_exp[i]["acc"][1:50]
|
||||||
|
original_vectors_acc["LeNet"]["CIFAR"][i] = cif_100_fre_exp[i]["acc"][1:50]
|
||||||
|
original_vectors_acc["BCNN"]["CIFAR"][i] = cif_100_bay_exp[i]["acc"][1:50]
|
||||||
|
end
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["LeNet"]["MNIST"][1],
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["LeNet"]["MNIST"][2],
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["LeNet"]["MNIST"][3],
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["LeNet"]["MNIST"][4],
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["LeNet"]["MNIST"][5],
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(255,195,001)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["BCNN"]["MNIST"][1],
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["BCNN"]["MNIST"][2],
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,094,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["BCNN"]["MNIST"][3],
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,126,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["BCNN"]["MNIST"][4],
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,150,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["BCNN"]["MNIST"][5],
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,167,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Efficency",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
opacity = 0.9,
|
||||||
|
#xaxis_range = [-1, 5],
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
#xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_50_tacc.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["LeNet"]["CIFAR"][1],
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["LeNet"]["CIFAR"][2],
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["LeNet"]["CIFAR"][3],
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["LeNet"]["CIFAR"][4],
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["LeNet"]["CIFAR"][5],
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(255,195,001)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["BCNN"]["CIFAR"][1],
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["BCNN"]["CIFAR"][2],
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,094,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["BCNN"]["CIFAR"][3],
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,126,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["BCNN"]["CIFAR"][4],
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,150,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_acc["BCNN"]["CIFAR"][5],
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,167,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Efficency",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
opacity = 0.9,
|
||||||
|
#xaxis_range = [-1, 5],
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
#xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_50_tacc.png")
|
||||||
|
|
||||||
|
|
||||||
|
original_vectors_pre = Dict("LeNet" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])),
|
||||||
|
"BCNN" => Dict("MNIST" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"CIFAR" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])))
|
||||||
|
|
||||||
|
|
||||||
|
for i in 1:5
|
||||||
|
original_vectors_pre["LeNet"]["MNIST"][i] = mni_100_fre_exp[i]["pre"][1:50]
|
||||||
|
original_vectors_pre["BCNN"]["MNIST"][i] = mni_100_bay_exp[i]["pre"][1:50]
|
||||||
|
original_vectors_pre["LeNet"]["CIFAR"][i] = cif_100_fre_exp[i]["pre"][1:50]
|
||||||
|
original_vectors_pre["BCNN"]["CIFAR"][i] = cif_100_bay_exp[i]["pre"][1:50]
|
||||||
|
end
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["LeNet"]["MNIST"][1],
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["LeNet"]["MNIST"][2],
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["LeNet"]["MNIST"][3],
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["LeNet"]["MNIST"][4],
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["LeNet"]["MNIST"][5],
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(255,195,001)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["BCNN"]["MNIST"][1],
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["BCNN"]["MNIST"][2],
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,094,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["BCNN"]["MNIST"][3],
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,126,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["BCNN"]["MNIST"][4],
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,150,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["BCNN"]["MNIST"][5],
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,167,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Efficency",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
opacity = 0.9,
|
||||||
|
#xaxis_range = [-1, 5],
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
#xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_50_tpre.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["LeNet"]["CIFAR"][1],
|
||||||
|
name = "LeNet 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["LeNet"]["CIFAR"][2],
|
||||||
|
name = "LeNet 2",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["LeNet"]["CIFAR"][3],
|
||||||
|
name = "LeNet 3",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["LeNet"]["CIFAR"][4],
|
||||||
|
name = "LeNet 4",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["LeNet"]["CIFAR"][5],
|
||||||
|
name = "LeNet 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(255,195,001)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["BCNN"]["CIFAR"][1],
|
||||||
|
name = "BCNN 1",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["BCNN"]["CIFAR"][2],
|
||||||
|
name = "BCNN 2",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,094,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["BCNN"]["CIFAR"][3],
|
||||||
|
name = "BCNN 3",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,126,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["BCNN"]["CIFAR"][4],
|
||||||
|
name = "BCNN 4",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,150,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
#x = ["1", "2", "3", "4", "5"],
|
||||||
|
y = original_vectors_pre["BCNN"]["CIFAR"][5],
|
||||||
|
name = "BCNN 5",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(018,167,219)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Efficency",
|
||||||
|
xaxis_title_text = "Epoch";
|
||||||
|
opacity = 0.9,
|
||||||
|
#xaxis_range = [-1, 5],
|
||||||
|
yaxis_range = [0, 1],
|
||||||
|
#xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_50_tpre.png")
|
||||||
|
|
|
@ -0,0 +1,157 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
using Random
|
||||||
|
using Printf
|
||||||
|
|
||||||
|
#=
|
||||||
|
Obtain energy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
#mni_folder_1 = "ini_exp_data/"
|
||||||
|
|
||||||
|
|
||||||
|
mni_folder_100 = "exp_100_epochs/";
|
||||||
|
cif_folder_100 = "CIFAR_100_epoch/";
|
||||||
|
|
||||||
|
mni_folder_acc = "data_bounded/";
|
||||||
|
cif_folder_acc = "CIFAR_acc_bound/";
|
||||||
|
|
||||||
|
mni_folder_wat = "data_budget/";
|
||||||
|
cif_folder_wat = "CIFAR_energy_bound/";
|
||||||
|
|
||||||
|
mni_folder_est = "early_stop_res/";
|
||||||
|
cif_folder_est = "CIFAR_early_stop/";
|
||||||
|
|
||||||
|
bayes_model = "bayes";
|
||||||
|
freq_model = "freq";
|
||||||
|
w_type = "watt";
|
||||||
|
e_type = "exp";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load GPU data
|
||||||
|
=#
|
||||||
|
mni_100_bay_ene = getgpudata(mni_folder_100, bayes_model, w_type, "eo");
|
||||||
|
mni_100_fre_ene = getgpudata(mni_folder_100, freq_model, w_type, "eo");
|
||||||
|
cif_100_bay_ene = getgpudata(cif_folder_100, bayes_model, w_type, "eo");
|
||||||
|
cif_100_fre_ene = getgpudata(cif_folder_100, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Define CPU paths
|
||||||
|
=#
|
||||||
|
cif = "cifar";
|
||||||
|
mni = "mnist";
|
||||||
|
bay = "bayes";
|
||||||
|
wat = "cpu_watts";
|
||||||
|
frq = "freq";
|
||||||
|
ram = "ram_use";
|
||||||
|
_100 = "100";
|
||||||
|
acc = "acc";
|
||||||
|
es = "es";
|
||||||
|
wbud = "wbud";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load CPU data
|
||||||
|
=#
|
||||||
|
bay_cif_100_ene = readcpudata(cif, bay, wat, _100);
|
||||||
|
bay_mni_100_ene = readcpudata(mni, bay, wat, _100);
|
||||||
|
frq_cif_100_ene = readcpudata(cif, frq, wat, _100);
|
||||||
|
frq_mni_100_ene = readcpudata(mni, frq, wat, _100);
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
bay_cif_100_ene[s] = round.(getcpuwatt(bay_cif_100_ene[s]))
|
||||||
|
bay_mni_100_ene[s] = round.(getcpuwatt(bay_mni_100_ene[s]))
|
||||||
|
frq_cif_100_ene[s] = round.(getcpuwatt(frq_cif_100_ene[s]))
|
||||||
|
frq_mni_100_ene[s] = round.(getcpuwatt(frq_mni_100_ene[s]))
|
||||||
|
end
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
mni_100_bay_ene[s]["Ene"] = vcat(mni_100_bay_ene[s]["Ene"], bay_mni_100_ene[s])
|
||||||
|
mni_100_fre_ene[s]["Ene"] = vcat(mni_100_fre_ene[s]["Ene"], frq_mni_100_ene[s])
|
||||||
|
cif_100_bay_ene[s]["Ene"] = vcat(cif_100_bay_ene[s]["Ene"], bay_cif_100_ene[s])
|
||||||
|
cif_100_fre_ene[s]["Ene"] = vcat(cif_100_fre_ene[s]["Ene"], frq_cif_100_ene[s])
|
||||||
|
end
|
||||||
|
|
||||||
|
ene_data = Dict("mni" => Dict("bay" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"fre" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])),
|
||||||
|
"cif" => Dict("bay" => Dict(1 => [],2 => [],3 => [],4 => [],5 => []),
|
||||||
|
"fre" => Dict(1 => [],2 => [],3 => [],4 => [],5 => [])))
|
||||||
|
|
||||||
|
#ene_data = Dict("mni" => Dict("bay" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
# "fre" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)),
|
||||||
|
# "cif" => Dict("bay" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
# "fre" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)))
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
ene_data["mni"]["bay"][s] = sum.(join_vectors(resize1(makechunks(shuffle(mni_100_bay_ene[s]["Ene"]), 100))[1:100]))
|
||||||
|
ene_data["mni"]["fre"][s] = sum.(join_vectors(resize1(makechunks(shuffle(mni_100_fre_ene[s]["Ene"]), 100))[1:100]))
|
||||||
|
ene_data["cif"]["bay"][s] = sum.(join_vectors(resize1(makechunks(shuffle(cif_100_bay_ene[s]["Ene"]), 100))[1:100]))
|
||||||
|
ene_data["cif"]["fre"][s] = sum.(join_vectors(resize1(makechunks(shuffle(cif_100_fre_ene[s]["Ene"]), 100))[1:100]))
|
||||||
|
end
|
||||||
|
|
||||||
|
#for s = 1:5
|
||||||
|
# ene_data["mni"]["bay"][s] = sum(mni_100_bay_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["mni"]["fre"][s] = sum(mni_100_fre_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["cif"]["bay"][s] = sum(cif_100_bay_ene[s]["Ene"]) / 100
|
||||||
|
# ene_data["cif"]["fre"][s] = sum(cif_100_fre_ene[s]["Ene"]) / 100
|
||||||
|
#end
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load Accuracy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
mni_100_bay_exp = getgpudata(mni_folder_100, bayes_model, e_type, "eo");
|
||||||
|
mni_100_fre_exp = getgpudata(mni_folder_100, freq_model, e_type, "eo");
|
||||||
|
cif_100_bay_exp = getgpudata(cif_folder_100, bayes_model, e_type, "eo");
|
||||||
|
cif_100_fre_exp = getgpudata(cif_folder_100, freq_model, e_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
for i = 1:5
|
||||||
|
mni_100_bay_exp[i] = expdatatodict(mni_100_bay_exp[i])
|
||||||
|
mni_100_fre_exp[i] = expdatatodict(mni_100_fre_exp[i])
|
||||||
|
cif_100_bay_exp[i] = expdatatodict(cif_100_bay_exp[i])
|
||||||
|
cif_100_fre_exp[i] = expdatatodict(cif_100_fre_exp[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
original_vectors_acc = Dict("LeNet" => Dict("MNIST" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
"CIFAR" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)),
|
||||||
|
"BCNN" => Dict("MNIST" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
"CIFAR" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)))
|
||||||
|
|
||||||
|
|
||||||
|
for i in 1:5
|
||||||
|
original_vectors_acc["LeNet"]["MNIST"][i] = mean(mni_100_fre_exp[i]["acc"][1:100])
|
||||||
|
@printf "LeNet-5 on MNIST acc size %i Metric: %-.8f\n" i original_vectors_acc["LeNet"]["MNIST"][i]
|
||||||
|
original_vectors_acc["BCNN"]["MNIST"][i] = mean(mni_100_bay_exp[i]["acc"][1:100])
|
||||||
|
@printf "BCNN-5 on MNIST acc size %i Metric: %-.8f\n" i original_vectors_acc["BCNN"]["MNIST"][i]
|
||||||
|
original_vectors_acc["LeNet"]["CIFAR"][i] = mean(cif_100_fre_exp[i]["acc"][1:100])
|
||||||
|
@printf "LeNet-5 on CIFAR acc size %i Metric: %-.8f\n" i original_vectors_acc["LeNet"]["CIFAR"][i]
|
||||||
|
original_vectors_acc["BCNN"]["CIFAR"][i] = mean(cif_100_bay_exp[i]["acc"][1:100])
|
||||||
|
@printf "BCNN-5 on CIFAR acc size %i Metric: %-.8f\n" i original_vectors_acc["BCNN"]["CIFAR"][i]
|
||||||
|
end
|
||||||
|
|
||||||
|
println("\n\n\n")
|
||||||
|
|
||||||
|
original_vectors_pre = Dict("LeNet" => Dict("MNIST" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
"CIFAR" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)),
|
||||||
|
"BCNN" => Dict("MNIST" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0),
|
||||||
|
"CIFAR" => Dict(1 => 0.0,2 => 0.0,3 => 0.0,4 => 0.0,5 => 0.0)))
|
||||||
|
|
||||||
|
|
||||||
|
for i in 1:5
|
||||||
|
original_vectors_pre["LeNet"]["MNIST"][i] = mean(mni_100_fre_exp[i]["pre"][1:100])
|
||||||
|
@printf "LeNet-5 on MNIST pre size %i Metric: %-.8f\n" i original_vectors_pre["LeNet"]["MNIST"][i]
|
||||||
|
original_vectors_pre["BCNN"]["MNIST"][i] = mean(mni_100_bay_exp[i]["pre"][1:100])
|
||||||
|
@printf "BCNN-5 on MNIST pre size %i Metric: %-.8f\n" i original_vectors_pre["BCNN"]["MNIST"][i]
|
||||||
|
original_vectors_pre["LeNet"]["CIFAR"][i] = mean(cif_100_fre_exp[i]["pre"][1:100])
|
||||||
|
@printf "LeNet-5 on CIFAR pre size %i Metric: %-.8f\n" i original_vectors_pre["LeNet"]["CIFAR"][i]
|
||||||
|
original_vectors_pre["BCNN"]["CIFAR"][i] = mean(cif_100_bay_exp[i]["pre"][1:100])
|
||||||
|
@printf "BCNN-5 on CIFAR pre size %i Metric: %-.8f\n" i original_vectors_pre["BCNN"]["CIFAR"][i]
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,386 @@
|
||||||
|
using PlotlyJS
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
using Statistics: mean, std
|
||||||
|
using DataFrames
|
||||||
|
include("aux_func.jl")
|
||||||
|
|
||||||
|
data = load_pickle("efficiency_per_size_sum.pkl");
|
||||||
|
|
||||||
|
#all_data_ene["mni"][s]["50"]["bay"]
|
||||||
|
|
||||||
|
data_type = ["mni", "cif"]
|
||||||
|
model_type = ["bay", "frq"]
|
||||||
|
experiment_type = ["100", "est", "acc", "wat"]
|
||||||
|
|
||||||
|
experiment_100=["50","50","50","50","50"]
|
||||||
|
experiment_est=["est","est","est","est","est"]
|
||||||
|
experiment_wat=["wat","wat","wat","wat","wat"]
|
||||||
|
experiment_acc=["acc","acc","acc","acc","acc"]
|
||||||
|
|
||||||
|
model_bayes = ["BCNN","BCNN","BCNN","BCNN","BCNN"]
|
||||||
|
model_lenet = ["LeNet","LeNet","LeNet","LeNet","LeNet"]
|
||||||
|
|
||||||
|
data_mnist = ["MNIST","MNIST","MNIST","MNIST","MNIST"]
|
||||||
|
data_cifar = ["CIFAR","CIFAR","CIFAR","CIFAR","CIFAR"]
|
||||||
|
|
||||||
|
sizes = [1,2,3,4,5]
|
||||||
|
|
||||||
|
# MNIST 100 efficency
|
||||||
|
bayes_100_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_100_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_100_mnist_eff = DataFrame(Efficiency=bayes_100_mnist_eff,Model=model_bayes,Experiment=experiment_100,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
freqs_100_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_100_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_100_mnist_eff = DataFrame(Efficiency=freqs_100_mnist_eff,Model=model_lenet,Experiment=experiment_100,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# MNIST est efficency
|
||||||
|
bayes_est_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_est_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_est_mnist_eff = DataFrame(Efficiency=bayes_est_mnist_eff,Model=model_bayes,Experiment=experiment_est,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
freqs_est_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_est_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_est_mnist_eff = DataFrame(Efficiency=freqs_est_mnist_eff,Model=model_lenet,Experiment=experiment_est,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# MNIST wat efficency
|
||||||
|
bayes_wat_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_wat_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_wat_mnist_eff = DataFrame(Efficiency=bayes_wat_mnist_eff,Model=model_bayes,Experiment=experiment_wat,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
freqs_wat_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_wat_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_wat_mnist_eff = DataFrame(Efficiency=freqs_wat_mnist_eff,Model=model_lenet,Experiment=experiment_wat,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# MNIST acc efficency
|
||||||
|
bayes_acc_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_acc_mnist_eff,
|
||||||
|
data[model_type[1]][data_type[1]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_acc_mnist_eff = DataFrame(Efficiency=bayes_acc_mnist_eff,Model=model_bayes,Experiment=experiment_acc,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
freqs_acc_mnist_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_acc_mnist_eff,
|
||||||
|
data[model_type[2]][data_type[1]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_acc_mnist_eff = DataFrame(Efficiency=freqs_acc_mnist_eff,Model=model_lenet,Experiment=experiment_acc,Dataset=data_mnist,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# CIFAR 100 efficency
|
||||||
|
bayes_100_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_100_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_100_cifar_eff = DataFrame(Efficiency=bayes_100_cifar_eff,Model=model_bayes,Experiment=experiment_100,Dataset=data_cifar,Size=sizes)
|
||||||
|
#for i = 1:5
|
||||||
|
# t_std = std(bayes_100_cifar_eff)
|
||||||
|
# if (bayes_100_cifar_eff[i] > 2 * t_std) || (bayes_100_cifar_eff[i] < 2 * t_std)
|
||||||
|
# bayes_100_cifar_eff[i] = mean(bayes_100_cifar_eff)
|
||||||
|
# end
|
||||||
|
#end
|
||||||
|
|
||||||
|
freqs_100_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_100_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[1]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_100_cifar_eff = DataFrame(Efficiency=freqs_100_cifar_eff,Model=model_lenet,Experiment=experiment_100,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
#for i = 1:5
|
||||||
|
# t_std = std(freqs_100_cifar_eff)
|
||||||
|
# if (freqs_100_cifar_eff[i] > 2 * t_std) || (freqs_100_cifar_eff[i] < 2 * t_std)
|
||||||
|
# freqs_100_cifar_eff[i] = mean(freqs_100_cifar_eff)
|
||||||
|
# end
|
||||||
|
#end
|
||||||
|
|
||||||
|
# CIFAR est efficency
|
||||||
|
bayes_est_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_est_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_est_cifar_eff = DataFrame(Efficiency=bayes_est_cifar_eff,Model=model_bayes,Experiment=experiment_est,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
freqs_est_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_est_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[2]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_est_cifar_eff = DataFrame(Efficiency=freqs_est_cifar_eff,Model=model_lenet,Experiment=experiment_est,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# CIFAR wat efficency
|
||||||
|
bayes_wat_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_wat_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_wat_cifar_eff = DataFrame(Efficiency=bayes_wat_cifar_eff,Model=model_bayes,Experiment=experiment_wat,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
freqs_wat_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_wat_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[4]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_wat_cifar_eff = DataFrame(Efficiency=freqs_wat_cifar_eff,Model=model_lenet,Experiment=experiment_wat,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
|
||||||
|
# CIFAR acc efficency
|
||||||
|
bayes_acc_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
bayes_acc_cifar_eff,
|
||||||
|
data[model_type[1]][data_type[2]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
bayes_acc_cifar_eff = DataFrame(Efficiency=bayes_acc_cifar_eff,Model=model_bayes,Experiment=experiment_acc,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
freqs_acc_cifar_eff = []
|
||||||
|
for s = 1:5
|
||||||
|
push!(
|
||||||
|
freqs_acc_cifar_eff,
|
||||||
|
data[model_type[2]][data_type[2]][experiment_type[3]][string(s)],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
freqs_acc_cifar_eff = DataFrame(Efficiency=freqs_acc_cifar_eff,Model=model_lenet,Experiment=experiment_acc,Dataset=data_cifar,Size=sizes)
|
||||||
|
|
||||||
|
mnist_dataframe = vcat(bayes_100_mnist_eff,freqs_100_mnist_eff,bayes_est_mnist_eff,freqs_est_mnist_eff,bayes_acc_mnist_eff,freqs_acc_mnist_eff,bayes_wat_mnist_eff,freqs_wat_mnist_eff)
|
||||||
|
|
||||||
|
cifar_dataframe = vcat(bayes_100_cifar_eff,freqs_100_cifar_eff,bayes_est_cifar_eff,freqs_est_cifar_eff,bayes_acc_cifar_eff,freqs_acc_cifar_eff,bayes_wat_cifar_eff,freqs_wat_cifar_eff)
|
||||||
|
|
||||||
|
#avg_rate_bcnn = (-8.266684252643054e-5 * 1000)
|
||||||
|
#avg_rate_fcnn = (0.00022035677966088333 * 1000)
|
||||||
|
|
||||||
|
#=
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_100_mnist_eff),
|
||||||
|
y = freqs_100_mnist_eff.Efficiency,
|
||||||
|
name = "LeNet 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_est_mnist_eff),
|
||||||
|
y = freqs_est_mnist_eff.Efficiency,
|
||||||
|
name = "LeNet est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_wat_mnist_eff),
|
||||||
|
y = freqs_wat_mnist_eff.Efficiency,
|
||||||
|
name = "LeNet wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_acc_mnist_eff),
|
||||||
|
y = freqs_acc_mnist_eff.Efficiency,
|
||||||
|
name = "LeNet acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_100_mnist_eff),
|
||||||
|
y = bayes_100_mnist_eff.Efficiency,
|
||||||
|
name = "BCNN 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_est_mnist_eff),
|
||||||
|
y = bayes_est_mnist_eff.Efficiency,
|
||||||
|
name = "BCNN est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(033,081,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_wat_mnist_eff),
|
||||||
|
y = bayes_wat_mnist_eff.Efficiency,
|
||||||
|
name = "BCNN wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(033,115,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_acc_mnist_eff),
|
||||||
|
y = bayes_acc_mnist_eff.Efficiency,
|
||||||
|
name = "BCNN acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(151,177,255)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Efficiency",
|
||||||
|
xaxis_title_text = "Size";
|
||||||
|
xaxis_range = [-1, 5],
|
||||||
|
xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_eff_exp_sum.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_100_cifar_eff),
|
||||||
|
y = freqs_100_cifar_eff.Efficiency,
|
||||||
|
name = "LeNet 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(211,120,000)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_est_cifar_eff),
|
||||||
|
y = freqs_est_cifar_eff.Efficiency,
|
||||||
|
name = "LeNet est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(255,170,017)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_wat_cifar_eff),
|
||||||
|
y = freqs_wat_cifar_eff.Efficiency,
|
||||||
|
name = "LeNet wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(255,187,034)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_fcnn .* freqs_acc_cifar_eff),
|
||||||
|
y = freqs_acc_cifar_eff.Efficiency,
|
||||||
|
name = "LeNet acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(255,204,051)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_100_cifar_eff),
|
||||||
|
y = bayes_100_cifar_eff.Efficiency,
|
||||||
|
name = "BCNN 100",
|
||||||
|
marker = attr(symbol = 4, color = "rgb(055,033,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_est_cifar_eff),
|
||||||
|
y = bayes_est_cifar_eff.Efficiency,
|
||||||
|
name = "BCNN est",
|
||||||
|
marker = attr(symbol = 17, color = "rgb(033,081,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_wat_cifar_eff),
|
||||||
|
y = bayes_wat_cifar_eff.Efficiency,
|
||||||
|
name = "BCNN wat",
|
||||||
|
marker = attr(symbol = 2, color = "rgb(033,115,240)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
scatter(
|
||||||
|
x = ["1", "2", "3", "4", "5"],
|
||||||
|
#y = (-avg_rate_bcnn .* bayes_acc_cifar_eff),
|
||||||
|
y = bayes_acc_cifar_eff.Efficiency,
|
||||||
|
name = "BCNN acc",
|
||||||
|
marker = attr(symbol = 0, color = "rgb(151,177,255)", line_width = 1.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
mode = "overlay",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Efficiency",
|
||||||
|
xaxis_title_text = "Size";
|
||||||
|
xaxis_range = [-1, 5],
|
||||||
|
xaxis_type = "category",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_eff_exp_sum.png")
|
||||||
|
=#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#en_plot = plot(mnist_dataframe, x=:Experiment, y=:Efficiency, boxpoints="all", kind="box")
|
||||||
|
en_plot = plot(
|
||||||
|
mnist_dataframe, x=:Experiment, y=:Efficiency,kind="scatter",mode="markers",color=:Model,
|
||||||
|
quartilemethod="exclusive",
|
||||||
|
marker=attr(size=:Size, sizeref=maximum(mnist_dataframe.Size) / (10^2), sizemode="area")
|
||||||
|
#marker=attr(size=:Size, sizeref=0.1, sizemode="area")
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_scatter_size.png")
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
mnist_dataframe, x=:Experiment, y=:Efficiency,kind="box", boxpoints="all",color=:Model,
|
||||||
|
quartilemethod="exclusive",
|
||||||
|
marker=attr(size=:Size, sizeref=maximum(mnist_dataframe.Size) / (10^2), sizemode="area")
|
||||||
|
#marker=attr(size=:Size, sizeref=0.1, sizemode="area")
|
||||||
|
)
|
||||||
|
savefig(en_plot, "mnist_box_size.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
cifar_dataframe, x=:Experiment, y=:Efficiency,kind="scatter",mode="markers",color=:Model,
|
||||||
|
quartilemethod="exclusive",
|
||||||
|
marker=attr(size=:Size, sizeref=maximum(mnist_dataframe.Size) / (10^2), sizemode="area")
|
||||||
|
#marker=attr(size=:Size, sizeref=0.1, sizemode="area")
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_scatter_size.png")
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
cifar_dataframe, x=:Experiment, y=:Efficiency,kind="box", boxpoints="all",color=:Model,
|
||||||
|
quartilemethod="exclusive",
|
||||||
|
marker=attr(size=:Size, sizeref=maximum(mnist_dataframe.Size) / (10^2), sizemode="area")
|
||||||
|
#marker=attr(size=:Size, sizeref=0.1, sizemode="area")
|
||||||
|
)
|
||||||
|
savefig(en_plot, "cifar_box_size.png")
|
||||||
|
|
|
@ -0,0 +1,663 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using LinearAlgebra
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
#using HDF5
|
||||||
|
|
||||||
|
folder = "ini_exp_data/"
|
||||||
|
|
||||||
|
# Getting the BCNN double precision data
|
||||||
|
dp_bcnn = read("$(folder)dp_bcnn.txt", String);
|
||||||
|
dp_bcnn = split(dp_bcnn, "\n")
|
||||||
|
bool_all = occursin.(r"smsp", dp_bcnn)
|
||||||
|
dp_bcnn_all = dp_bcnn[bool_all]
|
||||||
|
dp_bcnn_all = strip.(dp_bcnn_all)
|
||||||
|
|
||||||
|
bool_add = occursin.(r"dadd", dp_bcnn_all)
|
||||||
|
dp_bcnn_add = dp_bcnn_all[bool_add]
|
||||||
|
dp_bcnn_add = split.(dp_bcnn_add, " ")
|
||||||
|
dp_bcnn_add = filter.(x -> x != "", dp_bcnn_add)
|
||||||
|
temp = []
|
||||||
|
for arr in dp_bcnn_add
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
dp_bcnn_add = temp[:]
|
||||||
|
|
||||||
|
bool_fma = occursin.(r"dfma", dp_bcnn_all)
|
||||||
|
dp_bcnn_fma = dp_bcnn_all[bool_fma]
|
||||||
|
dp_bcnn_fma = split.(dp_bcnn_fma, " ")
|
||||||
|
dp_bcnn_fma = filter.(x -> x != "", dp_bcnn_fma)
|
||||||
|
temp = []
|
||||||
|
for arr in dp_bcnn_fma
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
dp_bcnn_fma = temp[:]
|
||||||
|
|
||||||
|
bool_mul = occursin.(r"dmul", dp_bcnn_all)
|
||||||
|
dp_bcnn_mul = dp_bcnn_all[bool_mul]
|
||||||
|
dp_bcnn_mul = split.(dp_bcnn_mul, " ")
|
||||||
|
dp_bcnn_mul = filter.(x -> x != "", dp_bcnn_mul)
|
||||||
|
temp = []
|
||||||
|
for arr in dp_bcnn_mul
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
dp_bcnn_mul = temp[:]
|
||||||
|
|
||||||
|
#println("Total bcnn double precision FLOPS: $(sum(dp_bcnn_fma)*2 + sum(dp_bcnn_add) + sum(dp_bcnn_mul))")
|
||||||
|
|
||||||
|
|
||||||
|
# Getting the BCNN half precision data
|
||||||
|
hp_bcnn = read("$(folder)hp_bcnn.txt", String);
|
||||||
|
hp_bcnn = split(hp_bcnn, "\n")
|
||||||
|
bool_all = occursin.(r"smsp", hp_bcnn)
|
||||||
|
hp_bcnn_all = hp_bcnn[bool_all]
|
||||||
|
hp_bcnn_all = strip.(hp_bcnn_all)
|
||||||
|
|
||||||
|
bool_add = occursin.(r"hadd", hp_bcnn_all)
|
||||||
|
hp_bcnn_add = hp_bcnn_all[bool_add]
|
||||||
|
hp_bcnn_add = split.(hp_bcnn_add, " ")
|
||||||
|
hp_bcnn_add = filter.(x -> x != "", hp_bcnn_add)
|
||||||
|
temp = []
|
||||||
|
for arr in hp_bcnn_add
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
hp_bcnn_add = temp[:]
|
||||||
|
|
||||||
|
bool_fma = occursin.(r"hfma", hp_bcnn_all)
|
||||||
|
hp_bcnn_fma = hp_bcnn_all[bool_fma]
|
||||||
|
hp_bcnn_fma = split.(hp_bcnn_fma, " ")
|
||||||
|
hp_bcnn_fma = filter.(x -> x != "", hp_bcnn_fma)
|
||||||
|
temp = []
|
||||||
|
for arr in hp_bcnn_fma
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
hp_bcnn_fma = temp[:]
|
||||||
|
|
||||||
|
bool_mul = occursin.(r"hmul", hp_bcnn_all)
|
||||||
|
hp_bcnn_mul = hp_bcnn_all[bool_mul]
|
||||||
|
hp_bcnn_mul = split.(hp_bcnn_mul, " ")
|
||||||
|
hp_bcnn_mul = filter.(x -> x != "", hp_bcnn_mul)
|
||||||
|
temp = []
|
||||||
|
for arr in hp_bcnn_mul
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
hp_bcnn_mul = temp[:]
|
||||||
|
|
||||||
|
#println("Total bcnn half precision FLOPS: $(sum(hp_bcnn_fma)*2 + sum(hp_bcnn_add) + sum(hp_bcnn_mul))")
|
||||||
|
|
||||||
|
# Getting the BCNN single precision data
|
||||||
|
sp_bcnn = read("$(folder)sp_bcnn.txt", String);
|
||||||
|
sp_bcnn = split(sp_bcnn, "\n")
|
||||||
|
bool_all = occursin.(r"smsp", sp_bcnn)
|
||||||
|
sp_bcnn_all = sp_bcnn[bool_all]
|
||||||
|
sp_bcnn_all = strip.(sp_bcnn_all)
|
||||||
|
|
||||||
|
bool_add = occursin.(r"fadd", sp_bcnn_all)
|
||||||
|
sp_bcnn_add = sp_bcnn_all[bool_add]
|
||||||
|
sp_bcnn_add = split.(sp_bcnn_add, " ")
|
||||||
|
sp_bcnn_add = filter.(x -> x != "", sp_bcnn_add)
|
||||||
|
temp = []
|
||||||
|
for arr in sp_bcnn_add
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
sp_bcnn_add = temp[:]
|
||||||
|
|
||||||
|
bool_fma = occursin.(r"ffma", sp_bcnn_all)
|
||||||
|
sp_bcnn_fma = sp_bcnn_all[bool_fma]
|
||||||
|
sp_bcnn_fma = split.(sp_bcnn_fma, " ")
|
||||||
|
sp_bcnn_fma = filter.(x -> x != "", sp_bcnn_fma)
|
||||||
|
temp = []
|
||||||
|
for arr in sp_bcnn_fma
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
sp_bcnn_fma = temp[:]
|
||||||
|
|
||||||
|
bool_mul = occursin.(r"fmul", sp_bcnn_all)
|
||||||
|
sp_bcnn_mul = sp_bcnn_all[bool_mul]
|
||||||
|
sp_bcnn_mul = split.(sp_bcnn_mul, " ")
|
||||||
|
sp_bcnn_mul = filter.(x -> x != "", sp_bcnn_mul)
|
||||||
|
temp = []
|
||||||
|
for arr in sp_bcnn_mul
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
sp_bcnn_mul = temp[:]
|
||||||
|
|
||||||
|
#println("Total bcnn single precision FLOPS: $(sum(sp_bcnn_fma)*2 + sum(sp_bcnn_add) + sum(sp_bcnn_mul))")
|
||||||
|
|
||||||
|
|
||||||
|
# Getting the BCNN memory data
|
||||||
|
mem_bcnn = read("$(folder)memrw_bcnn.txt", String);
|
||||||
|
mem_bcnn = split(mem_bcnn, "\n")
|
||||||
|
bool_all = occursin.(r"dram", mem_bcnn)
|
||||||
|
mem_bcnn_all = mem_bcnn[bool_all]
|
||||||
|
mem_bcnn_all = strip.(mem_bcnn_all)
|
||||||
|
|
||||||
|
bool_read = occursin.(r"read", mem_bcnn_all)
|
||||||
|
mem_bcnn_read = mem_bcnn_all[bool_read]
|
||||||
|
mem_bcnn_read = split.(mem_bcnn_read, " ")
|
||||||
|
mem_bcnn_read = filter.(x -> x != "", mem_bcnn_read)
|
||||||
|
|
||||||
|
bool_write = occursin.(r"write", mem_bcnn_all)
|
||||||
|
mem_bcnn_write = mem_bcnn_all[bool_write]
|
||||||
|
mem_bcnn_write = split.(mem_bcnn_write, " ")
|
||||||
|
mem_bcnn_write = filter.(x -> x != "", mem_bcnn_write)
|
||||||
|
|
||||||
|
mem_bcnn_read = converttobyte(mem_bcnn_read)
|
||||||
|
mem_bcnn_write = converttobyte(mem_bcnn_write)
|
||||||
|
|
||||||
|
#println("Total BCNN memory writes $(sum(mem_bcnn_write)/1048576.0) Mb")
|
||||||
|
#println("Total BCNN memory reads $(sum(mem_bcnn_read)/1048576.0) Mb")
|
||||||
|
|
||||||
|
# Getting the CIFAR BCNN memory data
|
||||||
|
cif_mem_bcnn = read("$(folder)cif_memrw_bcnn.txt", String);
|
||||||
|
cif_mem_bcnn = split(cif_mem_bcnn, "\n")
|
||||||
|
cif_bool_all = occursin.(r"dram", cif_mem_bcnn)
|
||||||
|
cif_mem_bcnn_all = cif_mem_bcnn[cif_bool_all]
|
||||||
|
cif_mem_bcnn_all = strip.(cif_mem_bcnn_all)
|
||||||
|
|
||||||
|
cif_bool_read = occursin.(r"read", cif_mem_bcnn_all)
|
||||||
|
cif_mem_bcnn_read = cif_mem_bcnn_all[cif_bool_read]
|
||||||
|
cif_mem_bcnn_read = split.(cif_mem_bcnn_read, " ")
|
||||||
|
cif_mem_bcnn_read = filter.(x -> x != "", cif_mem_bcnn_read)
|
||||||
|
|
||||||
|
cif_bool_write = occursin.(r"write", cif_mem_bcnn_all)
|
||||||
|
cif_mem_bcnn_write = cif_mem_bcnn_all[cif_bool_write]
|
||||||
|
cif_mem_bcnn_write = split.(cif_mem_bcnn_write, " ")
|
||||||
|
cif_mem_bcnn_write = filter.(x -> x != "", cif_mem_bcnn_write)
|
||||||
|
|
||||||
|
cif_mem_bcnn_read = converttobyte(cif_mem_bcnn_read)
|
||||||
|
cif_mem_bcnn_write = converttobyte(cif_mem_bcnn_write)
|
||||||
|
|
||||||
|
#println("Total CIFAR BCNN memory writes $(sum(cif_mem_bcnn_write)/1048576.0) Mb")
|
||||||
|
#println("Total CIFAR BCNN memory reads $(sum(cif_mem_bcnn_read)/1048576.0) Mb")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Getting the CNN double precision data
|
||||||
|
dp_fcnn = read("$(folder)dp_fcnn.txt", String);
|
||||||
|
dp_fcnn = split(dp_fcnn, "\n")
|
||||||
|
bool_all = occursin.(r"smsp", dp_fcnn)
|
||||||
|
dp_fcnn_all = dp_fcnn[bool_all]
|
||||||
|
dp_fcnn_all = strip.(dp_fcnn_all)
|
||||||
|
|
||||||
|
bool_add = occursin.(r"dadd", dp_fcnn_all)
|
||||||
|
dp_fcnn_add = dp_fcnn_all[bool_add]
|
||||||
|
dp_fcnn_add = split.(dp_fcnn_add, " ")
|
||||||
|
dp_fcnn_add = filter.(x -> x != "", dp_fcnn_add)
|
||||||
|
temp = []
|
||||||
|
for arr in dp_fcnn_add
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
dp_fcnn_add = temp[:]
|
||||||
|
|
||||||
|
bool_fma = occursin.(r"dfma", dp_fcnn_all)
|
||||||
|
dp_fcnn_fma = dp_fcnn_all[bool_fma]
|
||||||
|
dp_fcnn_fma = split.(dp_fcnn_fma, " ")
|
||||||
|
dp_fcnn_fma = filter.(x -> x != "", dp_fcnn_fma)
|
||||||
|
temp = []
|
||||||
|
for arr in dp_fcnn_fma
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
dp_fcnn_fma = temp[:]
|
||||||
|
|
||||||
|
bool_mul = occursin.(r"dmul", dp_fcnn_all)
|
||||||
|
dp_fcnn_mul = dp_fcnn_all[bool_mul]
|
||||||
|
dp_fcnn_mul = split.(dp_fcnn_mul, " ")
|
||||||
|
dp_fcnn_mul = filter.(x -> x != "", dp_fcnn_mul)
|
||||||
|
temp = []
|
||||||
|
for arr in dp_fcnn_mul
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
dp_fcnn_mul = temp[:]
|
||||||
|
|
||||||
|
#println("Total cnn double precision FLOPS: $(sum(dp_fcnn_fma)*2 + sum(dp_fcnn_add) + sum(dp_fcnn_mul))")
|
||||||
|
|
||||||
|
|
||||||
|
# Getting the CNN half precision data
|
||||||
|
hp_fcnn = read("$(folder)hp_fcnn.txt", String);
|
||||||
|
hp_fcnn = split(hp_fcnn, "\n")
|
||||||
|
bool_all = occursin.(r"smsp", hp_fcnn)
|
||||||
|
hp_fcnn_all = hp_fcnn[bool_all]
|
||||||
|
hp_fcnn_all = strip.(hp_fcnn_all)
|
||||||
|
|
||||||
|
bool_add = occursin.(r"hadd", hp_fcnn_all)
|
||||||
|
hp_fcnn_add = hp_fcnn_all[bool_add]
|
||||||
|
hp_fcnn_add = split.(hp_fcnn_add, " ")
|
||||||
|
hp_fcnn_add = filter.(x -> x != "", hp_fcnn_add)
|
||||||
|
temp = []
|
||||||
|
for arr in hp_fcnn_add
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
hp_fcnn_add = temp[:]
|
||||||
|
|
||||||
|
bool_fma = occursin.(r"hfma", hp_fcnn_all)
|
||||||
|
hp_fcnn_fma = hp_fcnn_all[bool_fma]
|
||||||
|
hp_fcnn_fma = split.(hp_fcnn_fma, " ")
|
||||||
|
hp_fcnn_fma = filter.(x -> x != "", hp_fcnn_fma)
|
||||||
|
temp = []
|
||||||
|
for arr in hp_fcnn_fma
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
hp_fcnn_fma = temp[:]
|
||||||
|
|
||||||
|
bool_mul = occursin.(r"hmul", hp_fcnn_all)
|
||||||
|
hp_fcnn_mul = hp_fcnn_all[bool_mul]
|
||||||
|
hp_fcnn_mul = split.(hp_fcnn_mul, " ")
|
||||||
|
hp_fcnn_mul = filter.(x -> x != "", hp_fcnn_mul)
|
||||||
|
temp = []
|
||||||
|
for arr in hp_fcnn_mul
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
hp_fcnn_mul = temp[:]
|
||||||
|
|
||||||
|
#println("Total cnn half precision FLOPS: $(sum(hp_fcnn_fma)*2 + sum(hp_fcnn_add) + sum(hp_fcnn_mul))")
|
||||||
|
|
||||||
|
|
||||||
|
# Getting the CNN single precision data
|
||||||
|
sp_fcnn = read("$(folder)sp_fcnn.txt", String);
|
||||||
|
sp_fcnn = split(sp_fcnn, "\n")
|
||||||
|
bool_all = occursin.(r"smsp", sp_fcnn)
|
||||||
|
sp_fcnn_all = sp_fcnn[bool_all]
|
||||||
|
sp_fcnn_all = strip.(sp_fcnn_all)
|
||||||
|
|
||||||
|
bool_add = occursin.(r"fadd", sp_fcnn_all)
|
||||||
|
sp_fcnn_add = sp_fcnn_all[bool_add]
|
||||||
|
sp_fcnn_add = split.(sp_fcnn_add, " ")
|
||||||
|
sp_fcnn_add = filter.(x -> x != "", sp_fcnn_add)
|
||||||
|
temp = []
|
||||||
|
for arr in sp_fcnn_add
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
sp_fcnn_add = temp[:]
|
||||||
|
|
||||||
|
bool_fma = occursin.(r"ffma", sp_fcnn_all)
|
||||||
|
sp_fcnn_fma = sp_fcnn_all[bool_fma]
|
||||||
|
sp_fcnn_fma = split.(sp_fcnn_fma, " ")
|
||||||
|
sp_fcnn_fma = filter.(x -> x != "", sp_fcnn_fma)
|
||||||
|
temp = []
|
||||||
|
for arr in sp_fcnn_fma
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
sp_fcnn_fma = temp[:]
|
||||||
|
|
||||||
|
bool_mul = occursin.(r"fmul", sp_fcnn_all)
|
||||||
|
sp_fcnn_mul = sp_fcnn_all[bool_mul]
|
||||||
|
sp_fcnn_mul = split.(sp_fcnn_mul, " ")
|
||||||
|
sp_fcnn_mul = filter.(x -> x != "", sp_fcnn_mul)
|
||||||
|
temp = []
|
||||||
|
for arr in sp_fcnn_mul
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
sp_fcnn_mul = temp[:]
|
||||||
|
|
||||||
|
#println("Total cnn single precision FLOPS: $(sum(sp_fcnn_fma)*2 + sum(sp_fcnn_add) + sum(sp_fcnn_mul))")
|
||||||
|
|
||||||
|
|
||||||
|
# Getting the CNN memory data
|
||||||
|
mem_fcnn = read("$(folder)memrw_fcnn.txt", String);
|
||||||
|
mem_fcnn = split(mem_fcnn, "\n")
|
||||||
|
bool_all = occursin.(r"dram", mem_fcnn)
|
||||||
|
mem_fcnn_all = mem_fcnn[bool_all]
|
||||||
|
mem_fcnn_all = strip.(mem_fcnn_all)
|
||||||
|
|
||||||
|
bool_read = occursin.(r"read", mem_fcnn_all)
|
||||||
|
mem_fcnn_read = mem_fcnn_all[bool_read]
|
||||||
|
mem_fcnn_read = split.(mem_fcnn_read, " ")
|
||||||
|
mem_fcnn_read = filter.(x -> x != "", mem_fcnn_read)
|
||||||
|
|
||||||
|
bool_write = occursin.(r"write", mem_fcnn_all)
|
||||||
|
mem_fcnn_write = mem_fcnn_all[bool_write]
|
||||||
|
mem_fcnn_write = split.(mem_fcnn_write, " ")
|
||||||
|
mem_fcnn_write = filter.(x -> x != "", mem_fcnn_write)
|
||||||
|
|
||||||
|
mem_fcnn_read = converttobyte(mem_fcnn_read)
|
||||||
|
mem_fcnn_write = converttobyte(mem_fcnn_write)
|
||||||
|
|
||||||
|
#println("Total CNN memory writes $(sum(mem_fcnn_write)/1048576.0) Mb")
|
||||||
|
#println("Total CNN memory reads $(sum(mem_fcnn_read)/1048576.0) Mb")
|
||||||
|
|
||||||
|
# Getting the CIFAR CNN memory data
|
||||||
|
cif_mem_fcnn = read("$(folder)cif_memrw_fcnn.txt", String);
|
||||||
|
cif_mem_fcnn = split(cif_mem_fcnn, "\n")
|
||||||
|
cif_bool_all = occursin.(r"dram", cif_mem_fcnn)
|
||||||
|
cif_mem_fcnn_all = cif_mem_fcnn[cif_bool_all]
|
||||||
|
cif_mem_fcnn_all = strip.(cif_mem_fcnn_all)
|
||||||
|
|
||||||
|
cif_bool_read = occursin.(r"read", cif_mem_fcnn_all)
|
||||||
|
cif_mem_fcnn_read = cif_mem_fcnn_all[cif_bool_read]
|
||||||
|
cif_mem_fcnn_read = split.(cif_mem_fcnn_read, " ")
|
||||||
|
cif_mem_fcnn_read = filter.(x -> x != "", cif_mem_fcnn_read)
|
||||||
|
|
||||||
|
cif_bool_write = occursin.(r"write", cif_mem_fcnn_all)
|
||||||
|
cif_mem_fcnn_write = cif_mem_fcnn_all[cif_bool_write]
|
||||||
|
cif_mem_fcnn_write = split.(cif_mem_fcnn_write, " ")
|
||||||
|
cif_mem_fcnn_write = filter.(x -> x != "", cif_mem_fcnn_write)
|
||||||
|
|
||||||
|
cif_mem_fcnn_read = converttobyte(cif_mem_fcnn_read)
|
||||||
|
cif_mem_fcnn_write = converttobyte(cif_mem_fcnn_write)
|
||||||
|
|
||||||
|
#println("Total CIFAR CNN memory writes $(sum(cif_mem_fcnn_write)/1048576.0) Mb")
|
||||||
|
#println("Total CIFAR CNN memory reads $(sum(cif_mem_fcnn_read)/1048576.0) Mb")
|
||||||
|
|
||||||
|
# Getting the CIFAR BCNN single precision data
|
||||||
|
cif_sp_bcnn = read("$(folder)cif_sp_bcnn.txt", String);
|
||||||
|
cif_sp_bcnn = split(cif_sp_bcnn, "\n")
|
||||||
|
bool_all = occursin.(r"smsp", cif_sp_bcnn)
|
||||||
|
cif_sp_bcnn_all = cif_sp_bcnn[bool_all]
|
||||||
|
cif_sp_bcnn_all = strip.(cif_sp_bcnn_all)
|
||||||
|
|
||||||
|
bool_add = occursin.(r"fadd", cif_sp_bcnn_all)
|
||||||
|
cif_sp_bcnn_add = cif_sp_bcnn_all[bool_add]
|
||||||
|
cif_sp_bcnn_add = split.(cif_sp_bcnn_add, " ")
|
||||||
|
cif_sp_bcnn_add = filter.(x -> x != "", cif_sp_bcnn_add)
|
||||||
|
temp = []
|
||||||
|
for arr in cif_sp_bcnn_add
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
cif_sp_bcnn_add = temp[:]
|
||||||
|
|
||||||
|
bool_fma = occursin.(r"ffma", cif_sp_bcnn_all)
|
||||||
|
cif_sp_bcnn_fma = cif_sp_bcnn_all[bool_fma]
|
||||||
|
cif_sp_bcnn_fma = split.(cif_sp_bcnn_fma, " ")
|
||||||
|
cif_sp_bcnn_fma = filter.(x -> x != "", cif_sp_bcnn_fma)
|
||||||
|
temp = []
|
||||||
|
for arr in cif_sp_bcnn_fma
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
cif_sp_bcnn_fma = temp[:]
|
||||||
|
|
||||||
|
bool_mul = occursin.(r"fmul", cif_sp_bcnn_all)
|
||||||
|
cif_sp_bcnn_mul = cif_sp_bcnn_all[bool_mul]
|
||||||
|
cif_sp_bcnn_mul = split.(cif_sp_bcnn_mul, " ")
|
||||||
|
cif_sp_bcnn_mul = filter.(x -> x != "", cif_sp_bcnn_mul)
|
||||||
|
temp = []
|
||||||
|
for arr in cif_sp_bcnn_mul
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
cif_sp_bcnn_mul = temp[:]
|
||||||
|
|
||||||
|
#println("Total bcnn CIFAR single precision FLOPS: $(sum(cif_sp_bcnn_fma)*2 + sum(cif_sp_bcnn_add) + sum(cif_sp_bcnn_mul))")
|
||||||
|
|
||||||
|
|
||||||
|
# Getting the CIFAR CNN single precision data
|
||||||
|
cif_sp_fcnn = read("$(folder)cif_sp_fcnn.txt", String);
|
||||||
|
cif_sp_fcnn = split(cif_sp_fcnn, "\n")
|
||||||
|
bool_all = occursin.(r"smsp", cif_sp_fcnn)
|
||||||
|
cif_sp_fcnn_all = cif_sp_fcnn[bool_all]
|
||||||
|
cif_sp_fcnn_all = strip.(cif_sp_fcnn_all)
|
||||||
|
|
||||||
|
bool_add = occursin.(r"fadd", cif_sp_fcnn_all)
|
||||||
|
cif_sp_fcnn_add = cif_sp_fcnn_all[bool_add]
|
||||||
|
cif_sp_fcnn_add = split.(cif_sp_fcnn_add, " ")
|
||||||
|
cif_sp_fcnn_add = filter.(x -> x != "", cif_sp_fcnn_add)
|
||||||
|
temp = []
|
||||||
|
for arr in cif_sp_fcnn_add
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
cif_sp_fcnn_add = temp[:]
|
||||||
|
|
||||||
|
bool_fma = occursin.(r"ffma", cif_sp_fcnn_all)
|
||||||
|
cif_sp_fcnn_fma = cif_sp_fcnn_all[bool_fma]
|
||||||
|
cif_sp_fcnn_fma = split.(cif_sp_fcnn_fma, " ")
|
||||||
|
cif_sp_fcnn_fma = filter.(x -> x != "", cif_sp_fcnn_fma)
|
||||||
|
temp = []
|
||||||
|
for arr in cif_sp_fcnn_fma
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
cif_sp_fcnn_fma = temp[:]
|
||||||
|
|
||||||
|
bool_mul = occursin.(r"fmul", cif_sp_fcnn_all)
|
||||||
|
cif_sp_fcnn_mul = cif_sp_fcnn_all[bool_mul]
|
||||||
|
cif_sp_fcnn_mul = split.(cif_sp_fcnn_mul, " ")
|
||||||
|
cif_sp_fcnn_mul = filter.(x -> x != "", cif_sp_fcnn_mul)
|
||||||
|
temp = []
|
||||||
|
for arr in cif_sp_fcnn_mul
|
||||||
|
append!(temp, parse(Int64, replace(arr[3], r"," => "")))
|
||||||
|
end
|
||||||
|
cif_sp_fcnn_mul = temp[:]
|
||||||
|
|
||||||
|
#println("Total cnn CIFAR single precision FLOPS: $(sum(sp_fcnn_fma)*2 + sum(sp_fcnn_add) + sum(sp_fcnn_mul))")
|
||||||
|
|
||||||
|
#println("\n\n\n\n\n\n")
|
||||||
|
|
||||||
|
# Data moves
|
||||||
|
mov_pj = 0.00125
|
||||||
|
|
||||||
|
# Turing arch values
|
||||||
|
add_μj = 0.0293
|
||||||
|
mul_μj = 0.2933
|
||||||
|
fma_μj = 0.8340
|
||||||
|
|
||||||
|
# Intel arch values
|
||||||
|
add_pj = 0.000111
|
||||||
|
mul_pj = 0.000164
|
||||||
|
fma_pj = 0.000464
|
||||||
|
|
||||||
|
tot_mem_bcnn_w_mb = sum(mem_bcnn_write) #sum((1/norm(mem_bcnn_write)).*mem_bcnn_write) /100
|
||||||
|
tot_mem_bcnn_r_mb = sum(mem_bcnn_read) #sum((1/norm(mem_bcnn_read)).*mem_bcnn_read) /100
|
||||||
|
|
||||||
|
tot_mem_fcnn_w_mb = sum(mem_fcnn_write) #sum((1/norm(mem_fcnn_write)).*mem_fcnn_write) /100
|
||||||
|
tot_mem_fcnn_r_mb = sum(mem_fcnn_read) #sum((1/norm(mem_fcnn_read)).*mem_fcnn_read) /100
|
||||||
|
|
||||||
|
rate_mem_bcnn = (tot_mem_bcnn_w_mb / tot_mem_bcnn_r_mb) * mov_pj
|
||||||
|
rate_mem_fcnn = (tot_mem_fcnn_w_mb / tot_mem_fcnn_r_mb) * mov_pj
|
||||||
|
|
||||||
|
|
||||||
|
cif_tot_mem_bcnn_w_mb = sum(cif_mem_bcnn_write) #sum((1/norm(cif_mem_bcnn_write)).*cif_mem_bcnn_write) /100
|
||||||
|
cif_tot_mem_bcnn_r_mb = sum(cif_mem_bcnn_read) #sum((1/norm(cif_mem_bcnn_read)).*cif_mem_bcnn_read) /100
|
||||||
|
|
||||||
|
cif_tot_mem_fcnn_w_mb = sum(cif_mem_fcnn_write) #sum((1/norm(cif_mem_fcnn_write)).*cif_mem_fcnn_write) /100
|
||||||
|
cif_tot_mem_fcnn_r_mb = sum(cif_mem_fcnn_read) #sum((1/norm(cif_mem_fcnn_read)).*cif_mem_fcnn_read) /100
|
||||||
|
|
||||||
|
cif_rate_mem_bcnn = (cif_tot_mem_bcnn_w_mb / cif_tot_mem_bcnn_r_mb) * mov_pj
|
||||||
|
cif_rate_mem_fcnn = (cif_tot_mem_fcnn_w_mb / cif_tot_mem_fcnn_r_mb) * mov_pj
|
||||||
|
|
||||||
|
|
||||||
|
tot_bcnn_add = sum(sp_bcnn_add) #sum((1/norm(sp_bcnn_add)).*sp_bcnn_add) /100
|
||||||
|
tot_bcnn_mul = sum(sp_bcnn_mul) #sum((1/norm(sp_bcnn_mul)).*sp_bcnn_mul) /100
|
||||||
|
tot_bcnn_fma = sum(sp_bcnn_fma) #sum((1/norm(sp_bcnn_fma)).*sp_bcnn_fma) /100
|
||||||
|
|
||||||
|
tot_fcnn_add = sum(sp_fcnn_add) #sum((1/norm(sp_fcnn_add)).*sp_fcnn_add) /100
|
||||||
|
tot_fcnn_mul = sum(sp_fcnn_mul) #sum((1/norm(sp_fcnn_mul)).*sp_fcnn_mul) /100
|
||||||
|
tot_fcnn_fma = sum(sp_fcnn_fma) #sum((1/norm(sp_fcnn_fma)).*sp_fcnn_fma) /100
|
||||||
|
|
||||||
|
rat_bcnn_add_fma = sum(sp_bcnn_add) / sum(sp_bcnn_fma)
|
||||||
|
rat_bcnn_mul_fma = sum(sp_bcnn_mul) / sum(sp_bcnn_fma)
|
||||||
|
|
||||||
|
rat_fcnn_add_fma = sum(sp_fcnn_add) / sum(sp_fcnn_fma)
|
||||||
|
rat_fcnn_mul_fma = sum(sp_fcnn_mul) / sum(sp_fcnn_fma)
|
||||||
|
|
||||||
|
#=
|
||||||
|
println("Ratio BCNN ADD/FMA: $(rat_bcnn_add_fma)")
|
||||||
|
println("Ratio BCNN MUL/FMA: $(rat_bcnn_mul_fma)")
|
||||||
|
|
||||||
|
println("Ratio FCNN ADD/FMA: $(rat_fcnn_add_fma)")
|
||||||
|
println("Ratio FCNN MUL/FMA: $(rat_fcnn_mul_fma)")
|
||||||
|
=#
|
||||||
|
|
||||||
|
|
||||||
|
cif_tot_bcnn_add = sum(cif_sp_bcnn_add) #sum((1/norm(cif_sp_bcnn_add)).*cif_sp_bcnn_add) /100
|
||||||
|
cif_tot_bcnn_mul = sum(cif_sp_bcnn_mul) #sum((1/norm(cif_sp_bcnn_mul)).*cif_sp_bcnn_mul) /100
|
||||||
|
cif_tot_bcnn_fma = sum(cif_sp_bcnn_fma) #sum((1/norm(cif_sp_bcnn_fma)).*cif_sp_bcnn_fma) /100
|
||||||
|
|
||||||
|
cif_tot_fcnn_add = sum(cif_sp_fcnn_add) #sum((1/norm(cif_sp_fcnn_add)).*cif_sp_fcnn_add) /100
|
||||||
|
cif_tot_fcnn_mul = sum(cif_sp_fcnn_mul) #sum((1/norm(cif_sp_fcnn_mul)).*cif_sp_fcnn_mul) /100
|
||||||
|
cif_tot_fcnn_fma = sum(cif_sp_fcnn_fma) #sum((1/norm(cif_sp_fcnn_fma)).*cif_sp_fcnn_fma) /100
|
||||||
|
|
||||||
|
cif_rat_bcnn_add_fma = sum(cif_sp_bcnn_add) / sum(cif_sp_bcnn_fma)
|
||||||
|
cif_rat_bcnn_mul_fma = sum(cif_sp_bcnn_fma) / sum(cif_sp_bcnn_fma)
|
||||||
|
|
||||||
|
cif_rat_fcnn_add_fma = sum(cif_sp_fcnn_add) / sum(cif_sp_fcnn_fma)
|
||||||
|
cif_rat_fcnn_mul_fma = sum(cif_sp_fcnn_mul) / sum(cif_sp_fcnn_fma)
|
||||||
|
|
||||||
|
#=
|
||||||
|
println("Ratio CIFAR BCNN ADD/FMA: $(cif_rat_bcnn_add_fma)")
|
||||||
|
println("Ratio CIFAR BCNN MUL/FMA: $(cif_rat_bcnn_mul_fma)")
|
||||||
|
|
||||||
|
println("Ratio CIFAR FCNN ADD/FMA: $(cif_rat_fcnn_add_fma)")
|
||||||
|
println("Ratio CIFAR FCNN MUL/FMA: $(cif_rat_fcnn_mul_fma)")
|
||||||
|
=#
|
||||||
|
|
||||||
|
#add_ratio_bccn = rat_bcnn_add_fma - cif_rat_bcnn_add_fma #* (1 - (add_μj + add_pj))
|
||||||
|
#mul_ratio_bccn = rat_bcnn_mul_fma - cif_rat_bcnn_mul_fma #* (1 - (mul_μj + mul_pj))
|
||||||
|
#add_ratio_fccn = rat_fcnn_add_fma - cif_rat_fcnn_add_fma #* (1 - (add_μj + add_pj))
|
||||||
|
#mul_ratio_fccn = rat_fcnn_mul_fma - cif_rat_fcnn_mul_fma #* (1 - (mul_μj + mul_pj))
|
||||||
|
|
||||||
|
#=
|
||||||
|
println("Memory rate of change BCNN: $(sum(mem_bcnn_write)/sum(mem_bcnn_read))")
|
||||||
|
println("Memory rate of change FCNN: $(sum(mem_fcnn_write)/sum(mem_fcnn_read))")
|
||||||
|
println("Memory rate of change CIFAR BCNN: $(sum(cif_mem_bcnn_write)/sum(cif_mem_bcnn_read))")
|
||||||
|
println("Memory rate of change CIFAR FCNN: $(sum(cif_mem_fcnn_write)/sum(cif_mem_fcnn_read))")
|
||||||
|
=#
|
||||||
|
|
||||||
|
#println("Rate of change ADD BCNN: $(add_ratio_bccn)")
|
||||||
|
#println("Rate of change MUL BCNN: $(mul_ratio_bccn)")
|
||||||
|
#println("Rate of change ADD FCNN: $(add_ratio_fccn)")
|
||||||
|
#println("Rate of change MUL FCNN: $(mul_ratio_fccn)")
|
||||||
|
|
||||||
|
#avg_rate_bcnn =
|
||||||
|
# ((add_ratio_bccn + mul_ratio_bccn) / 2) * (((add_μj + add_pj) + (mul_μj + mul_pj)) / 2)
|
||||||
|
#avg_rate_fcnn =
|
||||||
|
# ((add_ratio_fccn + mul_ratio_fccn) / 2) * (((add_μj + add_pj) + (mul_μj + mul_pj)) / 2)
|
||||||
|
|
||||||
|
#println("Avg rate BCNN: $(avg_rate_bcnn)")
|
||||||
|
#println("Avg rate FCNN: $(avg_rate_fcnn)")
|
||||||
|
|
||||||
|
|
||||||
|
# get total scaled
|
||||||
|
bcnn_mnist_vector = [tot_bcnn_add,tot_bcnn_mul,tot_bcnn_fma,tot_mem_bcnn_r_mb,tot_mem_bcnn_w_mb]
|
||||||
|
bcnn_cifar_vector = [cif_tot_bcnn_add,cif_tot_bcnn_mul,cif_tot_bcnn_fma,cif_tot_mem_bcnn_r_mb,cif_tot_mem_bcnn_w_mb]
|
||||||
|
|
||||||
|
fcnn_mnist_vector = [tot_fcnn_add,tot_fcnn_mul,tot_fcnn_fma,tot_mem_bcnn_r_mb,tot_mem_bcnn_w_mb]
|
||||||
|
fcnn_cifar_vector = [cif_tot_fcnn_add,cif_tot_fcnn_mul,cif_tot_fcnn_fma,cif_tot_mem_fcnn_r_mb,cif_tot_mem_fcnn_w_mb]
|
||||||
|
|
||||||
|
#bcnn_mnist_vector_max = max(bcnn_mnist_vector...)
|
||||||
|
#bcnn_cifar_vector_max = max(bcnn_cifar_vector...)
|
||||||
|
#
|
||||||
|
#fcnn_mnist_vector_max = max(fcnn_mnist_vector...)
|
||||||
|
#fcnn_cifar_vector_max = max(fcnn_cifar_vector...)
|
||||||
|
#
|
||||||
|
#bcnn_mnist_vector = bcnn_mnist_vector ./ (bcnn_mnist_vector_max * 1)
|
||||||
|
#bcnn_cifar_vector = bcnn_cifar_vector ./ (bcnn_cifar_vector_max * 1)
|
||||||
|
#
|
||||||
|
#fcnn_mnist_vector = fcnn_mnist_vector ./ (fcnn_mnist_vector_max * 1)
|
||||||
|
#fcnn_cifar_vector = fcnn_cifar_vector ./ (fcnn_cifar_vector_max * 1)
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
bar(
|
||||||
|
y=bcnn_mnist_vector,
|
||||||
|
x=["ADD","MUL","FMA","MRE","MWR"],
|
||||||
|
#cumulative_enabled=false,
|
||||||
|
name="MNIST",
|
||||||
|
#marker_color="#eb98b5",
|
||||||
|
marker_color = "rgb(055,033,240)",
|
||||||
|
opacity=0.75
|
||||||
|
),
|
||||||
|
bar(
|
||||||
|
y=bcnn_cifar_vector,
|
||||||
|
#y=fcnn_mnist_vector,
|
||||||
|
x=["ADD", "MUL","FMA","MRE","MWR"],
|
||||||
|
#cumulative_enabled=false,
|
||||||
|
name="CIFAR",
|
||||||
|
#marker_color="#330C73",
|
||||||
|
marker_color = "rgb(211,120,000)",
|
||||||
|
opacity=0.75
|
||||||
|
)
|
||||||
|
],
|
||||||
|
#Layout(title="BCNN", xaxis_title="Operations", yaxis_title="Total")#, yaxis_range=[0,1])
|
||||||
|
Layout(xaxis_title="Operations", yaxis_title="Total")#, yaxis_range=[0,1])
|
||||||
|
#Layout(xaxis_title="Operations", yaxis_title="Total", yaxis_range=[0,1])
|
||||||
|
)
|
||||||
|
savefig(en_plot, "bcnn_oper.png")
|
||||||
|
#savefig(en_plot, "mnist_oper.png")
|
||||||
|
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
bar(
|
||||||
|
y=fcnn_mnist_vector,
|
||||||
|
#y=bcnn_cifar_vector,
|
||||||
|
x=["ADD","MUL","FMA","MRE","MWR"],
|
||||||
|
#cumulative_enabled=false,
|
||||||
|
name="MNIST",
|
||||||
|
#marker_color="#eb98b5",
|
||||||
|
marker_color = "rgb(055,033,240)",
|
||||||
|
opacity=0.75
|
||||||
|
),
|
||||||
|
bar(
|
||||||
|
y=fcnn_cifar_vector,
|
||||||
|
x=["ADD", "MUL","FMA","MRE","MWR"],
|
||||||
|
#cumulative_enabled=false,
|
||||||
|
name="CIFAR",
|
||||||
|
#marker_color="#330C73",
|
||||||
|
marker_color = "rgb(211,120,000)",
|
||||||
|
opacity=0.75
|
||||||
|
)
|
||||||
|
],
|
||||||
|
#Layout(title="FCNN", xaxis_title="Operations", yaxis_title="Total")#, yaxis_range=[0,1])
|
||||||
|
Layout(xaxis_title="Operations", yaxis_title="Total")#, yaxis_range=[0,1])
|
||||||
|
#Layout(xaxis_title="Operations", yaxis_title="Total", yaxis_range=[0,1])
|
||||||
|
)
|
||||||
|
savefig(en_plot, "fcnn_oper.png")
|
||||||
|
#savefig(en_plot, "cifar_oper.png")
|
||||||
|
|
||||||
|
#=
|
||||||
|
|
||||||
|
amount = 500
|
||||||
|
|
||||||
|
# plots
|
||||||
|
#mem_read_plot = plot(mem_bcnn_read[1:amount],title="First $(amount) memory reads",label="BNN reads");plot!(mem_fcnn_read[1:amount],label="CNN reads")
|
||||||
|
#savefig(mem_read_plot,"mem_read.png")
|
||||||
|
|
||||||
|
mem_read_plot = plot(mem_bcnn_read[1:amount],label="BNN reads");plot!(mem_fcnn_read[1:amount],label="CNN reads")
|
||||||
|
savefig(mem_read_plot,"mem_read.png")
|
||||||
|
|
||||||
|
#mem_write_plot = plot(mem_bcnn_write[1:amount],title="First $(amount) memory writes",label="BNN writes");plot!(mem_fcnn_write[1:amount],label="CNN writes")
|
||||||
|
#savefig(mem_write_plot,"mem_write.png")
|
||||||
|
|
||||||
|
mem_write_plot = plot(mem_bcnn_write[1:amount],label="BNN writes");plot!(mem_fcnn_write[1:amount],label="CNN writes")
|
||||||
|
savefig(mem_write_plot,"mem_write.png")
|
||||||
|
|
||||||
|
#add_plot = plot(sp_bcnn_add[1:amount],title="First $(amount) single precision ADD operations",label="BNN ADD");plot!(sp_fcnn_add[1:amount],label="CNN ADD")
|
||||||
|
#savefig(add_plot,"add_plot.png")
|
||||||
|
|
||||||
|
add_plot = plot(sp_bcnn_add[1:amount],label="BNN ADD");plot!(sp_fcnn_add[1:amount],label="CNN ADD")
|
||||||
|
savefig(add_plot,"add_plot.png")
|
||||||
|
|
||||||
|
#mul_plot = plot(sp_bcnn_mul[1:amount],title="First $(amount) single precision MUL operations",label="BNN MUL");plot!(sp_fcnn_mul[1:amount],label="CNN MUL")
|
||||||
|
#savefig(mul_plot,"mul_plot.png")
|
||||||
|
|
||||||
|
mul_plot = plot(sp_bcnn_mul[1:amount],label="BNN MUL");plot!(sp_fcnn_mul[1:amount],label="CNN MUL")
|
||||||
|
savefig(mul_plot,"mul_plot.png")
|
||||||
|
|
||||||
|
#fma_plot = plot(sp_bcnn_fma[1:amount],title="First $(amount) single precision FMA operations",label="BNN FMA");plot!(sp_fcnn_fma[1:amount],label="CNN FMA")
|
||||||
|
#savefig(fma_plot,"fma_plot.png")
|
||||||
|
|
||||||
|
fma_plot = plot(sp_bcnn_fma[1:amount],label="BNN FMA");plot!(sp_fcnn_fma[1:amount],label="CNN FMA")
|
||||||
|
savefig(fma_plot,"fma_plot.png")
|
||||||
|
|
||||||
|
#mem_bcnn_read=convert.(Float64,mem_bcnn_read)
|
||||||
|
#mem_bcnn_write=convert.(Float64,mem_bcnn_write)
|
||||||
|
#mem_fcnn_read=convert.(Float64,mem_fcnn_read)
|
||||||
|
#mem_fcnn_write=convert.(Float64,mem_fcnn_write)
|
||||||
|
#sp_bcnn_add=convert.(Float64,sp_bcnn_add)
|
||||||
|
#sp_bcnn_fma=convert.(Float64,sp_bcnn_fma)
|
||||||
|
#sp_bcnn_mul=convert.(Float64,sp_bcnn_mul)
|
||||||
|
#sp_fcnn_add=convert.(Float64,sp_fcnn_add)
|
||||||
|
#sp_fcnn_fma=convert.(Float64,sp_fcnn_fma)
|
||||||
|
#sp_fcnn_mul=convert.(Float64,sp_fcnn_mul)
|
||||||
|
|
||||||
|
#h5write("mem_bcnn_read.h5", "mem_bcnn_read", mem_bcnn_read)
|
||||||
|
#h5write("mem_bcnn_write.h5", "mem_bcnn_write", mem_bcnn_write)
|
||||||
|
#h5write("mem_fcnn_read.h5", "mem_fcnn_read", mem_fcnn_read)
|
||||||
|
#h5write("mem_fcnn_write.h5", "mem_fcnn_write", mem_fcnn_write)
|
||||||
|
#h5write("sp_bcnn_add.h5", "sp_bcnn_add", sp_bcnn_add)
|
||||||
|
#h5write("sp_bcnn_fma.h5", "sp_bcnn_fma", sp_bcnn_fma)
|
||||||
|
#h5write("sp_bcnn_mul.h5", "sp_bcnn_mul", sp_bcnn_mul)
|
||||||
|
#h5write("sp_fcnn_add.h5", "sp_fcnn_add", sp_fcnn_add)
|
||||||
|
#h5write("sp_fcnn_fma.h5", "sp_fcnn_fma", sp_fcnn_fma)
|
||||||
|
#h5write("sp_fcnn_mul.h5", "sp_fcnn_mul", sp_fcnn_mul)
|
||||||
|
=#
|
|
@ -0,0 +1,151 @@
|
||||||
|
#using HDF5
|
||||||
|
include("aux_func.jl")
|
||||||
|
#using Plots
|
||||||
|
#using StatsPlots
|
||||||
|
using Statistics
|
||||||
|
using LinearAlgebra
|
||||||
|
using PlotlyJS, Random, StatsBase
|
||||||
|
using PlotlyJS: savefig
|
||||||
|
|
||||||
|
|
||||||
|
folder = "ini_exp_data/"
|
||||||
|
|
||||||
|
#fcnn = h5open("fcnn_watt_data.h5", "r") do file
|
||||||
|
# read(file,"fcnn")
|
||||||
|
#end
|
||||||
|
|
||||||
|
#bcnn = h5open("bcnn_watt_data.h5", "r") do file
|
||||||
|
# read(file,"bcnn")
|
||||||
|
#end
|
||||||
|
|
||||||
|
fcnn = load_pickle("$(folder)fcnn_wattdata.pkl")
|
||||||
|
bcnn = load_pickle("$(folder)bcnn_wattdata.pkl")
|
||||||
|
|
||||||
|
bcnn_w = removewatt(bcnn[:, 1])
|
||||||
|
mem_bcnn = removewatt(bcnn[:, 3])
|
||||||
|
#bcnn_ch = bcnn_w .> 28
|
||||||
|
#bcnn_start = findall(x -> x==1, bcnn_ch)[1]
|
||||||
|
#bcnn_end = findall(x -> x==1, bcnn_ch)[end]
|
||||||
|
#bcnn_w_tot = bcnn_w[bcnn_start:bcnn_end]
|
||||||
|
#bcnn_tot = sum(bcnn_w_tot)
|
||||||
|
#mean_bcnn_w = mean(bcnn_w_tot)
|
||||||
|
#bcnn_s = size(bcnn_w_tot)[1]
|
||||||
|
#mean_bcnn_w_v = mean_bcnn_w .* ones(bcnn_s)
|
||||||
|
#x_bcnn = collect(1:bcnn_s)
|
||||||
|
|
||||||
|
fcnn_w = removewatt(fcnn[:, 1])
|
||||||
|
mem_fcnn = removewatt(fcnn[:, 3])
|
||||||
|
#val_ch = fcnn_w .> 28
|
||||||
|
#fcnn_start = findall(x -> x==1, val_ch)[1]
|
||||||
|
#fcnn_end = findall(x -> x==1, val_ch)[end]
|
||||||
|
#fcnn_w_tot = fcnn_w[fcnn_start:fcnn_end]
|
||||||
|
#fcnn_tot = sum(fcnn_w_tot)
|
||||||
|
#mean_fcnn_w = mean(fcnn_w_tot)
|
||||||
|
#fcnn_s = size(fcnn_w_tot)[1]
|
||||||
|
#mean_fcnn_w_v = mean_fcnn_w .* ones(fcnn_s)
|
||||||
|
#x_fcnn = collect(1:fcnn_s)
|
||||||
|
|
||||||
|
mem_bcnn = parse.(Int64, replace.(bcnn[:, 3], r"[^0-9]+" => ""))
|
||||||
|
mem_fcnn = parse.(Int64, replace.(fcnn[:, 3], r"[^0-9]+" => ""))
|
||||||
|
|
||||||
|
#en_plot = boxplot(bcnn_w_tot,x_bcnn,title="Energy per sample",xlabel="Watts",ylabel="No of samples",label="BCNN",seriesalpha=0.5)
|
||||||
|
#boxplot!(fcnn_w_tot,x_fcnn,label="CNN",seriesalpha=0.5,color="green")
|
||||||
|
#savefig(en_plot,"energy.png")
|
||||||
|
|
||||||
|
#en_plot = histogram(bcnn_w,xlabel="Watts",ylabel="No of samples",label="BCNN",color="blue",normalize=:pdf,bar_position = :overlay)
|
||||||
|
#histogram!(fcnn_w,label="LeNet",seriesalpha=0.9,color="#ff9900",normalize=:pdf,bar_position=:overlay)
|
||||||
|
#savefig(en_plot,"energy.png")
|
||||||
|
|
||||||
|
#bcnn_w = incwzeros(bcnn_w,length(fcnn_w)-length(bcnn_w))
|
||||||
|
|
||||||
|
#bcnn_w = reshape(bcnn_w,:,1)
|
||||||
|
#fcnn_w = reshape(fcnn_w,:,1)
|
||||||
|
#w_mat = hcat(bcnn_w,fcnn_w)
|
||||||
|
|
||||||
|
#groupedbar(rand(length(bcnn_w),2),bar_width=0.5,bar_position = :dodge)
|
||||||
|
|
||||||
|
#w_mat = reshape(w_mat,2,:)
|
||||||
|
|
||||||
|
|
||||||
|
#mem_plot = plot(mem_fcnn,title="Memory usage, one epoch in MiB's",label="CNN Memory",lw=2,seriesalpha=0.5)
|
||||||
|
#plot!(mem_bcnn,label="BCNN Memory",lw=2,seriesalpha=0.5,fmt=:png)
|
||||||
|
#savefig(mem_plot,"memory.png")
|
||||||
|
|
||||||
|
#mem_plot = histogram(mem_bcnn,xlabel="MiB",ylabel="No of samples",label="BCNN",color="blue")
|
||||||
|
#histogram!(mem_fcnn,label="LeNet",seriesalpha=0.9,color="#ff9900")
|
||||||
|
#savefig(mem_plot,"memory.png")
|
||||||
|
|
||||||
|
#plot(bcnn_w_tot,title="BCNN energy in one epoch",label="Watt",lw=2);plot!(mean_bcnn_w_v,label="Mean")
|
||||||
|
#plot(fcnn_w_tot,title="CNN energy in one epoch",label="Watt",lw=2);plot!(mean_fcnn_w_v,label="Mean")
|
||||||
|
#scatter(bcnn[1,:],title="Energy usage in W",label="Bayesian CNN",lw=2);scatter!(fcnn[1,1:463],label="CNN",lw=2)
|
||||||
|
|
||||||
|
|
||||||
|
bcnn_d = countmap(bcnn_w)
|
||||||
|
bcnn_u = unique(bcnn_w)
|
||||||
|
bcnn_v = Vector()
|
||||||
|
for u in bcnn_u
|
||||||
|
push!(bcnn_v, bcnn_d[u])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
m_bcnn_d = countmap(mem_bcnn)
|
||||||
|
m_bcnn_u = unique(mem_bcnn)
|
||||||
|
m_bcnn_v = Vector()
|
||||||
|
for u in m_bcnn_u
|
||||||
|
push!(m_bcnn_v, m_bcnn_d[u])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
fcnn_d = countmap(fcnn_w)
|
||||||
|
fcnn_u = unique(fcnn_w)
|
||||||
|
fcnn_v = Vector()
|
||||||
|
for u in fcnn_u
|
||||||
|
push!(fcnn_v, fcnn_d[u])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
m_fcnn_d = countmap(mem_fcnn)
|
||||||
|
m_fcnn_u = unique(mem_fcnn)
|
||||||
|
m_fcnn_v = Vector()
|
||||||
|
for u in fcnn_u
|
||||||
|
push!(m_fcnn_v, fcnn_d[u])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
bcnn_v = bcnn_v / norm(bcnn_v)
|
||||||
|
fcnn_v = fcnn_v / norm(fcnn_v)
|
||||||
|
|
||||||
|
m_bcnn_v = m_bcnn_v / norm(m_bcnn_v)
|
||||||
|
m_fcnn_v = m_fcnn_v / norm(m_fcnn_v)
|
||||||
|
|
||||||
|
en_plot = plot(
|
||||||
|
[
|
||||||
|
bar(x = bcnn_u, y = bcnn_v, name = "BCNN", marker_color = "blue"),
|
||||||
|
bar(x = fcnn_u, y = fcnn_v, name = "LeNet", marker_color = "#ff9900"),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
barmode = "group",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Samples",
|
||||||
|
xaxis_title_text = "Watts",
|
||||||
|
title = "Energy distribution experiment 1",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(en_plot, "energy.png")
|
||||||
|
|
||||||
|
mem_plot = plot(
|
||||||
|
[
|
||||||
|
bar(x = m_bcnn_u, y = m_bcnn_v, name = "BCNN", marker_color = "blue"),
|
||||||
|
bar(x = m_fcnn_u, y = m_fcnn_v, name = "LeNet", marker_color = "#ff9900"),
|
||||||
|
],
|
||||||
|
Layout(
|
||||||
|
barmode = "group",
|
||||||
|
xaxis_tickangle = -45,
|
||||||
|
yaxis_title_text = "Samples",
|
||||||
|
xaxis_title_text = "MiB",
|
||||||
|
title = "MRW distribution experiment 1",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
savefig(mem_plot, "memory.png")
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,295 @@
|
||||||
|
include("aux_func.jl")
|
||||||
|
using LinearAlgebra
|
||||||
|
using Statistics
|
||||||
|
using PlotlyJS
|
||||||
|
|
||||||
|
#=
|
||||||
|
Obtain energy data
|
||||||
|
=#
|
||||||
|
|
||||||
|
#mni_folder_1 = "ini_exp_data/"
|
||||||
|
|
||||||
|
|
||||||
|
mni_folder_100 = "exp_100_epochs/";
|
||||||
|
cif_folder_100 = "CIFAR_100_epoch/";
|
||||||
|
|
||||||
|
mni_folder_acc = "data_bounded/";
|
||||||
|
cif_folder_acc = "CIFAR_acc_bound/";
|
||||||
|
|
||||||
|
mni_folder_wat = "data_budget/";
|
||||||
|
cif_folder_wat = "CIFAR_energy_bound/";
|
||||||
|
|
||||||
|
mni_folder_est = "early_stop_res/";
|
||||||
|
cif_folder_est = "CIFAR_early_stop/";
|
||||||
|
|
||||||
|
bayes_model = "bayes";
|
||||||
|
freq_model = "freq";
|
||||||
|
w_type = "watt";
|
||||||
|
e_type = "exp";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load GPU data
|
||||||
|
=#
|
||||||
|
mni_100_bay_ene = getgpudata(mni_folder_100, bayes_model, w_type, "eo");
|
||||||
|
mni_100_fre_ene = getgpudata(mni_folder_100, freq_model, w_type, "eo");
|
||||||
|
cif_100_bay_ene = getgpudata(cif_folder_100, bayes_model, w_type, "eo");
|
||||||
|
cif_100_fre_ene = getgpudata(cif_folder_100, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_acc_bay_ene = getgpudata(mni_folder_acc, bayes_model, w_type, "eo");
|
||||||
|
mni_acc_fre_ene = getgpudata(mni_folder_acc, freq_model, w_type, "eo");
|
||||||
|
cif_acc_bay_ene = getgpudata(cif_folder_acc, bayes_model, w_type, "eo");
|
||||||
|
cif_acc_fre_ene = getgpudata(cif_folder_acc, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_wat_bay_ene = getgpudata(mni_folder_wat, bayes_model, w_type, "eo");
|
||||||
|
mni_wat_fre_ene = getgpudata(mni_folder_wat, freq_model, w_type, "eo");
|
||||||
|
cif_wat_bay_ene = getgpudata(cif_folder_wat, bayes_model, w_type, "eo");
|
||||||
|
cif_wat_fre_ene = getgpudata(cif_folder_wat, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
mni_est_bay_ene = getgpudata(mni_folder_est, bayes_model, w_type, "eo");
|
||||||
|
mni_est_fre_ene = getgpudata(mni_folder_est, freq_model, w_type, "eo");
|
||||||
|
cif_est_bay_ene = getgpudata(cif_folder_est, bayes_model, w_type, "eo");
|
||||||
|
cif_est_fre_ene = getgpudata(cif_folder_est, freq_model, w_type, "eo");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
Define CPU paths
|
||||||
|
=#
|
||||||
|
cif = "cifar";
|
||||||
|
mni = "mnist";
|
||||||
|
bay = "bayes";
|
||||||
|
wat = "cpu_watts";
|
||||||
|
frq = "freq";
|
||||||
|
ram = "ram_use";
|
||||||
|
_100 = "100";
|
||||||
|
acc = "acc";
|
||||||
|
es = "es";
|
||||||
|
wbud = "wbud";
|
||||||
|
|
||||||
|
#=
|
||||||
|
Load CPU data
|
||||||
|
=#
|
||||||
|
bay_cif_100_ene = readcpudata(cif, bay, wat, _100);
|
||||||
|
bay_mni_100_ene = readcpudata(mni, bay, wat, _100);
|
||||||
|
frq_cif_100_ene = readcpudata(cif, frq, wat, _100);
|
||||||
|
frq_mni_100_ene = readcpudata(mni, frq, wat, _100);
|
||||||
|
|
||||||
|
bay_cif_acc_ene = readcpudata(cif, bay, wat, acc);
|
||||||
|
bay_mni_acc_ene = readcpudata(mni, bay, wat, acc);
|
||||||
|
frq_cif_acc_ene = readcpudata(cif, frq, wat, acc);
|
||||||
|
frq_mni_acc_ene = readcpudata(mni, frq, wat, acc);
|
||||||
|
|
||||||
|
|
||||||
|
bay_cif_wbu_ene = readcpudata(cif, bay, wat, wbud);
|
||||||
|
bay_mni_wbu_ene = readcpudata(mni, bay, wat, wbud);
|
||||||
|
frq_cif_wbu_ene = readcpudata(cif, frq, wat, wbud);
|
||||||
|
frq_mni_wbu_ene = readcpudata(mni, frq, wat, wbud);
|
||||||
|
|
||||||
|
bay_mni_est_ene = readcpudata(mni, bay, wat, es);
|
||||||
|
bay_cif_est_ene = readcpudata(cif, bay, wat, es);
|
||||||
|
frq_cif_est_ene = readcpudata(cif, frq, wat, es);
|
||||||
|
frq_mni_est_ene = readcpudata(mni, frq, wat, es);
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
bay_cif_acc_ene[s] = round.(getcpuwatt(bay_cif_acc_ene[s]))
|
||||||
|
bay_cif_est_ene[s] = round.(getcpuwatt(bay_cif_est_ene[s]))
|
||||||
|
bay_cif_wbu_ene[s] = round.(getcpuwatt(bay_cif_wbu_ene[s]))
|
||||||
|
bay_cif_100_ene[s] = round.(getcpuwatt(bay_cif_100_ene[s]))
|
||||||
|
|
||||||
|
bay_mni_acc_ene[s] = round.(getcpuwatt(bay_mni_acc_ene[s]))
|
||||||
|
bay_mni_est_ene[s] = round.(getcpuwatt(bay_mni_est_ene[s]))
|
||||||
|
bay_mni_wbu_ene[s] = round.(getcpuwatt(bay_mni_wbu_ene[s]))
|
||||||
|
bay_mni_100_ene[s] = round.(getcpuwatt(bay_mni_100_ene[s]))
|
||||||
|
|
||||||
|
frq_cif_acc_ene[s] = round.(getcpuwatt(frq_cif_acc_ene[s]))
|
||||||
|
frq_cif_est_ene[s] = round.(getcpuwatt(frq_cif_est_ene[s]))
|
||||||
|
frq_cif_wbu_ene[s] = round.(getcpuwatt(frq_cif_wbu_ene[s]))
|
||||||
|
frq_cif_100_ene[s] = round.(getcpuwatt(frq_cif_100_ene[s]))
|
||||||
|
|
||||||
|
frq_mni_acc_ene[s] = round.(getcpuwatt(frq_mni_acc_ene[s]))
|
||||||
|
frq_mni_est_ene[s] = round.(getcpuwatt(frq_mni_est_ene[s]))
|
||||||
|
frq_mni_wbu_ene[s] = round.(getcpuwatt(frq_mni_wbu_ene[s]))
|
||||||
|
frq_mni_100_ene[s] = round.(getcpuwatt(frq_mni_100_ene[s]))
|
||||||
|
end
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
mni_100_bay_ene[s]["Ene"] = vcat(mni_100_bay_ene[s]["Ene"], bay_mni_100_ene[s])
|
||||||
|
mni_100_fre_ene[s]["Ene"] = vcat(mni_100_fre_ene[s]["Ene"], frq_mni_100_ene[s])
|
||||||
|
cif_100_bay_ene[s]["Ene"] = vcat(cif_100_bay_ene[s]["Ene"], bay_cif_100_ene[s])
|
||||||
|
cif_100_fre_ene[s]["Ene"] = vcat(cif_100_fre_ene[s]["Ene"], frq_cif_100_ene[s])
|
||||||
|
|
||||||
|
mni_acc_bay_ene[s]["Ene"] = vcat(mni_acc_bay_ene[s]["Ene"], bay_mni_acc_ene[s])
|
||||||
|
mni_acc_fre_ene[s]["Ene"] = vcat(mni_acc_fre_ene[s]["Ene"], frq_mni_acc_ene[s])
|
||||||
|
cif_acc_bay_ene[s]["Ene"] = vcat(cif_acc_bay_ene[s]["Ene"], bay_cif_acc_ene[s])
|
||||||
|
cif_acc_fre_ene[s]["Ene"] = vcat(cif_acc_fre_ene[s]["Ene"], frq_cif_acc_ene[s])
|
||||||
|
|
||||||
|
|
||||||
|
mni_wat_bay_ene[s]["Ene"] = vcat(mni_wat_bay_ene[s]["Ene"], bay_mni_wbu_ene[s])
|
||||||
|
mni_wat_fre_ene[s]["Ene"] = vcat(mni_wat_fre_ene[s]["Ene"], frq_mni_wbu_ene[s])
|
||||||
|
cif_wat_bay_ene[s]["Ene"] = vcat(cif_wat_bay_ene[s]["Ene"], bay_cif_wbu_ene[s])
|
||||||
|
cif_wat_fre_ene[s]["Ene"] = vcat(cif_wat_fre_ene[s]["Ene"], frq_cif_wbu_ene[s])
|
||||||
|
|
||||||
|
mni_est_bay_ene[s]["Ene"] = vcat(mni_est_bay_ene[s]["Ene"], bay_mni_est_ene[s])
|
||||||
|
mni_est_fre_ene[s]["Ene"] = vcat(mni_est_fre_ene[s]["Ene"], frq_mni_est_ene[s])
|
||||||
|
cif_est_bay_ene[s]["Ene"] = vcat(cif_est_bay_ene[s]["Ene"], bay_cif_est_ene[s])
|
||||||
|
cif_est_fre_ene[s]["Ene"] = vcat(cif_est_fre_ene[s]["Ene"], frq_cif_est_ene[s])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
all_data_ene = Dict(
|
||||||
|
"mni" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"cif" => Dict(
|
||||||
|
1 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
2 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
3 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
4 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
5 => Dict(
|
||||||
|
"100" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"acc" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"wat" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
"est" => Dict("bay" => 0.0, "frq" => 0.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
for s = 1:5
|
||||||
|
all_data_ene["mni"][s]["100"]["bay"] = sum(mni_100_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["mni"][s]["100"]["frq"] = sum(mni_100_fre_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["100"]["bay"] = sum(cif_100_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["100"]["frq"] = sum(cif_100_fre_ene[s]["Ene"])
|
||||||
|
|
||||||
|
all_data_ene["mni"][s]["acc"]["bay"] = sum(mni_acc_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["mni"][s]["acc"]["frq"] = sum(mni_acc_fre_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["acc"]["bay"] = sum(cif_acc_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["acc"]["frq"] = sum(cif_acc_fre_ene[s]["Ene"])
|
||||||
|
|
||||||
|
|
||||||
|
all_data_ene["mni"][s]["wat"]["bay"] = sum(mni_wat_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["mni"][s]["wat"]["frq"] = sum(mni_wat_fre_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["wat"]["bay"] = sum(cif_wat_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["wat"]["frq"] = sum(cif_wat_fre_ene[s]["Ene"])
|
||||||
|
|
||||||
|
all_data_ene["mni"][s]["est"]["bay"] = sum(mni_est_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["mni"][s]["est"]["frq"] = sum(mni_est_fre_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["est"]["bay"] = sum(cif_est_bay_ene[s]["Ene"])
|
||||||
|
all_data_ene["cif"][s]["est"]["frq"] = sum(cif_est_fre_ene[s]["Ene"])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
#=
|
||||||
|
# sums
|
||||||
|
=#
|
||||||
|
|
||||||
|
println(
|
||||||
|
"MNIST LeNet 100, Total Energy: [$(all_data_ene["mni"][1]["100"]["frq"]),$(all_data_ene["mni"][2]["100"]["frq"]),$(all_data_ene["mni"][3]["100"]["frq"]),$(all_data_ene["mni"][4]["100"]["frq"]),$(all_data_ene["mni"][5]["100"]["frq"])]",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"MNIST Bayes 100, Total Energy: [$(all_data_ene["mni"][1]["100"]["bay"]),$(all_data_ene["mni"][2]["100"]["bay"]),$(all_data_ene["mni"][3]["100"]["bay"]),$(all_data_ene["mni"][4]["100"]["bay"]),$(all_data_ene["mni"][5]["100"]["bay"])]",
|
||||||
|
)
|
||||||
|
|
||||||
|
println(
|
||||||
|
"CIFAR LeNet 100, Total Energy: [$(all_data_ene["cif"][1]["100"]["frq"]),$(all_data_ene["cif"][2]["100"]["frq"]),$(all_data_ene["cif"][3]["100"]["frq"]),$(all_data_ene["cif"][4]["100"]["frq"]),$(all_data_ene["cif"][5]["100"]["frq"])]",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes 100, Total Energy: [$(all_data_ene["cif"][1]["100"]["bay"]),$(all_data_ene["cif"][2]["100"]["bay"]),$(all_data_ene["cif"][3]["100"]["bay"]),$(all_data_ene["cif"][4]["100"]["bay"]),$(all_data_ene["cif"][5]["100"]["bay"])]",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
println(
|
||||||
|
"MNIST LeNet Acc, Total Energy: [$(all_data_ene["mni"][1]["acc"]["frq"]),$(all_data_ene["cif"][2]["acc"]["frq"]),$(all_data_ene["cif"][3]["acc"]["frq"]),$(all_data_ene["cif"][4]["100"]["frq"]),$(all_data_ene["cif"][5]["acc"]["frq"])]",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Acc, Total Energy: [$(all_data_ene["mni"][1]["acc"]["bay"]),$(all_data_ene["cif"][2]["acc"]["bay"]),$(all_data_ene["cif"][3]["acc"]["bay"]),$(all_data_ene["cif"][4]["100"]["bay"]),$(all_data_ene["cif"][5]["acc"]["bay"])]",
|
||||||
|
)
|
||||||
|
|
||||||
|
println(
|
||||||
|
"CIFAR LeNet Acc, Total Energy: [$(all_data_ene["cif"][1]["acc"]["frq"]),$(all_data_ene["cif"][2]["acc"]["frq"]),$(all_data_ene["cif"][3]["acc"]["frq"]),$(all_data_ene["cif"][4]["100"]["frq"]),$(all_data_ene["cif"][5]["acc"]["frq"])]",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Acc, Total Energy: [$(all_data_ene["cif"][1]["acc"]["bay"]),$(all_data_ene["cif"][2]["acc"]["bay"]),$(all_data_ene["cif"][3]["acc"]["bay"]),$(all_data_ene["cif"][4]["100"]["bay"]),$(all_data_ene["cif"][5]["acc"]["bay"])]",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
println(
|
||||||
|
"MNIST LeNet Wat, Total Energy: [$(all_data_ene["mni"][1]["wat"]["frq"]),$(all_data_ene["cif"][2]["wat"]["frq"]),$(all_data_ene["cif"][3]["wat"]["frq"]),$(all_data_ene["cif"][4]["wat"]["frq"]),$(all_data_ene["cif"][5]["wat"]["frq"])]",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Wat, Total Energy: [$(all_data_ene["mni"][1]["wat"]["bay"]),$(all_data_ene["cif"][2]["wat"]["bay"]),$(all_data_ene["cif"][3]["wat"]["bay"]),$(all_data_ene["cif"][4]["wat"]["bay"]),$(all_data_ene["cif"][5]["wat"]["bay"])]",
|
||||||
|
)
|
||||||
|
|
||||||
|
println(
|
||||||
|
"CIFAR LeNet Wat, Total Energy: [$(all_data_ene["cif"][1]["wat"]["frq"]),$(all_data_ene["cif"][2]["wat"]["frq"]),$(all_data_ene["cif"][3]["wat"]["frq"]),$(all_data_ene["cif"][4]["wat"]["frq"]),$(all_data_ene["cif"][5]["wat"]["frq"])]",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Wat, Total Energy: [$(all_data_ene["cif"][1]["wat"]["bay"]),$(all_data_ene["cif"][2]["wat"]["bay"]),$(all_data_ene["cif"][3]["wat"]["bay"]),$(all_data_ene["cif"][4]["wat"]["bay"]),$(all_data_ene["cif"][5]["wat"]["bay"])]",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
println(
|
||||||
|
"MNIST LeNet Est, Total Energy: [$(all_data_ene["mni"][1]["est"]["frq"]),$(all_data_ene["cif"][2]["est"]["frq"]),$(all_data_ene["cif"][3]["est"]["frq"]),$(all_data_ene["cif"][4]["est"]["frq"]),$(all_data_ene["cif"][5]["est"]["frq"])]",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"MNIST Bayes Est, Total Energy: [$(all_data_ene["mni"][1]["est"]["bay"]),$(all_data_ene["cif"][2]["est"]["bay"]),$(all_data_ene["cif"][3]["est"]["bay"]),$(all_data_ene["cif"][4]["est"]["bay"]),$(all_data_ene["cif"][5]["est"]["bay"])]",
|
||||||
|
)
|
||||||
|
|
||||||
|
println(
|
||||||
|
"CIFAR LeNet Est, Total Energy: [$(all_data_ene["cif"][1]["est"]["frq"]),$(all_data_ene["cif"][2]["est"]["frq"]),$(all_data_ene["cif"][3]["est"]["frq"]),$(all_data_ene["cif"][4]["est"]["frq"]),$(all_data_ene["cif"][5]["est"]["frq"])]",
|
||||||
|
)
|
||||||
|
println(
|
||||||
|
"CIFAR Bayes Est, Total Energy: [$(all_data_ene["cif"][1]["est"]["bay"]),$(all_data_ene["cif"][2]["est"]["bay"]),$(all_data_ene["cif"][3]["est"]["bay"]),$(all_data_ene["cif"][4]["est"]["bay"]),$(all_data_ene["cif"][5]["est"]["bay"])]",
|
||||||
|
)
|
||||||
|
|
|
@ -0,0 +1,127 @@
|
||||||
|
24546
|
||||||
|
8675
|
||||||
|
14405
|
||||||
|
8251
|
||||||
|
12414
|
||||||
|
1054
|
||||||
|
16014
|
||||||
|
1730
|
||||||
|
3411
|
||||||
|
3309
|
||||||
|
3125
|
||||||
|
3416
|
||||||
|
26037
|
||||||
|
10727
|
||||||
|
25228
|
||||||
|
9074
|
||||||
|
|
||||||
|
32151
|
||||||
|
1870
|
||||||
|
17650
|
||||||
|
1990
|
||||||
|
4006
|
||||||
|
3518
|
||||||
|
4843
|
||||||
|
3705
|
||||||
|
33038
|
||||||
|
8497
|
||||||
|
19262
|
||||||
|
8289
|
||||||
|
16115
|
||||||
|
858
|
||||||
|
14456
|
||||||
|
1153
|
||||||
|
|
||||||
|
3264
|
||||||
|
3007
|
||||||
|
3148
|
||||||
|
3155
|
||||||
|
43922
|
||||||
|
9162
|
||||||
|
28756
|
||||||
|
9055
|
||||||
|
34825
|
||||||
|
1523
|
||||||
|
15070
|
||||||
|
1268
|
||||||
|
6794
|
||||||
|
3293
|
||||||
|
4594
|
||||||
|
3670
|
||||||
|
|
||||||
|
41450
|
||||||
|
8579
|
||||||
|
24245
|
||||||
|
8244
|
||||||
|
20672
|
||||||
|
599
|
||||||
|
15082
|
||||||
|
1171
|
||||||
|
3352
|
||||||
|
2178
|
||||||
|
3184
|
||||||
|
2887
|
||||||
|
50435
|
||||||
|
10065
|
||||||
|
32195
|
||||||
|
8995
|
||||||
|
|
||||||
|
37124
|
||||||
|
1103
|
||||||
|
15984
|
||||||
|
1391
|
||||||
|
6232
|
||||||
|
2394
|
||||||
|
3445
|
||||||
|
3215
|
||||||
|
49003
|
||||||
|
8751
|
||||||
|
28977
|
||||||
|
8364
|
||||||
|
27099
|
||||||
|
595
|
||||||
|
20822
|
||||||
|
944
|
||||||
|
|
||||||
|
3353
|
||||||
|
1872
|
||||||
|
3229
|
||||||
|
2250
|
||||||
|
55590
|
||||||
|
9538
|
||||||
|
34952
|
||||||
|
9258
|
||||||
|
41751
|
||||||
|
888
|
||||||
|
22713
|
||||||
|
1045
|
||||||
|
4642
|
||||||
|
2064
|
||||||
|
4118
|
||||||
|
3153
|
||||||
|
|
||||||
|
55256
|
||||||
|
8843
|
||||||
|
33954
|
||||||
|
8442
|
||||||
|
32833
|
||||||
|
433
|
||||||
|
22218
|
||||||
|
967
|
||||||
|
3073
|
||||||
|
1727
|
||||||
|
3092
|
||||||
|
1907
|
||||||
|
59022
|
||||||
|
10711
|
||||||
|
36849
|
||||||
|
10154
|
||||||
|
|
||||||
|
45188
|
||||||
|
503
|
||||||
|
23276
|
||||||
|
2735
|
||||||
|
3954
|
||||||
|
2413
|
||||||
|
3632
|
||||||
|
3211
|
|
@ -0,0 +1,17 @@
|
||||||
|
using Dates
|
||||||
|
using Dates: Time
|
||||||
|
include("aux_func.jl")
|
||||||
|
|
||||||
|
freq_results = getimes("times_frequentist");
|
||||||
|
bayes_results = getimes("times_bayesian");
|
||||||
|
|
||||||
|
freq_results = concat(freq_results);
|
||||||
|
bayes_results = concat(bayes_results);
|
||||||
|
|
||||||
|
io = open("result_times_freq", "w");
|
||||||
|
write(io, freq_results);
|
||||||
|
close(io);
|
||||||
|
|
||||||
|
io = open("result_times_bayes", "w");
|
||||||
|
write(io, bayes_results);
|
||||||
|
close(io);
|
Loading…
Reference in New Issue