ontolearn.executor
Model adapters.
Attributes
Classes
Functions
|
Used to turn camelCase arguments to snake_case |
|
|
|
Module Contents
- ontolearn.executor.logger
- ontolearn.executor.metrics
- ontolearn.executor.models
- ontolearn.executor.heuristics
- ontolearn.executor.transform_string(input_string)[source]
Used to turn camelCase arguments to snake_case
- class ontolearn.executor.Trainer(learner: BaseConceptLearner, reasoner: owlapy.abstracts.AbstractOWLReasoner)[source]
- learner
- reasoner
- fit(*args, **kwargs)[source]
Run the concept learning algorithm according to its configuration.
Once finished, the results can be queried with the best_hypotheses function.
- best_hypotheses(n)[source]
Get the current best found hypotheses according to the quality.
- Parameters:
n – Maximum number of results.
- Returns:
Iterable with hypotheses in form of search tree nodes.
- predict(individuals: List[owlapy.owl_individual.OWLNamedIndividual], hypotheses: List[_N | owlapy.class_expression.OWLClassExpression] | None = None, axioms: List[owlapy.owl_axiom.OWLAxiom] | None = None, n: int = 10)[source]
- Creates a binary data frame showing for each individual whether it is entailed in the given hypotheses
(class expressions). The individuals do not have to be in the ontology/knowledge base yet. In that case, axioms describing these individuals must be provided.
The state of the knowledge base/ontology is not changed, any provided axioms will be removed again.
- Parameters:
individuals – A list of individuals/instances.
hypotheses – (Optional) A list of search tree nodes or class expressions. If not provided, the current
BaseConceptLearner.best_hypothesis()
of the concept learner are used.axioms – (Optional) A list of axioms that are not in the current knowledge base/ontology. If the individual list contains individuals that are not in the ontology yet, axioms describing these individuals must be provided. The argument can also be used to add arbitrary axioms to the ontology for the prediction.
n – Integer denoting number of ALC concepts to extract from search tree if hypotheses=None.
- Returns:
Pandas data frame with dimensions |individuals|*|hypotheses| indicating for each individual and each hypothesis whether the individual is entailed in the hypothesis.
- save_best_hypothesis(n: int = 10, path: str = 'Predictions', rdf_format: str = 'rdfxml') None [source]
Serialise the best hypotheses to a file.
- Parameters:
n – Maximum number of hypotheses to save.
path – Filename base (extension will be added automatically).
rdf_format – Serialisation format. currently supported: “rdfxml”.