Skip to content

Commit

Permalink
do not let geo score become zero
Browse files Browse the repository at this point in the history
  • Loading branch information
pleary committed Oct 3, 2024
1 parent 38d53ea commit a08c8f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/model_taxonomy_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def load_mapping(self, path, thresholds_path):
if thresholds_path is not None:
thresholds = pd.read_csv(thresholds_path)[["taxon_id", "thres"]]. \
rename(columns={"thres": "geo_threshold"}).set_index("taxon_id").sort_index()
# round thresholds down to 5 decimal places
# round thresholds down to 5 decimal places, as long as that won't make it 0
thresholds["geo_threshold"] = thresholds["geo_threshold"].apply(
lambda x: math.floor(x * 100000) / 100000
lambda x: x if x < 0.00001 else math.floor(x * 100000) / 100000
)
self.df = self.df.join(thresholds)

Expand Down

0 comments on commit a08c8f9

Please sign in to comment.