gensim doc2vec “intersect_word2vec_format” command

前端 未结 1 2012
耶瑟儿~
耶瑟儿~ 2021-01-22 12:48

Just reading through the doc2vec commands on the gensim page.

I am curious about the command\"intersect_word2vec_format\" .

My understanding of this command i

相关标签:
1条回答
  • 2021-01-22 13:05

    Yes, the intersect_word2vec_format() will let you bring vectors from an external file into a model that's already had its own vocabulary initialized (as if by build_vocab()). That is, it will only load those vectors for which there are already words in the local vocabulary.

    Additionally, it will by default lock those loaded vectors against any further adjustment during subsequent training, though other words in the pre-existing vocabulary may continue to update. (You can change this behavior by supplying a lockf=1.0 value instead of the default 0.0.)

    However, this is best considered an experimental function and what, if any, benefits it might offer will depend on lots of things specific to your setup.

    The PV-DBOW Doc2Vec mode, corresponding to the dm=0 parameter, is often a top-performer in speed and doc-vector quality, and doesn't use or train word-vectors at all – so any pre-loading of vectors won't have any effect.

    The PV-DM mode, enabled by the default dm=1 setting, trains any word-vectors it needs simultaneous with doc-vector training. (That is, there's no separate phase where word-vectors are created first, and thus for the same iter passes, PV-DM training takes the same amount of time whether word-vectors start with default random values, or are pre-loaded from elsewhere.) Pre-seeding the model with some word-vectors from elsewhere might help or hurt final quality – it's likely to depend on the specifics of your corpus, meta-parameters, and goals, and whether those external vectors represent word-meanings in sync with the current corpus/goal.

    0 讨论(0)
提交回复
热议问题