我正在生成二元组from gensim.models.phrases
,我将在下游与 TF-IDF 和/或 gensim.LDA 一起使用
from gensim.models.phrases import Phrases, Phraser
# 7k documents, ~500-1k tokens each. Already ran cleanup, stop_words, lemmatization, etc
docs = get_docs()
phrases = Phrases(docs)
bigram = Phraser(phrases)
docs = [bigram[d] for d in docs]
Phrases
有min_count=5
, threshold=10
. 我不太明白它们是如何相互作用的,它们似乎相关?无论如何,我看到threshold
不同教程中的值范围为 1-> 1000,这对于确定生成的二元组数量很重要。我找不到关于如何为一个人的目的获得体面价值的解释,只是“小提琴和最适合你的东西”。是否有任何直觉/公式来选择这个值,可能是“如果你想在字典中添加 x% 更多的标记,请使用 y”;或者“如果你的语料库大小是 x,试试 y”?我也看到scoring='default'
可以设置为'npmi'
。从链接的文件中,他们说and t is a chosen threshold, typically around 10e−5
。如果我只是想让它“足够好”而不需要摆弄太多,这可能是一个不错的方法吗?那是,phrases = Phrases(docs, scoring='npmi', threshold=10e-5)
TL;DR:是否有一种简单或直观的方式来选择体面的threshold
(例如,基于语料库大小);或者会scoring='npmi',threshold=10e-5
更简单?