ontolearn.learning_problem_generator

Learning problem generator.

Attributes

SearchAlgos

Classes

LearningProblemGenerator

Learning problem generator.

Module Contents

ontolearn.learning_problem_generator.SearchAlgos
class ontolearn.learning_problem_generator.LearningProblemGenerator(knowledge_base: KnowledgeBase, refinement_operator=None, num_problems=10000, num_diff_runs=100, min_num_instances=None, max_num_instances=sys.maxsize, min_length=3, max_length=5, depth=3, search_algo='strict-dfs')[source]

Learning problem generator.

kb
rho
search_algo
min_num_instances
max_num_instances
min_length
max_length
valid_learning_problems = []
depth
num_diff_runs
num_problems
export_concepts(concepts: List[Node], path: str)[source]

Serialise the given concepts to a file.

Parameters:
  • concepts (list) – Node objects.

  • path (str) – Filename base (extension will be added automatically).

concept_individuals_to_string_balanced_examples(concept: owlapy.class_expression.OWLClassExpression) Dict[str, Set][source]
get_balanced_n_samples_per_examples(*, n=5, min_num_problems=None, max_length=None, min_length=None, num_diff_runs=None, min_num_instances=None, search_algo='strict-dfs') Iterable[Tuple[RL_State, Set[owlapy.owl_individual.OWLNamedIndividual], Set[owlapy.owl_individual.OWLNamedIndividual]]][source]
  1. We generate min_num_problems number of concepts.

  2. For each concept, we generate n number of positive and negative examples.

  3. Each example contains n samples.

balanced_n_sampled_lp(n: int, string_all_pos: set)[source]
get_balanced_examples(*, min_num_problems=None, max_length=None, min_length=None, num_diff_runs=None, min_num_instances=None, search_algo='strict-dfs') list[source]
  1. Generate valid examples with input search algorithm.

  2. Balance valid examples.

Returns:

A list of balanced tuples (s,p,n) where s denotes the string representation of a concept, p and n denote a set of URIs of individuals indicating positive and negative examples.

get_examples(*, num_problems=None, max_length=None, min_length=None, num_diff_runs=None, min_num_ind=None, search_algo=None) list[source]
  1. Get valid examples with input search algorithm.

Returns:

A list of tuples (s,p,n) where s denotes the string representation of a concept, p and n denote a set of URIs of individuals indicating positive and negative examples.

get_concepts(*, num_problems=None, max_length=None, min_length=None, max_num_instances=None, num_diff_runs=None, min_num_instances=None, search_algo=None) Generator[source]

Calls generate_examples

generate_examples(*, num_problems=None, max_length=None, min_length=None, num_diff_runs=None, max_num_instances=None, min_num_instances=None, search_algo=None) Generator[source]

Generate examples via search algorithm that are valid examples w.r.t. given constraints.

Returns:

Valid examples

apply_rho_on_rl_state(rl_state)[source]