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")