Skip to content
Snippets Groups Projects
Commit f2f7e747 authored by Luc Giffon's avatar Luc Giffon
Browse files

unrelevant changes related to experiments. build_command_line_array shouldn't...

unrelevant changes related to experiments. build_command_line_array shouldn't bu used anymore + changes in drawgraphes relative to cifar10 experiment
parent 63817ce0
No related branches found
No related tags found
No related merge requests found
import numpy as np import numpy as np
import math import math
if __name__ == '__main__': if __name__ == '__main__':
batch_size = np.logspace(3, 9, dtype=int, base=2, num=5) raise DeprecationWarning("This should not be used, lazygrid of skluc should be used instead")
num_epoch = 50
sigma = 5.0 batch_size = np.logspace(3, 9, dtype=int, base=2, num=4)
gamma = 0.003 num_epoch = 100
subsample_size = np.logspace(3, 9, dtype=int, base=2, num=5) # sigma = np.logspace(-1, 2, base=10, num=3)
sigma = [1]
# gamma = np.logspace(-4, 0, base=10, num=3)
gamma = [1]
subsample_size = np.logspace(3, 9, dtype=int, base=2, num=4)
networks_types = ["dense", "deepfriedconvnet", "deepstorm"] networks_types = ["dense", "deepfriedconvnet", "deepstorm"]
datasets = ["mnist", datasets = ["cifar"]
"cifar"]
output_dense = 2048 output_dense = 2048
nys_layer_dim_out = np.logspace(3, int(math.log(output_dense, 2)), dtype=int, base=2, num=5) nys_layer_dim_out = np.logspace(3, int(math.log(output_dense, 2)), dtype=int, base=2, num=3)
for d in datasets: for d in datasets:
for network in networks_types: for network in networks_types:
s_network = network + " " + "--" + str(d) + " " + "--time" + " " + "--test" + " " + "-e" + " " + str(num_epoch) + " " s_network = network + " " + "--" + str(d) + " " + "--time" + " " + "--test" + " " + "-e" + " " + str(num_epoch) + " "
for b_size in batch_size: for b_size in batch_size:
s_epoch = s_network + "-s " + str(b_size) + " " s_epoch = s_network + "-s " + str(b_size) + " "
if network == "deepfriedconvnet": if network == "deepfriedconvnet":
s_sigma = s_epoch + "-S " + str(sigma) + " " for sig in sigma:
print(s_sigma) s_sigma = s_epoch + "-S " + "{:.5f}".format(sig)
print(s_sigma)
elif network == "deepstorm": elif network == "deepstorm":
s_gamma = s_epoch + "-G " + str(gamma) + " " for gam in gamma:
for nys_size in subsample_size: s_gamma = s_epoch + "-G " + "{:.5f}".format(gam) + " "
s_nys = s_gamma + "-m " + str(nys_size) + " " for nys_size in subsample_size:
for nys_output_size in nys_layer_dim_out: s_nys = s_gamma + "-m " + str(nys_size) + " "
s_nys_out = s_nys + "-w" + " " + str(nys_output_size) for nys_output_size in nys_layer_dim_out:
print(s_nys_out) s_nys_out = s_nys + "-w" + " " + str(nys_output_size)
print(s_nys_out)
else: else:
print(s_epoch) print(s_epoch)
pass pass
\ No newline at end of file
...@@ -5,11 +5,13 @@ import pandas as pd ...@@ -5,11 +5,13 @@ import pandas as pd
pd.set_option('display.width', 1000) pd.set_option('display.width', 1000)
DIRNAME = "/home/luc/PycharmProjects/deepFriedConvnets/main/results_global5" DIRNAME = "/home/luc/Resultats/Deepstrom/CIFAR10/v2/100_epochs"
FILENAME = "gathered_results" FILENAME = "gathered_results"
batch_size = np.logspace(3, 9, dtype=int, base=2, num=5) batch_size = np.logspace(3, 9, dtype=int, base=2, num=4)
subsample_size = np.logspace(3, 9, dtype=int, base=2, num=5) # batch_size = np.logspace(3, 9, dtype=int, base=2, num=5)
subsample_size = np.logspace(3, 9, dtype=int, base=2, num=4)
# subsample_size = np.logspace(3, 9, dtype=int, base=2, num=5)
if __name__ == '__main__': if __name__ == '__main__':
filepath = os.path.join(DIRNAME, FILENAME) filepath = os.path.join(DIRNAME, FILENAME)
...@@ -25,9 +27,10 @@ if __name__ == '__main__': ...@@ -25,9 +27,10 @@ if __name__ == '__main__':
"deepstrom_dim"] "deepstrom_dim"]
df = pd.read_csv(filepath, names=field_names) df = pd.read_csv(filepath, names=field_names)
df = df[df["dataset"] == "mnist"] # df = df[df["dataset"] == "mnist"]
df = df[df["dataset"] == "cifar"]
nrows = 3 nrows = 2
ncols = 2 ncols = 2
f, axxarr = plt.subplots(nrows, ncols) f, axxarr = plt.subplots(nrows, ncols)
f2, axxarr2 = plt.subplots(nrows, ncols) f2, axxarr2 = plt.subplots(nrows, ncols)
...@@ -48,9 +51,9 @@ if __name__ == '__main__': ...@@ -48,9 +51,9 @@ if __name__ == '__main__':
df_batch_size_deepfriedconvnet = df_batch_size[df_batch_size["method_name"] == "DeepFriedConvnet"] df_batch_size_deepfriedconvnet = df_batch_size[df_batch_size["method_name"] == "DeepFriedConvnet"]
df_batch_size_deepstrom_runtime_sort = df_batch_size_deepstrom.sort_values(by=["runtime"]) df_batch_size_deepstrom_runtime_sort = df_batch_size_deepstrom.sort_values(by=["runtime"])
axxarr[i][j].set_title("batch size = {}".format(curr_batch_size)) axxarr[i][j].set_title("batch size = {}".format(curr_batch_size))
axxarr[i][j].plot(df_batch_size_deepstrom_runtime_sort["runtime"], axxarr[i][j].scatter(df_batch_size_deepstrom_runtime_sort["runtime"],
df_batch_size_deepstrom_runtime_sort["accuracy"], df_batch_size_deepstrom_runtime_sort["accuracy"],
label="Deepstrom") label="Deepstrom", marker="x")
axxarr[i][j].scatter(df_batch_size_dense["runtime"], axxarr[i][j].scatter(df_batch_size_dense["runtime"],
df_batch_size_dense["accuracy"], color="r", df_batch_size_dense["accuracy"], color="r",
label="Dense", label="Dense",
...@@ -59,7 +62,7 @@ if __name__ == '__main__': ...@@ -59,7 +62,7 @@ if __name__ == '__main__':
df_batch_size_deepfriedconvnet["accuracy"], color="g", df_batch_size_deepfriedconvnet["accuracy"], color="g",
label="DeepFriedConvnet", label="DeepFriedConvnet",
marker="x") marker="x")
axxarr[i][j].legend(loc="lower right") # axxarr[i][j].legend(loc="lower right")
curr_batch_size_idx += 1 curr_batch_size_idx += 1
...@@ -68,9 +71,9 @@ if __name__ == '__main__': ...@@ -68,9 +71,9 @@ if __name__ == '__main__':
# print(df_batch_size_deepstrom) # print(df_batch_size_deepstrom)
# print(df_batch_size_deepstrom_subsample_sort) # print(df_batch_size_deepstrom_subsample_sort)
axxarr2[i][j].set_title("batch size = {}".format(curr_batch_size)) axxarr2[i][j].set_title("batch size = {}".format(curr_batch_size))
axxarr2[i][j].plot(df_batch_size_deepstrom_subsample_sort["subsample_size"], axxarr2[i][j].scatter(df_batch_size_deepstrom_subsample_sort["subsample_size"],
df_batch_size_deepstrom_subsample_sort["accuracy"], df_batch_size_deepstrom_subsample_sort["accuracy"],
label="Deepstrom") label="Deepstrom", marker="x")
nb_val = len(df_batch_size_deepstrom_subsample_sort["subsample_size"]) nb_val = len(df_batch_size_deepstrom_subsample_sort["subsample_size"])
axxarr2[i][j].plot(df_batch_size_deepstrom_subsample_sort["subsample_size"], axxarr2[i][j].plot(df_batch_size_deepstrom_subsample_sort["subsample_size"],
[df_batch_size_dense["accuracy"].values[0] for _ in range(nb_val)], color="r", [df_batch_size_dense["accuracy"].values[0] for _ in range(nb_val)], color="r",
...@@ -85,9 +88,9 @@ if __name__ == '__main__': ...@@ -85,9 +88,9 @@ if __name__ == '__main__':
for k, nys_dim in enumerate(subsample_size): for k, nys_dim in enumerate(subsample_size):
df_batch_size_deepstrom_nys_dim = df_batch_size_deepstrom[df_batch_size_deepstrom["subsample_size"] == nys_dim] df_batch_size_deepstrom_nys_dim = df_batch_size_deepstrom[df_batch_size_deepstrom["subsample_size"] == nys_dim]
df_batch_size_deepstrom_nys_dim_sort = df_batch_size_deepstrom_nys_dim.sort_values(by=["deepstrom_dim"]) df_batch_size_deepstrom_nys_dim_sort = df_batch_size_deepstrom_nys_dim.sort_values(by=["deepstrom_dim"])
axxarr3[k].plot(df_batch_size_deepstrom_nys_dim_sort["deepstrom_dim"], axxarr3[k].scatter(df_batch_size_deepstrom_nys_dim_sort["deepstrom_dim"],
df_batch_size_deepstrom_nys_dim_sort["accuracy"], df_batch_size_deepstrom_nys_dim_sort["accuracy"],
label="Deepstrom") label="Deepstrom", marker="x")
nb_val = len(df_batch_size_deepstrom_nys_dim_sort["deepstrom_dim"]) nb_val = len(df_batch_size_deepstrom_nys_dim_sort["deepstrom_dim"])
axxarr3[k].plot(df_batch_size_deepstrom_nys_dim_sort["deepstrom_dim"], axxarr3[k].plot(df_batch_size_deepstrom_nys_dim_sort["deepstrom_dim"],
[df_batch_size_dense["accuracy"].values[0] for _ in range(nb_val)], color="r", [df_batch_size_dense["accuracy"].values[0] for _ in range(nb_val)], color="r",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment