{ }
Generates labels for candidate sampling with a learned unigram distribution.
tf.raw_ops.FixedUnigramCandidateSampler(
true_classes,
num_true,
num_sampled,
unique,
range_max,
vocab_file='',
distortion=1,
num_reserved_ids=0,
num_shards=1,
shard=0,
unigrams=[],
seed=0,
seed2=0,
name=None
)
A unigram sampler could use a fixed unigram distribution read from a file or passed in as an in-memory array instead of building up the distribution from data on the fly. There is also an option to skew the distribution by applying a distortion power to the weights.
The vocabulary file should be in CSV-like format, with the last field being the weight associated with the word.
For each batch, this op picks a single set of sampled candidate labels.
The advantages of sampling candidates per-batch are simplicity and the possibility of efficient dense matrix multiplication. The disadvantage is that the sampled candidates must be chosen independently of the context and of the true labels.