Gensim: KeyedVectors.train()
Gensim: KeyedVectors.train()
我从 here 下载了维基百科词向量。我加载了向量:
model_160 = KeyedVectors.load_word2vec_format(wiki_160_path, binary=False)
然后想训练他们:
model_160.train()
我得到了错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-11-22a9f6312119> in <module>()
----> 1 model.train()
AttributeError: 'KeyedVectors' object has no attribute 'train'
我现在的问题是:
KeyedVectors 似乎没有训练功能,但我想继续在我个人的句子上训练向量,而不是仅仅使用维基百科向量。这怎么可能?
提前致谢,简
您不能为此使用 KeyedVectors。
来自 the documentation:
Word vector storage and similarity look-ups.
The word vectors are considered read-only in this class.
和also:
The word vectors can also be instantiated from an existing file on disk in the word2vec C format as a KeyedVectors instance.
[...]
NOTE: It is impossible to continue training the vectors loaded from the C format
because hidden weights, vocabulary frequency and the binary tree is
missing.
我从 here 下载了维基百科词向量。我加载了向量:
model_160 = KeyedVectors.load_word2vec_format(wiki_160_path, binary=False)
然后想训练他们:
model_160.train()
我得到了错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-11-22a9f6312119> in <module>()
----> 1 model.train()
AttributeError: 'KeyedVectors' object has no attribute 'train'
我现在的问题是: KeyedVectors 似乎没有训练功能,但我想继续在我个人的句子上训练向量,而不是仅仅使用维基百科向量。这怎么可能?
提前致谢,简
您不能为此使用 KeyedVectors。 来自 the documentation:
Word vector storage and similarity look-ups.
The word vectors are considered read-only in this class.
和also:
The word vectors can also be instantiated from an existing file on disk in the word2vec C format as a KeyedVectors instance.
[...]
NOTE: It is impossible to continue training the vectors loaded from the C format because hidden weights, vocabulary frequency and the binary tree is missing.