ontolearn.learners.nces

NCES: Neural Class Expression Synthesis.

Classes

NCES

Neural Class Expression Synthesis.

Module Contents

class ontolearn.learners.nces.NCES(knowledge_base, nces2_or_roces=False, quality_func: AbstractScorer | None = None, num_predictions=5, learner_names=['SetTransformer', 'LSTM', 'GRU'], path_of_embeddings=None, path_temp_embeddings=None, path_of_trained_models=None, auto_train=True, proj_dim=128, rnn_n_layers=2, drop_prob=0.1, num_heads=4, num_seeds=1, m=32, ln=False, dicee_model='DeCaL', dicee_epochs=5, dicee_lr=0.01, dicee_emb_dim=128, learning_rate=0.0001, tmax=20, eta_min=1e-05, clip_value=5.0, batch_size=256, num_workers=4, max_length=48, load_pretrained=True, sorted_examples=False, verbose: int = 0, enforce_validity: bool | None = None)[source]

Bases: ontolearn.base_nces.BaseNCES

Neural Class Expression Synthesis.

name = 'NCES'
knowledge_base
learner_names = ['SetTransformer', 'LSTM', 'GRU']
path_of_embeddings = None
path_temp_embeddings = None
path_of_trained_models = None
dicee_model = 'DeCaL'
dicee_emb_dim = 128
dicee_epochs = 5
dicee_lr = 0.01
rnn_n_layers = 2
sorted_examples = False
has_renamed_inds = False
enforce_validity = None
get_synthesizer(path=None)[source]
refresh(path=None)[source]
get_prediction(x_pos, x_neg)[source]
fit_one(pos: List[owlapy.owl_individual.OWLNamedIndividual] | List[str], neg: List[owlapy.owl_individual.OWLNamedIndividual] | List[str])[source]
fit(learning_problem: PosNegLPStandard, **kwargs)[source]
best_hypotheses(n=1, return_node: bool = False) owlapy.class_expression.OWLClassExpression | Iterable[owlapy.class_expression.OWLClassExpression] | AbstractNode | Iterable[AbstractNode] | None[source]
convert_to_list_str_from_iterable(data)[source]
fit_from_iterable(dataset: List[Tuple[str, Set[owlapy.owl_individual.OWLNamedIndividual], Set[owlapy.owl_individual.OWLNamedIndividual]]] | List[Tuple[str, Set[str], Set[str]]], shuffle_examples=False, verbose=False, **kwargs) List[source]
  • Dataset is a list of tuples where the first items are strings corresponding to target concepts.

  • This function returns predictions as owl class expressions, not nodes as in fit

train(data: Iterable[List[Tuple]] = None, epochs=50, batch_size=64, max_num_lps=1000, refinement_expressivity=0.2, refs_sample_size=50, learning_rate=0.0001, tmax=20, eta_min=1e-05, clip_value=5.0, num_workers=8, save_model=True, storage_path=None, optimizer='Adam', record_runtime=True, example_sizes=None, shuffle_examples=False)[source]