Skip to content

Commit

Permalink
select nearby common ancestor if some taxa are nearby
Browse files Browse the repository at this point in the history
  • Loading branch information
pleary committed Aug 21, 2024
1 parent c3da9fd commit dee8b6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ test-obs*
lib/vision_cache/*
config.yml
env.list
test-results*
*.ipynb
7 changes: 7 additions & 0 deletions lib/inat_inferrer.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,15 @@ def common_ancestor_from_aggregated_scores(
):
aggregated_score_to_use = "normalized_aggregated_vision_score" if \
score_to_use == "vision_score" else "normalized_aggregated_combined_score"
# if using combined scores to aggregate, and there are taxa expected nearby,
# then add a query filter to only look at nearby taxa as common ancestor candidates
nearby_query_filter = ""
if aggregated_score_to_use == "normalized_aggregated_combined_score" and not \
aggregated_scores.query("aggregated_geo_score >= aggregated_geo_threshold").empty:
nearby_query_filter = " and aggregated_geo_score >= aggregated_geo_threshold"
common_ancestor_candidates = aggregated_scores.query(
f"{aggregated_score_to_use} > 0.78 and rank_level >= 20 and rank_level <= 33"
f"{nearby_query_filter}"
).sort_values(
by=["rank_level"]
)
Expand Down

0 comments on commit dee8b6e

Please sign in to comment.