def transformer_tf_test(): # Transformer tf transformer_tf = transformations_tf.Transformer() start_time = time.time() _ = transformer_test(transformer_tf) print("Time transformer_test(transformer_tf) %s" % utils.timer(start_time, time.time()), flush=True) """
def transformer_traditional_test(): # Transformer transformer = transformations.Transformer() start_time = time.time() _ = transformer_test(transformer) print("Time transformer_test(transformer) %s" % utils.timer(start_time, time.time()), flush=True) """
def transformer_tf_returning_test(): # Transformer tf transformer_tf = transformations_tf.Transformer() start_time = time.time() data = transformer_test(transformer_tf) print("Time transformer_test(transformer_tf) %s" % utils.timer(start_time, time.time()), flush=True) del transformer_tf return data
transformer = Transformer() model = TransformODSimpleModel(data_loader=ztf_od_loader, transformer=transformer, input_shape=x_train.shape[1:]) model.build(tuple([None] + list(x_train.shape[1:]))) # print(model.network.model().summary()) weight_path = os.path.join(PROJECT_PATH, 'results', model.name, 'my_checkpoint_simple.h5') if os.path.exists(weight_path): model.load_weights(weight_path) else: model.fit(x_train, x_val) start_time = time.time() met_dict = model.evaluate_od(x_train, x_test, y_test, 'ztf-real-bog-v1', 'real', x_val) print("Time model.evaluate_od %s" % utils.timer(start_time, time.time()), flush=True) print('\nroc_auc') for key in met_dict.keys(): print(key, met_dict[key]['roc_auc']) print('\nacc_at_percentil') for key in met_dict.keys(): print(key, met_dict[key]['acc_at_percentil']) print('\nmax_accuracy') for key in met_dict.keys(): print(key, met_dict[key]['max_accuracy']) model.save_weights(weight_path)
# N_RUNS), # ( # hits_outlier_dataset, kernel_transformer, 'hits', 'real', # N_RUNS), (hits_outlier_dataset, kernel_plus_transformer, 'hits', 'real', N_RUNS ), # ( # ztf_outlier_dataset_63, trans_transformer, 'ztf-real-bog-v1-63', 'real', # N_RUNS), # ( # ztf_outlier_dataset_63, kernel_transformer, 'ztf-real-bog-v1-63', # 'real', # N_RUNS), # ( # ztf_outlier_dataset_63, transformer, 'ztf-real-bog-v1-63', 'real', # N_RUNS), # ( # ztf_outlier_dataset_63, kernel_plus_transformer, 'ztf-real-bog-v1-63', # 'real', # N_RUNS), ] start_time = time.time() for data_loader, transformer, dataset_name, class_name, run_i in experiments_list: run_experiments(data_loader, transformer, dataset_name, class_name, run_i) print("Time elapsed to train everything: " + utils.timer(start_time, time.time())) # metrics_to_create_table = {} # create_auc_table()