def run_exp(param): """Run an experiment according to given parameters.""" first_gen = read_first_gen_files(param[0]) e = experiment(condition=param[1], comm_self_connected=param[2], run_num=param[3], first_gen=first_gen, today=today, pop=pop, gen=gen, trial_num=trial_num, include_top=top) e.run() e_filename = 'Data/{}_comm_cs_conn_Run{}.exp'.format(today, param[3]) pickle.dump(e, open(e_filename, 'wb')) result = 'done' print('ok:', param) return result
from Experiment import experiment from Generate_First_Gen import read_first_gen_files import sys import pickle pop = 10 gen = 3 trial_num = 3 top = 2 today = '2019_04_32' run_num = int(sys.argv[1]) # number designating the current run first_gen_file = 'FirstGen/Run{}Pop{}65.txt'.format(run_num, pop) first_gen = read_first_gen_files(first_gen_file) e = experiment(condition='comm', comm_self_connected=False, run_num=run_num, first_gen=first_gen, today=today, pop=pop, gen=gen, trial_num=trial_num, include_top=top) if __name__ == '__main__': e.run() e_filename = 'Data/{}_comm_cs_disconn_Run{}.exp'.format(today, run_num) pickle.dump(e, open(e_filename, 'wb'))
, 'rank_score', 'rank_score_upper', 'correct_score', 'correct_score_upper', 'correct_score_hungarian'\ , 'pairs_computed']) for a in adaptiveLSH: for n in noise: for b in bandNumber: for l in noise_level: df = experiment(df, filename='metadata/email.edges', nodeAttributeFile=None, multipleGraph=False, is_perm=False, has_noise=n, noise_level=l, plotAttribute=False, plotBucket=False, plotCorrectness=False, GraphType='Undirected', bandNumber=b, adaptiveLSH=a, LSHType='Cosine', compute_sim=True, compute_hungarian=False, loop_num=1) df = experiment(df, filename='metadata/email.edges', nodeAttributeFile=None, multipleGraph=False, is_perm=False, has_noise=n, noise_level=l,
n = noise[0] l = noise_level[0] for gfile in gfiles: for b in bandNumber: for thr in thresholds: if thr > b: continue df = experiment(df, filename=gfile[0], nodeAttributeFile=None, multipleGraph=False, is_perm=False, has_noise=n, noise_level=l, plotAttribute=False, plotBucket=False, plotCorrectness=False, GraphType=gfile[1], bandNumber=b, adaptiveLSH=a, LSHType='Cosine', compute_sim=True, compute_hungarian=False, loop_num=3, threshold=thr) df = experiment(df, filename=gfile[0], nodeAttributeFile=None, multipleGraph=False, is_perm=False, has_noise=n, noise_level=l,
elif cond == '3': genome_size = 69 elif cond == '4': genome_size = 65 else: print('Error: please enter a valid condition.') run_num = int(sys.argv[2]) # The corresponding first gen files should be generated before running this # via the generate_first_gen function # There should be 2 different files for each run # The pop argument is there mostly to avoid naming conflict first_gen_file = 'FirstGen/{}Run{}Pop{}{}.txt'.format( prefix, run_num, pop, genome_size) first_gen = read_first_gen_files(first_gen_file) e = experiment(condition=cond, run_num=run_num, first_gen=first_gen, today=prefix, pop=pop, gen=gen, trial_num=trial_num, include_top=top) e.run() e_filename = 'Data/Cond{}Run{}/{}_{}_{}_Run{}.exp'.format( cond, run_num, prefix, e.condition, e.csc, run_num) pickle.dump(e, open(e_filename, 'wb'))