besskge.negative_sampler.TypeBasedShardedNegativeSampler
- class besskge.negative_sampler.TypeBasedShardedNegativeSampler(triple_types, n_negative, sharding, corruption_scheme, local_sampling, seed)[source]
Corrupt entities with entities of the same type.
Initialize type-based negative sampler.
- Parameters:
triple_types (
ndarray
[Any
,dtype
[int32
]]) – shape: (n_triple, 2) Type IDs of head and tail entities for all triples.n_negative (
int
) – seeRandomShardedNegativeSampler.__init__()
sharding (
Sharding
) – seeRandomShardedNegativeSampler.__init__()
corruption_scheme (
str
) – seeRandomShardedNegativeSampler.__init__()
local_sampling (
bool
) – seeRandomShardedNegativeSampler.__init__()
seed (
int
) – seeRandomShardedNegativeSampler.__init__()