@@ -143,11 +143,11 @@ features = {
143143 "csvs" : {"ext" :"csv" , "argstring" :"" , "filename" :"adjmat" }
144144}
145145
146- # Since we have a lot of different data setups and algs, we need to create a rule for
146+ # Since we have a lot of different data setups and algs, we need to create a rule for
147147# each combination of them.
148148
149149for bmark_setup in config ["benchmark_setup" ]:
150-
150+
151151 graph_estimation = bmark_setup ["evaluation" ]["graph_estimation" ]
152152 graph_types = graph_estimation ["convert_to" ] is not None and graph_estimation ["convert_to" ] or []
153153 graph_types += ["original" ]
@@ -158,14 +158,14 @@ for bmark_setup in config["benchmark_setup"]:
158158 for alg in active_algorithms (bmark_setup , eval_method = "graph_estimation" ):
159159 data_index = 0
160160 # We want one folder per data setup, so we create one rule for each of them.
161-
161+
162162 for sim_setup in bmark_setup ["data" ]:
163- for seed in get_seed_range (sim_setup ["seed_range" ]):
164-
165- adjmat_strings = gen_adjmat_string_from_conf (sim_setup ["graph_id" ], seed )
163+ for seed in get_seed_range (sim_setup ["seed_range" ]):
164+
165+ adjmat_strings = gen_adjmat_string_from_conf (sim_setup ["graph_id" ], seed )
166166 parameters_strings = gen_parameter_string_from_conf (sim_setup ["parameters_id" ], seed )
167167 data_strings = gen_data_string_from_conf (sim_setup ["data_id" ], seed , seed_in_path = False )
168-
168+
169169
170170 if adjmat_strings is None :
171171 adjmat_strings = [None ]
@@ -188,10 +188,9 @@ for bmark_setup in config["benchmark_setup"]:
188188 for adjmat_string in adjmat_strings :
189189 for parameters_string in parameters_strings :
190190 for data_string in data_strings :
191- #print(bmark_setup)
192- rule :
193- name :
194- "results/output/" + bmark_setup_title + "/graph_estimation/dataset_" + str (data_index + 1 )+ "/" + alg + "/graph_type=" + graph_type + "/" + feature
191+ rule :
192+ name :
193+ "results/output/" + bmark_setup_title + "/graph_estimation/dataset_" + str (sim_setup ["graph_id" ]) + "_" + str (sim_setup ["parameters_id" ]) + "_" + str (sim_setup ["data_id" ]) + "_" + str (seed )+ "/" + alg + "/graph_type=" + graph_type + "/" + feature
195194 input :
196195 conf = configfilename ,
197196 graphs = eval_module_conf_to_feature_files_data (filename = feature_dict ["filename" ],
@@ -206,28 +205,31 @@ for bmark_setup in config["benchmark_setup"]:
206205 data_string = data_string ,
207206 alg = alg ,
208207 bmark_setup = bmark_setup )
209-
208+
210209 output :
211- touch ("results/output/" + bmark_setup_title + "/graph_estimation/dataset_" + str (data_index + 1 ) + "/graph_type=" + graph_type + "/" + feature + "/" + alg + ".done" )
210+ touch ("results/output/" + bmark_setup_title + "/graph_estimation/graph_id=" + str (sim_setup [ "graph_id" ]) + "_parameters_id=" + str ( sim_setup [ "parameters_id" ]) + "_data_id=" + str ( sim_setup [ "data_id" ]) + "_seed=" + str ( seed ) + "/graph_type=" + graph_type + "/" + feature + "/" + alg + ".done" )
212211
213212 params :
214213 graph_type = graph_type ,
215214 data_index = str (data_index + 1 ),
216215 feature = feature ,
217216 ext = feature_dict ["ext" ],
218217 alg = alg ,
219- bmark_setup = bmark_setup_title
218+ bmark_setup = bmark_setup_title ,
219+ output_dir = "results/output/" + bmark_setup_title + "/graph_estimation/graph_id=" + str (sim_setup ["graph_id" ]) + "_parameters_id=" + str (sim_setup ["parameters_id" ]) + "_data_id=" + str (sim_setup ["data_id" ]) + "_seed=" + str (seed ) + "/graph_type=" + graph_type + "/" + feature + "/" + alg
220+
221+ run :
220222
221- run :
222- output_dir = "results/output/{params.bmark_setup}/graph_estimation/dataset_" + params ["data_index" ]+ "/graph_type=" + params ["graph_type" ]+ "/" + params ["feature" ]+ "/" + params ["alg" ]
223223 # clean old file while keeping the directory
224224 # check if the directory exists
225- if Path (output_dir ).exists ():
225+ if Path (params [ " output_dir" ] ).exists ():
226226 # remove all files in the directory
227- [f .unlink () for f in Path (output_dir ).glob ("*.png" ) ]
228- for i , f in enumerate (input .graphs ):
229- shell ("mkdir -p " + output_dir )
230- shell ("cp " + f + " " + output_dir + "/" + params ["alg" ]+ "_" + params ["graph_type" ]+ "_" + str (i + 1 ) + "." + params ["ext" ])
227+ [f .unlink () for f in Path (params ["output_dir" ]).glob ("*.png" ) ]
228+
229+ # This is to iterate over all the parameter settings.
230+ for j , f in enumerate (input .graphs ):
231+ shell ("mkdir -p " + params ["output_dir" ])
232+ shell ("cp " + f + " " + params ["output_dir" ] + "/" + params ["alg" ]+ "_" + params ["graph_type" ]+ "_" + str (j + 1 ) + "." + params ["ext" ])
231233
232234 data_index += 1
233235
0 commit comments