ontolearn.utils

Ontolearn utils.

Submodules

Package Contents

Functions

setup_logging([config_file])

Setup logging.

compute_f1_score(→ float)

Compute F1-score of a concept

parametrized_performance_debugger([fmt])

performance_debugger(func_name)

create_experiment_folder([folder_name])

serializer(*, object_, path, serialized_name)

deserializer(*, path, serialized_name)

apply_TSNE_on_df(→ None)

balanced_sets(→ Tuple[Set, Set])

Balance given two sets through sampling without replacement.

read_csv(→ Union[None, pandas.DataFrame])

Path leads a folder containing embeddings in csv format.

assertion_path_isfile(→ bool)

sanity_checking_args(args)

read_individuals_file(...)

Read a text file containing IRIs of Named Individuals (one per line) and return the content as a set of OWL

read_named_classes_file(...)

Read a text file containing IRIs of OWL Named Classes (one per line) and return the content as a set of OWL

Attributes

Factory

DEFAULT_FMT

flag_for_performance

ontolearn.utils.setup_logging(config_file='ontolearn/logging.conf')[source]

Setup logging.

Parameters:

config_file (str) – Filepath for logs.

ontolearn.utils.compute_f1_score(individuals, pos, neg) float[source]

Compute F1-score of a concept

ontolearn.utils.Factory
ontolearn.utils.DEFAULT_FMT = 'Func:{name} took {elapsed:0.8f}s'
ontolearn.utils.flag_for_performance = False
ontolearn.utils.parametrized_performance_debugger(fmt=DEFAULT_FMT)[source]
ontolearn.utils.performance_debugger(func_name)[source]
ontolearn.utils.create_experiment_folder(folder_name='Log')[source]
ontolearn.utils.serializer(*, object_: object, path: str, serialized_name: str)[source]
ontolearn.utils.deserializer(*, path: str, serialized_name: str)[source]
ontolearn.utils.apply_TSNE_on_df(df) None[source]
ontolearn.utils.balanced_sets(a: set, b: set) Tuple[Set, Set][source]

Balance given two sets through sampling without replacement. Returned sets have the same length. @param a: @param b: @return:

ontolearn.utils.read_csv(path) None | pandas.DataFrame[source]

Path leads a folder containing embeddings in csv format. indexes correspond subjects or predicates or objects in n-triple. @param path: @return:

ontolearn.utils.assertion_path_isfile(path) bool[source]
ontolearn.utils.sanity_checking_args(args)[source]
ontolearn.utils.read_individuals_file(file: str) Set[owlapy.owl_individual.OWLNamedIndividual][source]

Read a text file containing IRIs of Named Individuals (one per line) and return the content as a set of OWL Named Individuals

Parameters:

file – path to the text file with the IRIs of the named individuals

Returns:

set of OWLNamedIndividual with these IRIs

ontolearn.utils.read_named_classes_file(file: str) Set[owlapy.class_expression.OWLClass][source]

Read a text file containing IRIs of OWL Named Classes (one per line) and return the content as a set of OWL Classes

Parameters:

file – path to the text file with the IRIs of the classes

Returns:

set of OWLNamedIndividual with these IRIs