From dd09e2205166be5c003b3d51cdc1f7e132ad06c3 Mon Sep 17 00:00:00 2001 From: Jean-KOUAGOU Date: Mon, 9 Dec 2024 19:13:20 +0100 Subject: [PATCH 1/5] add script to run Drill and TDL on dbpedia --- .../owl_class_expresion_learning_dbpedia.py | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 examples/owl_class_expresion_learning_dbpedia.py diff --git a/examples/owl_class_expresion_learning_dbpedia.py b/examples/owl_class_expresion_learning_dbpedia.py new file mode 100644 index 00000000..753f7343 --- /dev/null +++ b/examples/owl_class_expresion_learning_dbpedia.py @@ -0,0 +1,146 @@ +"""$ python examples/retrieval_eval.py --path_kg "https://dbpedia.data.dice-research.org/sparql" + +""" +import os +from tqdm import tqdm +import random +import itertools +import ast +import json +import time +from ontolearn.learners import Drill, TDL +from ontolearn.triple_store import TripleStore +from owlapy.owl_individual import OWLNamedIndividual, IRI +from ontolearn.learning_problem import PosNegLPStandard +from ontolearn.utils import f1_set_similarity +from typing import Tuple, Set +import pandas as pd +from owlapy.parser import DLSyntaxParser +from owlapy import owl_expression_to_dl +from owlapy.converter import owl_expression_to_sparql +from argparse import ArgumentParser +# Set pandas options to ensure full output +pd.set_option('display.max_rows', None) +pd.set_option('display.max_columns', None) +pd.set_option('display.width', None) +pd.set_option('display.colheader_justify', 'left') +pd.set_option('display.expand_frame_repr', False) + +def execute(args): + # (1) Initialize knowledge base. + assert args.endpoint_triple_store, 'A SPARQL endpoint of DBpedia must be provided via `--endpoint_triple_store "url"`' + try: + kb = TripleStore(url=args.endpoint_triple_store) + kb_namespace = list(kb.ontology.classes_in_signature())[0].iri.get_namespace() + dl_parser = DLSyntaxParser(kb_namespace) + except: + raise ValueError("You must provide a valid SPARQL endpoint!") + # Fix the random seed. + random.seed(args.seed) + + + ################################################################### + + print("\n") + print("#"*50) + print("Starting class expression learning on DBpedia...") + print("#" * 50,end="\n\n") + + def query_func(query): + try: + response = requests.post(args.endpoint_triple_store, data={"query": query}, timeout=300) + except RequestException as e: + raise RequestException( + f"Make sure the server is running on the `triplestore_address` = '{args.endpoint_triple_store}'" + f". Check the error below:" + f"\n -->Error: {e}" + ) + + json_results = response.json() + vars_ = list(json_results["head"]["vars"]) + inds = [] + for b in json_results["results"]["bindings"]: + val = [] + for v in vars_: + if b[v]["type"] == "uri": + val.append(b[v]["value"]) + inds.extend(val) + + if inds: + yield from inds + else: + yield None + + model = Drill(knowledge_base=kb, max_runtime=240) if args.model.lower() == "drill" else TDL(knowledge_base=kb) + with open("./LPs/DBpedia2022-12/lps.json") as f: + lps = json.load(f) + + if os.path.exists(args.path_report): + os.remove(args.path_report) + file_exists = False + + for item in (tqdm_bar := tqdm(lps, position=0, leave=True)): + retrieval_y: Set[str] + runtime_y: float + + lp = PosNegLPStandard(pos=set(list(map(OWLNamedIndividual,map(IRI.create, item["examples"]["positive examples"])))), + neg=set(list(map(OWLNamedIndividual,map(IRI.create, item["examples"]["negative examples"]))))) + # (5) Learn description logic concepts best fitting + t0 = time.time() + h = model.fit(learning_problem=lp).best_hypotheses() + t1 = time.time() + print("\nStarting query after solution is computed!\n") + concept_to_sparql_query = owl_expression_to_sparql(h) + "\nLIMIT 100" # Due to the size of DBpedia learning problems contain at most 100 pos and 100 neg examples + actual_instances = set(item["examples"]["positive examples"]) + retrieved_instances = set(query_func(concept_to_sparql_query)) + f1 = f1_set_similarity(actual_instances, retrieved_instances) + print(f"\n{h}") + print("Quality (F1): ", f1) + + df_row = pd.DataFrame( + [{ + "Expression": owl_expression_to_dl(dl_parser.parse(item["target expression"])), + "Type": type(dl_parser.parse(item["target expression"])).__name__, + "F1": f1, + "Runtime": t1 - t0, + #"Retrieved_Instances": retrieved_instances, + }]) + + # Append the row to the CSV file + df_row.to_csv(args.path_report, mode='a', header=not file_exists, index=False) + file_exists = True + # () Update the progress bar. + tqdm_bar.set_description_str( + f"Expression: {owl_expression_to_dl(dl_parser.parse(item['target expression']))} | F1 :{f1:.4f} | Runtime:{t1 - t0:.3f}" + ) + # () Read the data into pandas dataframe + df = pd.read_csv(args.path_report, index_col=0) + # () Assert that the mean Jaccard Similarity meets the threshold + assert df["F1"].mean() >= args.min_f1_score + + # () Extract numerical features + numerical_df = df.select_dtypes(include=["number"]) + + # () Group by the type of OWL concepts + df_g = df.groupby(by="Type") + print(df_g["Type"].count()) + + # () Compute mean of numerical columns per group + mean_df = df_g[numerical_df.columns].mean() + print(mean_df) + return jaccard, f1 + +def get_default_arguments(): + parser = ArgumentParser() + parser.add_argument("--model", type=str, default="Drill") + parser.add_argument("--path_kge_model", type=str, default=None) + parser.add_argument("--endpoint_triple_store", type=str, default="https://dbpedia.data.dice-research.org/sparql") + parser.add_argument("--seed", type=int, default=1) + parser.add_argument("--min_f1_score", type=float, default=0.0, help="Minimum f1 score of computed solutions") + + # H is obtained if the forward chain is applied on KG. + parser.add_argument("--path_report", type=str, default=f"CEL_on_DBpedia_with_{args.model}.csv") + return parser.parse_args() + +if __name__ == "__main__": + execute(get_default_arguments()) From b63f756bf0ac7c57d7e5852d9c4f785d88aea529 Mon Sep 17 00:00:00 2001 From: Jean-KOUAGOU Date: Tue, 10 Dec 2024 09:33:58 +0100 Subject: [PATCH 2/5] update script for cel on DBpedia --- examples/owl_class_expresion_learning_dbpedia.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/owl_class_expresion_learning_dbpedia.py b/examples/owl_class_expresion_learning_dbpedia.py index 753f7343..9b305a4d 100644 --- a/examples/owl_class_expresion_learning_dbpedia.py +++ b/examples/owl_class_expresion_learning_dbpedia.py @@ -8,11 +8,14 @@ import ast import json import time +import requests +from requests import Response +from requests.exceptions import RequestException, JSONDecodeError from ontolearn.learners import Drill, TDL from ontolearn.triple_store import TripleStore from owlapy.owl_individual import OWLNamedIndividual, IRI from ontolearn.learning_problem import PosNegLPStandard -from ontolearn.utils import f1_set_similarity +from ontolearn.utils import f1_set_similarity, compute_f1_score from typing import Tuple, Set import pandas as pd from owlapy.parser import DLSyntaxParser @@ -80,6 +83,7 @@ def query_func(query): file_exists = False for item in (tqdm_bar := tqdm(lps, position=0, leave=True)): + retrieval_y: Set[str] runtime_y: float @@ -93,9 +97,8 @@ def query_func(query): concept_to_sparql_query = owl_expression_to_sparql(h) + "\nLIMIT 100" # Due to the size of DBpedia learning problems contain at most 100 pos and 100 neg examples actual_instances = set(item["examples"]["positive examples"]) retrieved_instances = set(query_func(concept_to_sparql_query)) - f1 = f1_set_similarity(actual_instances, retrieved_instances) - print(f"\n{h}") - print("Quality (F1): ", f1) + f1 = compute_f1_score(retrieved_instances, set(item["examples"]["positive examples"]), set(item["examples"]["negative examples"])) + print(f"Computed solution: {h}") df_row = pd.DataFrame( [{ @@ -128,7 +131,7 @@ def query_func(query): # () Compute mean of numerical columns per group mean_df = df_g[numerical_df.columns].mean() print(mean_df) - return jaccard, f1 + return f1 def get_default_arguments(): parser = ArgumentParser() @@ -139,7 +142,7 @@ def get_default_arguments(): parser.add_argument("--min_f1_score", type=float, default=0.0, help="Minimum f1 score of computed solutions") # H is obtained if the forward chain is applied on KG. - parser.add_argument("--path_report", type=str, default=f"CEL_on_DBpedia_with_{args.model}.csv") + parser.add_argument("--path_report", type=str, default=f"CEL_on_DBpedia.csv") return parser.parse_args() if __name__ == "__main__": From ca050ef681bfa92ba55ee1c84d7029c5f5700e7d Mon Sep 17 00:00:00 2001 From: Jean-KOUAGOU Date: Tue, 10 Dec 2024 15:12:59 +0100 Subject: [PATCH 3/5] fix issue related to temporary failures on triple store endpoint --- examples/owl_class_expresion_learning_dbpedia.py | 12 ++++++------ ontolearn/triple_store.py | 14 +++++++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/examples/owl_class_expresion_learning_dbpedia.py b/examples/owl_class_expresion_learning_dbpedia.py index 9b305a4d..95d94757 100644 --- a/examples/owl_class_expresion_learning_dbpedia.py +++ b/examples/owl_class_expresion_learning_dbpedia.py @@ -80,13 +80,10 @@ def query_func(query): if os.path.exists(args.path_report): os.remove(args.path_report) + file_exists = False for item in (tqdm_bar := tqdm(lps, position=0, leave=True)): - - retrieval_y: Set[str] - runtime_y: float - lp = PosNegLPStandard(pos=set(list(map(OWLNamedIndividual,map(IRI.create, item["examples"]["positive examples"])))), neg=set(list(map(OWLNamedIndividual,map(IRI.create, item["examples"]["negative examples"]))))) # (5) Learn description logic concepts best fitting @@ -142,8 +139,11 @@ def get_default_arguments(): parser.add_argument("--min_f1_score", type=float, default=0.0, help="Minimum f1 score of computed solutions") # H is obtained if the forward chain is applied on KG. - parser.add_argument("--path_report", type=str, default=f"CEL_on_DBpedia.csv") + parser.add_argument("--path_report", type=str, default=None) return parser.parse_args() if __name__ == "__main__": - execute(get_default_arguments()) + args = get_default_arguments() + if not args.path_report : + args.path_report = f"CEL_on_DBpedia_{args.model.upper()}.csv" + execute(args) diff --git a/ontolearn/triple_store.py b/ontolearn/triple_store.py index 9b6f8b55..c17a77d2 100644 --- a/ontolearn/triple_store.py +++ b/ontolearn/triple_store.py @@ -1195,4 +1195,16 @@ def query(self, sparql: str): yield from self.g.query(sparql_query=sparql) def query_results(self, sparql: str): - return self.g.query(sparql_query=sparql) + trials = 0 + response = None + while True: + try: + response = self.g.query(sparql_query=sparql) + results = response.json()["results"]["bindings"] + break + except Exception: + trials += 1 + if trials > 10: + print("\n\nSPARQL endpoint not working properly. Sent a query 10 times but no results!!!\n") + break + return response From 0278fcf1dac8132562d93d41253d540d68744abf Mon Sep 17 00:00:00 2001 From: Jean-KOUAGOU Date: Wed, 11 Dec 2024 14:28:36 +0100 Subject: [PATCH 4/5] Add results to README, document owl_class_expression_learning_dbpedia script, revert triple_store file removing multiple attempts to query --- README.md | 60 ++++++++++++++++++- .../owl_class_expresion_learning_dbpedia.py | 59 +++++++++++++----- ontolearn/triple_store.py | 14 +---- 3 files changed, 103 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 0fde0e5a..0e777040 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ wget https://files.dice-research.org/projects/Ontolearn/KGs.zip -O ./KGs.zip && wget https://files.dice-research.org/projects/Ontolearn/LPs.zip -O ./LPs.zip && unzip LPs.zip ``` -## Learning OWL Class Expression +## Learning OWL Class Expressions ```python from ontolearn.learners import TDL from ontolearn.triple_store import TripleStore @@ -97,7 +97,8 @@ weighted avg 1.00 1.00 1.00 4 """ ``` -## Learning OWL Class Expression over DBpedia +## Learning OWL Class Expressions over DBpedia +1. Single learning problem ```python from ontolearn.learners import TDL, Drill from ontolearn.triple_store import TripleStore @@ -120,6 +121,61 @@ print(owl_expression_to_sparql(expression=h)) save_owl_class_expressions(expressions=h,path="#owl_prediction") ``` +2. On 106 learning problems from https://files.dice-research.org/projects/Ontolearn/LPs.zip + +- Commands: +```bash +python examples/owl_class_expression_learning_dbpedia.py --model TDL +``` +Or +```bash +python examples/owl_class_expression_learning_dbpedia.py --model Drill +``` +- Results: + +```python +""" + Cardinality +Type +OWLObjectAllValuesFrom 7 +OWLObjectIntersectionOf 14 +OWLObjectUnionOf 85 + + +Type +OWLObjectAllValuesFrom 1.000000 206.287996 +OWLObjectIntersectionOf 0.717172 91.663047 +OWLObjectUnionOf 0.966652 129.699940 + F1 Runtime +""" + +# Or + +""" + Cardinality +Type +OWLObjectAllValuesFrom 7 +OWLObjectIntersectionOf 14 +OWLObjectUnionOf 85 + + + F1 Runtime +Type +OWLObjectAllValuesFrom 1.000000 206.287996 +OWLObjectIntersectionOf 0.717172 91.663047 +OWLObjectUnionOf 0.966652 129.699940 + + +Type +OWLObjectAllValuesFrom 0.437500 240.330940 +OWLObjectIntersectionOf 0.212930 202.557878 +OWLObjectUnionOf 0.546334 187.144105 + +""" +``` + + + Fore more please refer to the [examples](https://github.com/dice-group/Ontolearn/tree/develop/examples) folder. ## ontolearn-webservice diff --git a/examples/owl_class_expresion_learning_dbpedia.py b/examples/owl_class_expresion_learning_dbpedia.py index 95d94757..bf4a8b56 100644 --- a/examples/owl_class_expresion_learning_dbpedia.py +++ b/examples/owl_class_expresion_learning_dbpedia.py @@ -1,6 +1,25 @@ -"""$ python examples/retrieval_eval.py --path_kg "https://dbpedia.data.dice-research.org/sparql" +"""$ python examples/owl_class_expresion_learning_dbpedia.py --endpoint_triple_store "https://dbpedia.data.dice-research.org/sparql" --model "TDL" +Computing conjunctive_concepts... +Constructing Description Logic Concepts: 0%| Constructing Description Logic Concepts: 100%|██████████████████████████████████████████████████████████████████████████████████| 100/100 [00:00<00:00, 870187.55it/s] +Computing disjunction_of_conjunctive_concepts... + +Starting query after solution is computed! + +Computed solution: OWLClass(IRI('http://dbpedia.org/ontology/', 'President')) +Expression: President ⊔ Actor | F1 :1.0000 | Runtime:171.275: 99%|██████████████████████████████████████████████████████████████▍| 105/106 [3:49:14<01:31, 91.8Expression: President ⊔ Actor | F1 :1.0000 | Runtime:171.275: 100%|██████████████████████████████████████████████████████████████| 106/106 [3:49:14<00:00, 115.6Expression: President ⊔ Actor | F1 :1.0000 | Runtime:171.275: 100%|██████████████████████████████████████████████████████████████| 106/106 [3:49:14<00:00, 129.76s/it] +Type +OWLObjectAllValuesFrom 7 +OWLObjectIntersectionOf 14 +OWLObjectUnionOf 85 +Name: Type, dtype: int64 + F1 Runtime +Type +OWLObjectAllValuesFrom 1.000000 206.287996 +OWLObjectIntersectionOf 0.717172 91.663047 +OWLObjectUnionOf 0.966652 129.699940 """ +# Make imports import os from tqdm import tqdm import random @@ -30,7 +49,7 @@ pd.set_option('display.expand_frame_repr', False) def execute(args): - # (1) Initialize knowledge base. + # Initialize knowledge base. assert args.endpoint_triple_store, 'A SPARQL endpoint of DBpedia must be provided via `--endpoint_triple_store "url"`' try: kb = TripleStore(url=args.endpoint_triple_store) @@ -49,6 +68,7 @@ def execute(args): print("Starting class expression learning on DBpedia...") print("#" * 50,end="\n\n") + # Define a query function to retrieve instances of class expressions def query_func(query): try: response = requests.post(args.endpoint_triple_store, data={"query": query}, timeout=300) @@ -73,30 +93,38 @@ def query_func(query): yield from inds else: yield None - + + # Initialize the model model = Drill(knowledge_base=kb, max_runtime=240) if args.model.lower() == "drill" else TDL(knowledge_base=kb) + # Read learning problems from file with open("./LPs/DBpedia2022-12/lps.json") as f: lps = json.load(f) - + + # Check if csv arleady exists and delete it cause we want to override it if os.path.exists(args.path_report): os.remove(args.path_report) file_exists = False - + # Iterate over all problems and solve for item in (tqdm_bar := tqdm(lps, position=0, leave=True)): + # Create a learning problem object lp = PosNegLPStandard(pos=set(list(map(OWLNamedIndividual,map(IRI.create, item["examples"]["positive examples"])))), neg=set(list(map(OWLNamedIndividual,map(IRI.create, item["examples"]["negative examples"]))))) - # (5) Learn description logic concepts best fitting + # Learn description logic concepts best fitting t0 = time.time() h = model.fit(learning_problem=lp).best_hypotheses() t1 = time.time() print("\nStarting query after solution is computed!\n") + # Convert the learned expression into a sparql query concept_to_sparql_query = owl_expression_to_sparql(h) + "\nLIMIT 100" # Due to the size of DBpedia learning problems contain at most 100 pos and 100 neg examples + # Load actual instances of the target expression actual_instances = set(item["examples"]["positive examples"]) + # Compute instances of the learned expression retrieved_instances = set(query_func(concept_to_sparql_query)) + # Compute the quality of the learned expression f1 = compute_f1_score(retrieved_instances, set(item["examples"]["positive examples"]), set(item["examples"]["negative examples"])) print(f"Computed solution: {h}") - + # Write results in a dictionary and create a dataframe df_row = pd.DataFrame( [{ "Expression": owl_expression_to_dl(dl_parser.parse(item["target expression"])), @@ -109,28 +137,29 @@ def query_func(query): # Append the row to the CSV file df_row.to_csv(args.path_report, mode='a', header=not file_exists, index=False) file_exists = True - # () Update the progress bar. + # Update the progress bar. tqdm_bar.set_description_str( f"Expression: {owl_expression_to_dl(dl_parser.parse(item['target expression']))} | F1 :{f1:.4f} | Runtime:{t1 - t0:.3f}" ) - # () Read the data into pandas dataframe + # Read the data into pandas dataframe df = pd.read_csv(args.path_report, index_col=0) - # () Assert that the mean Jaccard Similarity meets the threshold + # Assert that the mean f1 score meets the threshold assert df["F1"].mean() >= args.min_f1_score - # () Extract numerical features + # Extract numerical features numerical_df = df.select_dtypes(include=["number"]) - # () Group by the type of OWL concepts + # Group by the type of OWL concepts df_g = df.groupby(by="Type") print(df_g["Type"].count()) - # () Compute mean of numerical columns per group + # Compute mean of numerical columns per group mean_df = df_g[numerical_df.columns].mean() print(mean_df) return f1 def get_default_arguments(): + # Define an argument parser parser = ArgumentParser() parser.add_argument("--model", type=str, default="Drill") parser.add_argument("--path_kge_model", type=str, default=None) @@ -138,12 +167,12 @@ def get_default_arguments(): parser.add_argument("--seed", type=int, default=1) parser.add_argument("--min_f1_score", type=float, default=0.0, help="Minimum f1 score of computed solutions") - # H is obtained if the forward chain is applied on KG. parser.add_argument("--path_report", type=str, default=None) return parser.parse_args() if __name__ == "__main__": + # Get default or input values of arguments args = get_default_arguments() - if not args.path_report : + if not args.path_report: args.path_report = f"CEL_on_DBpedia_{args.model.upper()}.csv" execute(args) diff --git a/ontolearn/triple_store.py b/ontolearn/triple_store.py index c17a77d2..9b6f8b55 100644 --- a/ontolearn/triple_store.py +++ b/ontolearn/triple_store.py @@ -1195,16 +1195,4 @@ def query(self, sparql: str): yield from self.g.query(sparql_query=sparql) def query_results(self, sparql: str): - trials = 0 - response = None - while True: - try: - response = self.g.query(sparql_query=sparql) - results = response.json()["results"]["bindings"] - break - except Exception: - trials += 1 - if trials > 10: - print("\n\nSPARQL endpoint not working properly. Sent a query 10 times but no results!!!\n") - break - return response + return self.g.query(sparql_query=sparql) From f094c110349c0c68c8984a0fd9e4456bc20b61b5 Mon Sep 17 00:00:00 2001 From: Jean-KOUAGOU Date: Wed, 11 Dec 2024 15:26:01 +0100 Subject: [PATCH 5/5] update README --- README.md | 69 ++++++++++--------------------------------------------- 1 file changed, 12 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 0e777040..338cd04c 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,6 @@ weighted avg 1.00 1.00 1.00 4 ``` ## Learning OWL Class Expressions over DBpedia -1. Single learning problem ```python from ontolearn.learners import TDL, Drill from ontolearn.triple_store import TripleStore @@ -121,61 +120,6 @@ print(owl_expression_to_sparql(expression=h)) save_owl_class_expressions(expressions=h,path="#owl_prediction") ``` -2. On 106 learning problems from https://files.dice-research.org/projects/Ontolearn/LPs.zip - -- Commands: -```bash -python examples/owl_class_expression_learning_dbpedia.py --model TDL -``` -Or -```bash -python examples/owl_class_expression_learning_dbpedia.py --model Drill -``` -- Results: - -```python -""" - Cardinality -Type -OWLObjectAllValuesFrom 7 -OWLObjectIntersectionOf 14 -OWLObjectUnionOf 85 - - -Type -OWLObjectAllValuesFrom 1.000000 206.287996 -OWLObjectIntersectionOf 0.717172 91.663047 -OWLObjectUnionOf 0.966652 129.699940 - F1 Runtime -""" - -# Or - -""" - Cardinality -Type -OWLObjectAllValuesFrom 7 -OWLObjectIntersectionOf 14 -OWLObjectUnionOf 85 - - - F1 Runtime -Type -OWLObjectAllValuesFrom 1.000000 206.287996 -OWLObjectIntersectionOf 0.717172 91.663047 -OWLObjectUnionOf 0.966652 129.699940 - - -Type -OWLObjectAllValuesFrom 0.437500 240.330940 -OWLObjectIntersectionOf 0.212930 202.557878 -OWLObjectUnionOf 0.546334 187.144105 - -""" -``` - - - Fore more please refer to the [examples](https://github.com/dice-group/Ontolearn/tree/develop/examples) folder. ## ontolearn-webservice @@ -310,7 +254,7 @@ Below, we report the average test F1 score and the average runtimes of learners. | Aunt | 0.614 | 13.697 | 0.855 | 13.697 | 0.978 | 5.278 | 0.811 | 60.351 | 0.956 | 0.118 | 0.812 | 1.168 | 0.855 | 14.059 | | Cousin | 0.712 | 10.846 | 0.789 | 10.846 | 0.993 | 3.311 | 0.701 | 60.485 | 0.820 | 0.176 | 0.677 | 1.050 | 0.779 | 9.050 | | Grandgranddaughter | 1.000 | 0.013 | 1.000 | 0.013 | 1.000 | 0.426 | 0.980 | 17.486 | 1.000 | 0.050 | 1.000 | 0.843 | 1.000 | 0.639 | -| Grandgrandfather | 1.000 | 0.897 | 1.000 | 0.897 | 1.000 | 0.404 | 0.947 | 55.728 | 0.947 | 0.059 | 0.927 | 0.902 | 1.000 | 0.746 | +| Grandgrandfather | 1.000 | 0.897 | 1.000 | 0.897 | 1.000 | 0.404 | 0.947 | 55.728 | 0.947 | 0.059 | 0.927 | 0.902 | 1.000 | 0.746 |91.66 | Grandgrandmother | 1.000 | 4.173 | 1.000 | 4.173 | 1.000 | 0.442 | 0.893 | 50.329 | 0.947 | 0.060 | 0.927 | 0.908 | 1.000 | 0.817 | | Grandgrandson | 1.000 | 1.632 | 1.000 | 1.632 | 1.000 | 0.452 | 0.931 | 60.358 | 0.911 | 0.070 | 0.911 | 1.050 | 1.000 | 0.939 | | Uncle | 0.876 | 16.244 | 0.891 | 16.244 | 0.964 | 4.516 | 0.876 | 60.416 | 0.933 | 0.098 | 0.891 | 1.256 | 0.928 | 17.682 | @@ -347,6 +291,17 @@ python examples/concept_learning_cv_evaluation.py --kb ./KGs/Carcinogenesis/carc | NOTKNOWN | 0.737 | 0.711 | 62.048 | 0.740 | 0.701 | 62.048 | 0.822 | 0.628 | 64.508 | 0.740 | 0.707 | 60.120 | 1.000 | 0.616 | 5.196 | 0.705 | 0.704 | 4.157 | 0.740 | 0.701 | 48.475| +### Benchmark Results on DBpedia. Results are based on the training examples only + +```shell +python examples/owl_class_expression_learning_dbpedia.py --model Drill && python examples/owl_class_expression_learning_dbpedia.py --model TDL +``` +| LP-Type | Train-F1-Drill | RT-Drill | Train-F1-TDL | RT-TDL | +|:--------------------------|---------------:|-------------:|---------------:|--------------:| +| OWLObjectAllValuesFrom | 0.438 | 240.331 | 1.000 | 206.288 | +| OWLObjectIntersectionOf | 0.213 | 202.558 | 0.717 | 91.660 | +| OWLObjectUnionOf | 0.546 | 187.144 | 0.967 | 129.700 | + ## Development