gensim 函数预测输出词
gensim function predict output words
我使用 gensim 库创建了一个 word2vec 模型。它包含函数predict_output_words()
,我理解如下:
例如,我有一个用句子训练的模型:"Anarchism does not offer a fixed body of doctrine from a single particular world view instead fluxing and flowing as a philosophy."
然后我用
model.predict_output_words(context_words_list=['Anarchism', 'does', 'not', 'offer', 'a', 'fixed', 'body', 'of', 'from', 'a', 'single', 'particular', 'world', 'view', 'instead', 'fluxing'], topn=10)
.
在这种情况下,我可以 get/predict 正确的单词还是省略的单词 'doctrine'?
这是正确的方法吗?请详细解释这个功能。
我想知道您是否看过 predict_output_word
的文档?
Report the probability distribution of the center word given the
context words as input to the trained model.
要回答您关于单词 'doctrine' 的具体问题 - 这在很大程度上取决于您列出的作为上下文的单词中最可能出现的 10 个单词之一是否是 'doctrine'。这意味着它必须在您用于训练模型的语料库中相对频繁地出现。此外,由于 'doctrine' 似乎不是最常用的词之一,因此其他词很有可能出现在上下文中。因此,如果您仅基于给定上下文的单词的返回概率,在这种情况下您可能最终无法预测 'doctrine'。
我使用 gensim 库创建了一个 word2vec 模型。它包含函数predict_output_words()
,我理解如下:
例如,我有一个用句子训练的模型:"Anarchism does not offer a fixed body of doctrine from a single particular world view instead fluxing and flowing as a philosophy."
然后我用
model.predict_output_words(context_words_list=['Anarchism', 'does', 'not', 'offer', 'a', 'fixed', 'body', 'of', 'from', 'a', 'single', 'particular', 'world', 'view', 'instead', 'fluxing'], topn=10)
.
在这种情况下,我可以 get/predict 正确的单词还是省略的单词 'doctrine'?
这是正确的方法吗?请详细解释这个功能。
我想知道您是否看过 predict_output_word
的文档?
Report the probability distribution of the center word given the context words as input to the trained model.
要回答您关于单词 'doctrine' 的具体问题 - 这在很大程度上取决于您列出的作为上下文的单词中最可能出现的 10 个单词之一是否是 'doctrine'。这意味着它必须在您用于训练模型的语料库中相对频繁地出现。此外,由于 'doctrine' 似乎不是最常用的词之一,因此其他词很有可能出现在上下文中。因此,如果您仅基于给定上下文的单词的返回概率,在这种情况下您可能最终无法预测 'doctrine'。