dice-group / Ontolearn

Ontolearn is an open-source software library for explainable structured machine learning in Python. It learns OWL class expressions from positive and negative examples.
https://ontolearn-docs-dice-group.netlify.app/index.html
MIT License
40 stars 9 forks source link

Retrieval Eval error for KGs with no object properties #487

Closed LckyLke closed 12 hours ago

LckyLke commented 1 day ago

https://github.com/dice-group/Ontolearn/blob/90996aa453d1ab3526f308f8ee24eae447cfa26d/examples/retrieval_eval.py#L89-L91

This causes in error if we use a KG with no object properties. (e.g. lymphography.owl) Thus we should change the maximum to max(0, int(len(nc) * args.ratio_sample_nc).

Demirrr commented 1 day ago

Yes. Could you fix it ?

LckyLke commented 1 day ago

Yes. Could you fix it ?

Yes! Ig the same holds for this sampling of named concepts:

    if args.ratio_sample_nc:
        # (6.1) Subsample if required.
        nc = {i for i in random.sample(population=list(nc), k=max(1, int(len(nc) * args.ratio_sample_nc)))}

but are there kgs that dont define classes?

Demirrr commented 1 day ago

Yes!

LckyLke commented 1 day ago

ok then i will change that as well :)

Demirrr commented 1 day ago

Thank you 👍

Demirrr commented 12 hours ago

fixed in #488