Classifying a prohibitively large number of intersection classes efficiently

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Classifying a prohibitively large number of intersection classes efficiently

bonnevie
My use case is that I have a large number of individuals who each have a list of binary features (stored in a classical data table), each feature indicating whether they belong in a particular class from the ontology or its complement. I need to classify the intersection classes determined by these features for each individual, one at a time.

I don't have any relationships between individuals, so I see no need to instantiate them all in the ontology  at the same time, improving computational efficiency.
Is there a "best" way to do this in Owlready, avoiding ideally both the ontology blow-up and any reasoner overhead?
Can I instantiate a class, sync the reasoner, and then remove the class from the ontology again?  
Or am I worried about the ontology blowing up for no reason?
Reply | Threaded
Open this post in threaded view
|

Re: Classifying a prohibitively large number of intersection classes efficiently

Jiba
Administrator
Hello,

I think it depends whether the number of individuals is really high, and the limit of the reasoner.

Classifying individuals one by one is probably not the best option in terms of performance (because reasoners have a starting time, and because they also need to classify the classes). The best  solution is probably to group them in batch of about 100-1000 individuals.

You can instantiate the classes, and then destroy the individuals after classification.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Classifying a prohibitively large number of intersection classes efficiently

bonnevie
Batching seems like a good idea, thanks.

Do all the classes get inferred anew on every call to sync_reasoner? Is it not possible to materialize all the inferred relations by calling sync_reasoner on the raw ontology first, before any individuals are added?

Instead of creating/deleting, would it be possible to keep the original ontology and its inferences in a separate world, and then make copies of that world for all the individual classifications?

I think my question was also partially in the hope that there was something like a backwards-chaining reasoner that just tries to prove/disprove a single fact in the ontology.
Reply | Threaded
Open this post in threaded view
|

Re: Classifying a prohibitively large number of intersection classes efficiently

Jiba
Administrator
I think that tableau-based reasoners need to make all inferences each times they are called. You can try and check whether a second call to the reasoner (with the inferences from the previous call) is faster, but it don't think it will be.

Proving a single fact is not possible: the reasoner needs to prove everything. Ontology-reasoning is so complex that it is very difficult to isolate the prove of a single fact.

Jiba