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

Semantic caching algorithm added #512

Merged
merged 12 commits into from
Feb 24, 2025
Merged

Semantic caching algorithm added #512

merged 12 commits into from
Feb 24, 2025

Conversation

Louis-Mozart
Copy link
Contributor

Code for the semantic caching paper.

@github-actions github-actions bot temporarily deployed to pull request January 27, 2025 14:11 Inactive
@Demirrr
Copy link
Member

Demirrr commented Jan 29, 2025

@Louis-Mozart please fix the errors

@Louis-Mozart
Copy link
Contributor Author

Louis-Mozart commented Jan 29, 2025

@Louis-Mozart please fix the errors

I think the error comes from the fact that the dice file system is not working. See below:

`
--2025-01-27 14:46:57-- (try:18) https://files.dice-research.org/projects/Ontolearn/KGs.zip
Connecting to files.dice-research.org (files.dice-research.org)|131.234.26.214|:443... failed: Connection timed out.
Retrying.

--2025-01-27 14:49:20-- (try:19) https://files.dice-research.org/projects/Ontolearn/KGs.zip
Connecting to files.dice-research.org (files.dice-research.org)|131.234.26.214|:443... failed: Connection timed out.
Retrying.

--2025-01-27 14:51:44-- (try:20) https://files.dice-research.org/projects/Ontolearn/KGs.zip
Connecting to files.dice-research.org (files.dice-research.org)|131.234.26.214|:443... failed: Connection timed out.
Giving up.
`

@alkidbaci
Copy link
Collaborator

Hi @Louis-Mozart, would it be possible for you to add some test cases for your code in ontolearn/tests directory?
I noticed some outdated code and made a few corrections. Would be great to have this code covered by tests so that we avoid such errors in the future :)

@Demirrr Demirrr requested a review from alkidbaci February 13, 2025 11:13
@Louis-Mozart
Copy link
Contributor Author

Hi, sorry was on leave. Alright, I guess the error was because I wrote the code on an old version of Ontolearn (0.7.3), I upgraded to the latest version and added the tests as requested see tests/test_semantic_cache.

@alkidbaci
Copy link
Collaborator

alkidbaci commented Feb 19, 2025

I was having a look at the error that caused the test to fail, its because the JVM is stopped in a previous operation (and the JVM cannot be restarted - a limitation from Jpype).
I came across this file test_retrieval_eval_examples.py where you call the method execute from examples.retrieval_eval_under_incomplete where you stop the JVM in line 228. Just remove that line and everything will be fine. In general you don't need to stop the JVM because it automatically stops when the whole code has finish execution. The function stopJVM is there to use in some exceptional scenarios where the execution is computationally demanding and you know that at some point the JVM will not be used anymore so you stop it.

@Louis-Mozart
Copy link
Contributor Author

It's done but still not working. Could it be that the test is executed on the family which requires a bit of time?

@alkidbaci
Copy link
Collaborator

Family ontology is not that large actually. I re-run the tests to see when it does fail, and it fails as soon as it enters your test. So the scenario that it takes time and memory is overloaded does not seem very likely. I would say, try to test it locally using pytest and see if everything passes. That way we can rule-out some scenarios and isolate the issue.

@Louis-Mozart
Copy link
Contributor Author

Louis-Mozart commented Feb 24, 2025

Yes, all the tests work locally on Father and Family datasets, see below.

==================================================================== test session starts =====================================================================
platform linux -- Python 3.10.14, pytest-8.2.0, pluggy-1.5.0 -- /home/dice/anaconda3/envs/venv/bin/python
cachedir: .pytest_cache
rootdir: /home/dice/Desktop/Ontolearn
plugins: anyio-4.3.0
collected 4 items                                                                                                                                            

tests/test_semantic_cache.py::TestSemanticCache::test_jaccard PASSED                                                                                   [ 25%]
tests/test_semantic_cache.py::TestSemanticCache::test_cache_methods PASSED                                                                             [ 50%]
tests/test_semantic_cache.py::TestSemanticCache::test_cache_size PASSED                                                                                [ 75%]
tests/test_semantic_cache.py::TestSemanticCache::test_eviction_strategy PASSED                                                                         [100%]

@alkidbaci alkidbaci merged commit 5b9e506 into develop Feb 24, 2025
2 checks passed
@github-actions github-actions bot temporarily deployed to pull request February 24, 2025 13:39 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 25, 2025 12:19 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 25, 2025 12:27 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants