From 27751411a5970cec8321bf96567f10367a315c36 Mon Sep 17 00:00:00 2001 From: "Harle, Antoine (Contracteur)" Date: Mon, 25 Nov 2019 12:14:58 -0500 Subject: [PATCH] Test Brutus skip res deja obtenu --- higher/test_dataug.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/higher/test_dataug.py b/higher/test_dataug.py index d4d391e..5b82b0f 100644 --- a/higher/test_dataug.py +++ b/higher/test_dataug.py @@ -74,11 +74,11 @@ if __name__ == "__main__": print('-'*9) ''' #### Augmented Model #### - ''' + #''' t0 = time.process_time() tf_dict = {k: TF.TF_dict[k] for k in tf_names} #tf_dict = TF.TF_dict - aug_model = Augmented_model(Data_augV5(TF_dict=tf_dict, N_TF=1, mix_dist=0.0, fixed_prob=False, fixed_mag=True, shared_mag=True), LeNet(3,10)).to(device) + aug_model = Augmented_model(Data_augV5(TF_dict=tf_dict, N_TF=1, mix_dist=0.0, fixed_prob=True, fixed_mag=False, shared_mag=False), LeNet(3,10)).to(device) #aug_model = Augmented_model(Data_augV5(TF_dict=tf_dict, N_TF=2, mix_dist=0.5, fixed_mag=True, shared_mag=True), WideResNet(num_classes=10, wrn_size=160)).to(device) print(str(aug_model), 'on', device_name) #run_simple_dataug(inner_it=n_inner_iter, epochs=epochs) @@ -98,7 +98,7 @@ if __name__ == "__main__": print('Execution Time : %.00f '%(time.process_time() - t0)) print('-'*9) - ''' + #''' #### TF tests #### #''' res_folder="res/brutus-tests/" @@ -110,6 +110,7 @@ if __name__ == "__main__": TF_nb = [len(tf_dict)] #range(10,len(TF.TF_dict)+1) #[len(TF.TF_dict)] N_seq_TF= [1, 2, 3, 4] mag_setup = [(True,True), (False, False)] + #prob_setup = [True, False] nb_run= 3 try: @@ -124,11 +125,14 @@ if __name__ == "__main__": for dist in dist_mix: #for i in TF_nb: for m_setup in mag_setup: + #for p_setup in prob_setup: for run in range(nb_run): + if n_inner_iter == 0 and (m_setup!=(True,True) or p_setup!=True): continue #Autres setup inutiles sans meta-opti + if n_inner_iter ==1 and (n_tf==1 or n_tf==2): continue #Deja resultats #keys = list(TF.TF_dict.keys())[0:i] #ntf_dict = {k: TF.TF_dict[k] for k in keys} - aug_model = Augmented_model(Data_augV5(TF_dict=tf_dict, N_TF=n_tf, mix_dist=dist, fixed_mag=m_setup[0], shared_mag=m_setup[1]), LeNet(3,10)).to(device) + aug_model = Augmented_model(Data_augV5(TF_dict=tf_dict, N_TF=n_tf, mix_dist=dist, fixed_prob=False, fixed_mag=m_setup[0], shared_mag=m_setup[1]), LeNet(3,10)).to(device) print(str(aug_model), 'on', device_name) #run_simple_dataug(inner_it=n_inner_iter, epochs=epochs) log= run_dist_dataugV2(model=aug_model, epochs=epochs, inner_it=n_inner_iter, dataug_epoch_start=dataug_epoch_start, print_freq=20, loss_patience=None) @@ -137,7 +141,7 @@ if __name__ == "__main__": print('-'*9) times = [x["time"] for x in log] out = {"Accuracy": max([x["acc"] for x in log]), "Time": (np.mean(times),np.std(times)), "Device": device_name, "Param_names": aug_model.TF_names(), "Log": log} - print(str(aug_model),": acc", out["Accuracy"], "in (s?):", out["Time"][0], "+/-", out["Time"][1]) + print(str(aug_model),": acc", out["Accuracy"], "in :", out["Time"][0], "+/-", out["Time"][1]) filename = "{}-{}epochs(dataug:{})-{}in_it-{}".format(str(aug_model),epochs,dataug_epoch_start,n_inner_iter,run) with open(res_folder+"log/%s.json" % filename, "w+") as f: json.dump(out, f, indent=True)