-
Notifications
You must be signed in to change notification settings - Fork 9
Owlapy 1.3.3 #486
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
Owlapy 1.3.3 #486
Changes from 8 commits
a341baa
a1d5216
2ab1ac7
731cb47
899a8e3
4b90661
7268aa7
18238a3
2afa1a7
e5c4ee7
f6ee946
9abad1c
dfb0a4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the file There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
||
|
@@ -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(): | ||
|
@@ -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.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.") | ||
|
||
|
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") | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. it makes sense!