Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in calculating all_by_all_pairwise_similarity #800

Merged
merged 4 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ kgcl-schema = "^0.6.9"

funowl = ">=0.2.0"
gilda = {version = ">=1.0.0", optional = true}
semsimian = {version = ">=0.2.16", optional = true}
semsimian = {version = ">=0.2.18", optional = true}
kgcl-rdflib = "0.5.0"
llm = "^0.14"
html2text = {version = "*", optional = true}
Expand Down
11 changes: 6 additions & 5 deletions src/oaklib/implementations/semsimian/semsimian_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def all_by_all_pairwise_similarity(
minimum_resnik_threshold=min_ancestor_information_content,
# predicates=set(predicates) if predicates else None,
)

logging.info("Post-processing results from semsimian")
for term1_key, values in all_results.items():
for term2_key, result in values.items():
Expand All @@ -228,15 +229,15 @@ def all_by_all_pairwise_similarity(
iter(ancestor_set)
), # TODO: Change this: gets first element of the set
)
sim.jaccard_similarity = jaccard
sim.ancestor_information_content = resnik
sim.phenodigm_score = phenodigm_score

else:
sim = TermPairwiseSimilarity(
subject_id=term1_key, object_id=term2_key, ancestor_id=OWL_THING
)
sim.jaccard_similarity = 0
sim.ancestor_information_content = 0
sim.jaccard_similarity = jaccard if jaccard is not None else 0.0
sim.ancestor_information_content = resnik if resnik is not None else 0.0
sim.phenodigm_score = phenodigm_score if phenodigm_score is not None else 0.0

yield sim

def termset_pairwise_similarity(
Expand Down
Loading