ontolearn.learners.tree_learner

Classes

TDL

Tree-based Description Logic Concept Learner

Functions

explain_inference(clf, X)

Given a trained Decision Tree, extract the paths from root to leaf nodes for each entities

concepts_reducer(...)

Reduces a list of OWLClassExpression instances into a single instance of OWLObjectUnionOf or OWLObjectIntersectionOf

Module Contents

ontolearn.learners.tree_learner.explain_inference(clf, X: pandas.DataFrame)[source]

Given a trained Decision Tree, extract the paths from root to leaf nodes for each entities https://scikit-learn.org/stable/auto_examples/tree/plot_unveil_tree_structure.html#understanding-the-decision-tree-structure

ontolearn.learners.tree_learner.concepts_reducer(concepts: List[owlapy.class_expression.OWLClassExpression], reduced_cls: Callable) owlapy.class_expression.OWLObjectUnionOf | owlapy.class_expression.OWLObjectIntersectionOf[source]

Reduces a list of OWLClassExpression instances into a single instance of OWLObjectUnionOf or OWLObjectIntersectionOf

class ontolearn.learners.tree_learner.TDL(knowledge_base, use_inverse: bool = False, use_data_properties: bool = False, use_nominals: bool = False, use_card_restrictions: bool = False, kwargs_classifier: dict = None, max_runtime: int = 1, grid_search_over: dict = None, grid_search_apply: bool = False, report_classification: bool = True, plot_tree: bool = False, plot_embeddings: bool = False, plot_feature_importance: bool = False, verbose: int = 10)[source]

Tree-based Description Logic Concept Learner

use_nominals
use_card_restrictions
grid_search_over
knowledge_base
report_classification
plot_tree
plot_embeddings
plot_feature_importance
clf = None
kwargs_classifier
max_runtime
features = None
disjunction_of_conjunctive_concepts = None
conjunctive_concepts = None
owl_class_expressions
cbd_mapping: Dict[str, Set[Tuple[str, str]]]
types_of_individuals
verbose
data_property_cast
X = None
y = None
extract_expressions_from_owl_individuals(individuals: List[owlapy.owl_individual.OWLNamedIndividual]) Tuple[Dict[str, owlapy.class_expression.OWLClassExpression], Dict[str, str]][source]
construct_sparse_binary_representations(features: List[owlapy.class_expression.OWLClassExpression], examples: List[owlapy.owl_individual.OWLNamedIndividual], examples_to_features) numpy.array[source]
create_training_data(learning_problem: PosNegLPStandard) Tuple[pandas.DataFrame, pandas.DataFrame][source]
construct_owl_expression_from_tree(X: pandas.DataFrame, y: pandas.DataFrame) List[owlapy.class_expression.OWLObjectIntersectionOf][source]

Construct an OWL class expression from a decision tree

fit(learning_problem: PosNegLPStandard = None, max_runtime: int = None)[source]

Fit the learner to the given learning problem

  1. Extract multi-hop information about E^+ and E^-.

  2. Create OWL Class Expressions from (1)

  3. Build a binary sparse training data X where first |E+| rows denote the binary representations of positives Remaining rows denote the binary representations of E⁻

(4) Create binary labels. (4) Construct a set of DL concept for each e in E^+ (5) Union (4)

Parameters:

learning_problem – The learning problem

:param max_runtime:total runtime of the learning

property classification_report: str
best_hypotheses(n=1) Tuple[owlapy.class_expression.OWLClassExpression, List[owlapy.class_expression.OWLClassExpression]][source]

Return the prediction

abstract predict(X: List[owlapy.owl_individual.OWLNamedIndividual], proba=True) numpy.ndarray[source]

Predict the likelihoods of individuals belonging to the classes