Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- master
- develop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to make this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is done in order to not publish the documentation changes while developing. This way the documentation gets published whenever we do a new release (so when we merge with master) and the documentation stays consistent to the latest version of our library. We also specify the version in the documentation so it wont be correct to have the documentation changed while still developing features that are not out yet.

If there is a error in the docs or something that has to be chaged quickly we can use the documentation branch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. it makes sense!

- documentation # only for quick updates or testing purposes
pull_request:

jobs:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ pre_trained_agents.zip
embeddings.zip
KGs.zip
/Fuseki/
/checkpoints/
/KGs/
**/NCESData*
**/CLIPData*
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Coverage](https://img.shields.io/badge/coverage-86%25-green)](https://ontolearn-docs-dice-group.netlify.app/usage/09_further_resources#code-coverage)
[![Pypi](https://img.shields.io/badge/pypi-0.8.0-blue)](https://pypi.org/project/ontolearn/0.8.0/)
[![Docs](https://img.shields.io/badge/documentation-0.8.0-yellow)](https://ontolearn-docs-dice-group.netlify.app/usage/01_introduction)
[![Pypi](https://img.shields.io/badge/pypi-0.8.1-blue)](https://pypi.org/project/ontolearn/0.8.1/)
[![Docs](https://img.shields.io/badge/documentation-0.8.1-yellow)](https://ontolearn-docs-dice-group.netlify.app/usage/01_introduction)
[![Python](https://img.shields.io/badge/python-3.10.13+-4584b6)](https://www.python.org/downloads/release/python-31013/)
 

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/01_introduction.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# About Ontolearn

**Version:** ontolearn 0.8.0
**Version:** ontolearn 0.8.1

**GitHub repository:** [https://github.com/dice-group/Ontolearn](https://github.com/dice-group/Ontolearn)

Expand Down
7 changes: 4 additions & 3 deletions examples/retrieval_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def execute(args):
object_properties = sorted({i for i in symbolic_kb.get_object_properties()})

# (3.1) Subsample if required.
if args.ratio_sample_object_prop:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prop is an abbreviation of property. Why do we need to use prob?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the file retrieval_eval_under_incomplete.py there is the same argument but with the name ratio_sample_object_prob. They both have the same description and are both numerical values. One of them has to be wrong right? For a moment i thought this was related to probability (since it was a number), that is why I made this change but now that you mentioned it, it has to be incorrect in the retrieval_eval_under_incomplete.py file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use ratio_sample_object_prop, where p stands for property

if args.ratio_sample_object_prob:
object_properties = {i for i in random.sample(population=list(object_properties),
k=max(1, int(len(object_properties) * args.ratio_sample_object_prop)))}
k=max(1, int(len(object_properties) * args.ratio_sample_object_prob)))}

object_properties = set(object_properties)

Expand Down Expand Up @@ -261,6 +261,7 @@ def concept_retrieval(retriever_func, c) -> Tuple[Set[str], float]:
print(df_g["Type"].count())
mean_df = df_g[numerical_df.columns].mean()
print(mean_df)
return jaccard_sim, f1_sim


def get_default_arguments():
Expand All @@ -271,7 +272,7 @@ def get_default_arguments():
parser.add_argument("--gamma", type=float, default=0.9)
parser.add_argument("--seed", type=int, default=1)
parser.add_argument("--ratio_sample_nc", type=float, default=0.2, help="To sample OWL Classes.")
parser.add_argument("--ratio_sample_object_prop", type=float, default=0.1, help="To sample OWL Object Properties.")
parser.add_argument("--ratio_sample_object_prob", type=float, default=0.1, help="To sample OWL Object Properties.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

b needs to be p

parser.add_argument("--min_jaccard_similarity", type=float, default=0.0, help="Minimum Jaccard similarity to be achieve by the reasoner")
parser.add_argument("--num_nominals", type=int, default=10, help="Number of OWL named individuals to be sampled.")

Expand Down
1 change: 1 addition & 0 deletions examples/retrieval_eval_under_incomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def execute(args):
print(final_df.head())
print(f"Results have been saved to {final_csv_path}")
stopJVM()
return avg_jaccard_reasoners



Expand Down
2 changes: 1 addition & 1 deletion ontolearn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
# SOFTWARE.
# -----------------------------------------------------------------------------

__version__ = '0.8.0'
__version__ = '0.8.1'
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"tqdm>=4.64.0",
"transformers>=4.38.1",
"pytest>=7.2.2",
"owlapy==1.3.2",
"owlapy==1.3.3",
"dicee==0.1.4",
"ontosample>=0.2.2",
"sphinx>=7.2.6",
Expand Down Expand Up @@ -95,7 +95,7 @@ def deps_list(*pkgs):
setup(
name="ontolearn",
description="Ontolearn is an open-source software library for structured machine learning in Python. Ontolearn includes modules for processing knowledge bases, inductive logic programming and ontology engineering.",
version="0.8.0",
version="0.8.1",
packages=find_packages(),
install_requires=extras["min"],
extras_require=extras,
Expand Down
52 changes: 52 additions & 0 deletions tests/test_retrieval_eval_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
import unittest
from examples.retrieval_eval import execute
from examples.retrieval_eval_under_incomplete import execute as execute2
import shutil

class RetrievalTests(unittest.TestCase):

def test_retrieval_eval(self):
class ARGS:
def __init__(self):
self.path_kg = "KGs/Family/father.owl"
self.path_kge_model = None
self.endpoint_triple_store = None
self.gamma = 0.9
self.seed = 1
self.min_jaccard_similarity = 0.0
self.ratio_sample_nc = 0.2
self.ratio_sample_object_prob = 0.1
self.num_nominals = 10
self.path_report = "incomplete_father_0_1/ALCQHI_Retrieval_Results.csv"
args = ARGS()
os.mkdir("incomplete_father_0_1")
js, f1 = execute(args)

self.assertEqual(js, 1.0)
self.assertEqual(f1, 1.0)

def test_retrieval_eval_under_incomplete(self):
class ARGS:
def __init__(self):
self.path_kg = "KGs/Family/father.owl"
self.seed = 1
self.ratio_sample_nc = None
self.ratio_sample_object_prob = None
self.path_report = "ALCQHI_Retrieval_Results.csv"
self.number_of_subgraphs = 1
self.ratio = 0.1
self.operation = "incomplete"
self.sample = "No"

args = ARGS()
results = execute2(args)
for r, v in results.items():
self.assertGreaterEqual(v, 0.9)
if os.path.exists("incomplete_father_0_1"):
shutil.rmtree("incomplete_father_0_1")
if os.path.exists("KGs_Family_father_owl"):
shutil.rmtree("KGs_Family_father_owl")
if os.path.exists("checkpoints"):
shutil.rmtree("checkpoints")

Loading