BoxELPPI

class mowl.models.BoxELPPI(*args, **kwargs)[source]

Bases: BoxEL

Example of BoxEL for protein-protein interaction prediction.

Customizes negative sampling to use only protein IDs from the evaluation classes instead of all ontology classes.

Attributes Summary

protein_ids

Methods Summary

evaluate_ppi()

generate_negatives(gci_name, gci_dataset)

Generate negative samples for a given GCI type.

get_negative_sampling_config()

Returns the active negative sampling configuration.

Attributes Documentation

protein_ids

Methods Documentation

evaluate_ppi()[source]
generate_negatives(gci_name, gci_dataset)[source]

Generate negative samples for a given GCI type.

Override this method for custom negative sampling strategies.

Parameters:
  • gci_name (str) – Name of the GCI type (e.g., ‘gci2’)

  • gci_dataset (torch.Tensor) – The dataset containing positive samples

Returns:

Negative samples tensor, or None if no negatives for this GCI type

Return type:

torch.Tensor or None

get_negative_sampling_config()[source]

Returns the active negative sampling configuration.

When neg_sampling_gcis is None (the default), the configuration is derived automatically from the intersection of _DEFAULT_NEG_SAMPLING_CONFIG and the module’s neg_capable_gcis — so only GCIs that the module genuinely supports are included.

When neg_sampling_gcis is set explicitly, only those GCIs are included. Training will raise NotImplementedError if any of them are absent from neg_capable_gcis.

Override this method to customise which GCI types require negative sampling and how negatives should be generated.

Returns:

Dictionary mapping GCI names to their negative sampling config. Each entry has:

  • 'index_pool': 'classes' or 'individuals' — pool to sample from

  • 'corrupt_column': int — which column of the data tensor to replace

Return type:

dict