def main(args): setup = experiment_setups.parse(args.setup) file_util_out = FileUtil( fileutil.run_dir(setup.dest_dir, setup.name, setup.max_quantifier_length, setup.model_size, setup.random_name)) file_util_in = FileUtil( fileutil.base_dir(setup.dest_dir, setup.name, setup.max_quantifier_length, setup.model_size)) unevaluated_expressions = file_util_in.load_dill('expressions.dill') if args.indices is not None: index_sets = [] for indices_name in args.indices: index_sets.append( set( file_util_in.load_dill( '{0}_expression_indices.dill'.format(indices_name)))) indices = set.intersection(*index_sets) else: indices = range(len(unevaluated_expressions)) if args.sample is None: languages = generate_all(indices, args.max_words, args.fixedwordcount) else: languages = generate_sampled(indices, setup.max_words, args.sample) file_util_out.dump_dill(languages, 'language_indices.dill') file_util_out.save_stringlist([list(map(str, lang)) for lang in languages], 'languages.txt') print("languages.py finished.")
def main(args): setup = experiment_setups.parse(args.setup) processes = setup.processes max_quantifier_length = setup.max_quantifier_length model_size = setup.model_size file_util = FileUtil( fileutil.base_dir(setup.dest_dir, setup.name, max_quantifier_length, model_size)) folderName = "{0}/{1}_length={2}_size={3}".format(setup.dest_dir, setup.name, max_quantifier_length, model_size) processpool = ProcessPool(nodes=processes) expressions = file_util.load_dill('expressions.dill') complexities = processpool.map( lambda ex: setup.measure_expression_complexity( ex, max_quantifier_length), expressions) file_util.dump_dill(complexities, 'expression_complexities.dill') processpool.close() processpool.join() print('Complexity Measuring finished.')
def main(args): processes = args.processes setup = experiment_setups.parse(args.setup) max_quantifier_length = args.max_quantifier_length model_size = args.model_size file_util = FileUtil(fileutil.base_dir(args.dest_dir, setup.name, max_quantifier_length, model_size)) folderName = "{0}/{1}_length={2}_size={3}".format(args.dest_dir, setup.name, max_quantifier_length, model_size) processpool = ProcessPool(nodes=processes) meanings = file_util.load_dill('meanings.dill') costs = processpool.map(measurer.measure_communicative_cost, meanings) file_util.dump_dill(costs, 'expression_costs.dill') processpool.close() processpool.join() print('Informativeness Measuring finished.')