ontolearn.learners.tree_learner

Module Contents

Classes

TDL

Tree-based Description Logic Concept Learner

Functions

is_float(value)

compute_quality(instances, pos, neg[, conf_matrix, ...])

extract_cbd(→ Dict[str, List[Tuple[str, str]]])

Extract concise bounded description for each entity, where the entity is a subject entity.

explain_inference(clf, X_test, features, only_shared)

concepts_reducer(...)

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

ontolearn.learners.tree_learner.is_float(value)[source]
ontolearn.learners.tree_learner.compute_quality(instances, pos, neg, conf_matrix=False, quality_func=None)[source]
ontolearn.learners.tree_learner.extract_cbd(dataframe) Dict[str, List[Tuple[str, str]]][source]

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:

ontolearn.learners.tree_learner.explain_inference(clf, X_test, features, only_shared)[source]
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, 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)[source]

Tree-based Description Logic Concept Learner

create_training_data(learning_problem: PosNegLPStandard) Tuple[pandas.DataFrame, pandas.Series][source]

Create a training data (X,y) for binary classification problem, where X is a sparse binary matrix and y is a binary vector.

X: shape (n,d) y: shape (n,1).

n denotes the number of examples d denotes the number of features extracted from n examples.

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^- 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}.

  1. Construct a set of DL concept for each e in E^+

  2. Union (4)

Parameters:

learning_problem – The learning problem

:param max_runtime:total runtime of the learning

best_hypotheses(n=1)[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