Skip to content
Snippets Groups Projects
Commit 24a0dadc authored by Tim O'Donnell's avatar Tim O'Donnell
Browse files

better logging

parent 3d1c8971
No related branches found
No related tags found
No related merge requests found
...@@ -215,15 +215,16 @@ def run(argv=sys.argv[1:]): ...@@ -215,15 +215,16 @@ def run(argv=sys.argv[1:]):
# which it adds models to, so no merging is required. It also saves # which it adds models to, so no merging is required. It also saves
# as it goes so no saving is required at the end. # as it goes so no saving is required at the end.
start = time.time() start = time.time()
for _ in tqdm.trange(len(work_items)): for _ in tqdm.trange(len(work_items)):
item = work_items.pop(0) # want to keep freeing up memory item = work_items.pop(0) # want to keep freeing up memory
work_predictor = work_entrypoint(item) work_predictor = work_entrypoint(item)
assert work_predictor is predictor assert work_predictor is predictor
assert not work_items
print("*" * 30) print("*" * 30)
print("Trained %d networks in %0.2f sec." % ( training_time = time.time() - start
len(predictor.neural_networks), time.time() - start)) print("Trained affinity predictor with %d networks in %0.2f sec." % (
len(predictor.neural_networks), training_time))
print("*" * 30) print("*" * 30)
if args.percent_rank_calibration_num_peptides_per_length > 0: if args.percent_rank_calibration_num_peptides_per_length > 0:
...@@ -232,14 +233,19 @@ def run(argv=sys.argv[1:]): ...@@ -232,14 +233,19 @@ def run(argv=sys.argv[1:]):
predictor.calibrate_percentile_ranks( predictor.calibrate_percentile_ranks(
num_peptides_per_length=args.percent_rank_calibration_num_peptides_per_length, num_peptides_per_length=args.percent_rank_calibration_num_peptides_per_length,
worker_pool=worker_pool) worker_pool=worker_pool)
percent_rank_calibration_time = time.time() - start
print("Finished calibrating percent ranks in %0.2f sec." % ( print("Finished calibrating percent ranks in %0.2f sec." % (
time.time() - start)) percent_rank_calibration_time))
predictor.save(args.out_models_dir, model_names_to_write=[]) predictor.save(args.out_models_dir, model_names_to_write=[])
if worker_pool: if worker_pool:
worker_pool.close() worker_pool.close()
worker_pool.join() worker_pool.join()
print("Train time: %0.2f sec. Percent rank calibration time: %0.2f sec." % (
training_time, percent_rank_calibration_time))
print("Predictor written to: %s" % args.out_models_dir)
def work_entrypoint(item): def work_entrypoint(item):
return process_work(**item) return process_work(**item)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment