预训练GloVe向量文件中‘unk’的含义是什么?以glove.6B.50d.txt为例
unk Token的定义说明 Hey there! Great question about the unk token in GloVe pre-trained vectors. Let me break this down clearly for you:
What does
unkstand for?unkis just an abbreviation for unknown — it’s explicitly designed to represent words that didn’t appear in the training corpus used to build the GloVe vectors.Why is it included in files like
glove.6B.50d.txt?
When working with pre-trained word vectors, you’ll almost always run into words that weren’t present during the model’s training (especially if your dataset is different from the Wikipedia+Gigaword mix GloVe used). Theunkvector gives you a standardized fallback for these out-of-vocabulary (OOV) terms, so you don’t have to skip them or cobble together a custom vector on the fly.How is the
unkvector calculated?
For the GloVe 6B series specifically, theunkvector isn’t random. It’s usually the average of all word vectors in the training corpus, or sometimes a vector trained on rare words that were filtered out during vocabulary selection. This makes it a reasonable stand-in for terms that don’t have their own pre-trained representation.
To wrap things up: unk is purely meant for unknown/out-of-vocabulary words, not any other type of abbreviation. It’s a standard part of most pre-trained word embedding sets to handle the common problem of encountering unseen words.
内容的提问来源于stack exchange,提问作者Abhay Gupta

