Skip to content

Commit

Permalink
apply rounding to similarity values
Browse files Browse the repository at this point in the history
  • Loading branch information
philippguevorguian committed Apr 2, 2024
1 parent 10208db commit 7c12ab9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion chemlactica/utils/text_format_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def format_key_value(key, value, rng):
# value = random.sample(value, 5)
value = rng.choice(value, size=10, replace=False, shuffle=False)
for pair in value:
formatted_string += f"{SPECIAL_TAGS['similarity']['start']}{pair['SMILES']} {pair['similarity']}{SPECIAL_TAGS['similarity']['end']}" # noqa
rounded_sim = "{:.2f}".format(float(pair["similarity"]))
formatted_string += f"{SPECIAL_TAGS['similarity']['start']}{pair['SMILES']} {rounded_sim}{SPECIAL_TAGS['similarity']['end']}" # noqa
elif key == "experimental":
for pair in value:
formatted_string += (
Expand Down

0 comments on commit 7c12ab9

Please sign in to comment.