PseudoTypedNegativeSampler
- class PseudoTypedNegativeSampler(*, mapped_triples: Tensor, **kwargs)[source]
Bases:
NegativeSampler
A sampler that accounts for which entities co-occur with a relation.
To generate a corrupted head entity for triple \((h, r, t)\), only those entities are considered which occur as a head entity in a triple with the relation \(r\).
Warning
With this type of sampler, filtering for false negatives is more important.
Instantiate the pseudo-typed negative sampler.
- Parameters:
mapped_triples (Tensor) – the positive training triples
kwargs – Additional keyword based arguments passed to
pykeen.sampling.NegativeSampler
.
Methods Summary
corrupt_batch
(positive_batch)Generate negative samples from the positive batch without application of any filter.
Methods Documentation
- corrupt_batch(positive_batch: Tensor)[source]
Generate negative samples from the positive batch without application of any filter.
- Parameters:
positive_batch (Tensor) – shape: (*batch_dims, 3) The positive triples.
- Returns:
shape: (*batch_dims, num_negs_per_pos, 3) The negative triples.
result[*bi, :, :]
contains the negative examples generated frompositive_batch[*bi, :]
.