:py:mod:`ontolearn.learners.tree_learner` ========================================= .. py:module:: ontolearn.learners.tree_learner Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: ontolearn.learners.tree_learner.TDL Functions ~~~~~~~~~ .. autoapisummary:: ontolearn.learners.tree_learner.is_float ontolearn.learners.tree_learner.compute_quality ontolearn.learners.tree_learner.make_iterable_verbose ontolearn.learners.tree_learner.extract_cbd ontolearn.learners.tree_learner.explain_inference ontolearn.learners.tree_learner.concepts_reducer .. py:function:: is_float(value) .. py:function:: compute_quality(instances, pos, neg, conf_matrix=False, quality_func=None) .. py:function:: make_iterable_verbose(iterable_object, verbose, desc='Default') -> Iterable .. py:function:: extract_cbd(dataframe) -> Dict[str, List[Tuple[str, str]]] Extract concise bounded description for each entity, where the entity is a subject entity. Create a mapping from a node to out-going edges and connected nodes :param dataframe: :return: .. py:function:: explain_inference(clf, X_test: pandas.DataFrame) 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 .. py:function:: concepts_reducer(concepts: List[owlapy.class_expression.OWLClassExpression], reduced_cls: Callable) -> Union[owlapy.class_expression.OWLObjectUnionOf, owlapy.class_expression.OWLObjectIntersectionOf] Reduces a list of OWLClassExpression instances into a single instance of OWLObjectUnionOf or OWLObjectIntersectionOf .. py:class:: TDL(knowledge_base, use_inverse: bool = False, use_data_properties: bool = False, use_nominals: bool = False, use_card_restrictions: bool = False, quality_func: Callable = None, kwargs_classifier: dict = None, max_runtime: int = 1, grid_search_over: dict = None, grid_search_apply: bool = False, report_classification: bool = False, plot_tree: bool = False, plot_embeddings: bool = False, verbose: int = 1) Tree-based Description Logic Concept Learner .. py:method:: create_training_data(learning_problem: ontolearn.learning_problem.PosNegLPStandard) -> Tuple[pandas.DataFrame, pandas.Series] Create a training data (X:pandas.DataFrame of (n,d) , y:pandas.Series of (n,1)) for binary class problem. n denotes the number of examples d denotes the number of features extracted from n examples. return X, y .. py:method:: construct_owl_expression_from_tree(X: pandas.DataFrame, y: pandas.DataFrame) -> List[owlapy.class_expression.OWLObjectIntersectionOf] Construct an OWL class expression from a decision tree .. py:method:: fit(learning_problem: ontolearn.learning_problem.PosNegLPStandard = None, max_runtime: int = None) Fit the learner to the given learning problem (1) Extract multi-hop information about E^+ and E^- denoted by \mathcal{F}. (1.1) E = list of (E^+ \sqcup E^-). (2) Build a training data \mathbf{X} \in \mathbb{R}^{ |E| imes |\mathcal{F}| } . (3) Create binary labels \mathbf{X}. (4) Construct a set of DL concept for each e \in E^+ (5) Union (4) :param learning_problem: The learning problem :param max_runtime:total runtime of the learning .. py:method:: best_hypotheses(n=1) -> Tuple[owlapy.class_expression.OWLClassExpression, List[owlapy.class_expression.OWLClassExpression]] Return the prediction .. py:method:: predict(X: List[owlapy.owl_individual.OWLNamedIndividual], proba=True) -> numpy.ndarray :abstractmethod: Predict the likelihoods of individuals belonging to the classes