훈련 :주제 distristribution 나는 이런 식으로 뭔가의 할당이 countvectorizer
import gensim
from sklearn.feature_extraction.text import CountVectorizer
newsgroup_data = ["Human machine interface for lab abc computer applications",
"A survey of user opinion of computer system response time",
"The EPS user interface management system",
"System and human system engineering testing of EPS",
"Relation of user perceived response time to error measurement",
"The generation of random binary unordered trees",
"The intersection graph of paths in trees",
"Graph minors IV Widths of trees and well quasi ordering",
"Graph minors A survey"]
vect = CountVectorizer(stop_words='english',
token_pattern='(?u)\\b\\w\\w\\w+\\b')
X = vect.fit_transform(newsgroup_data)
corpus = gensim.matutils.Sparse2Corpus(X, documents_columns=False)
id_map = dict((v, k) for k, v in vect.vocabulary_.items())
내 작업은 코퍼스에 LDA 모델 매개 변수를 추정 10 개 항목의 목록과 가장 중요한을 찾을 수 있습니다 각 주제의 10 단어는 다음과 같습니다.
top10 = ldamodel.print_topics(num_topics=10, num_words=10)
ldamodel = gensim.models.ldamodel.LdaModel(corpus=corpus,
id2word=id_map, num_topics=10, minimum_probability=0)
자동 기록기가 정상적으로 전달됩니다.
이new_doc = ["\n\nIt's my understanding that the freezing will start to occur because \
of the\ngrowing distance of Pluto and Charon from the Sun, due to it's\nelliptical orbit. \
It is not due to shadowing effects. \n\n\nPluto can shadow Charon, and vice-versa.\n\nGeorge \
Krumins\n-- "]
newX = vect.transform(new_doc)
newC = gensim.matutils.Sparse2Corpus(newX, documents_columns=False)
print(ldamodel.get_document_topics(newC))
이 그러나 단순히
gensim.interfaces.TransformedCorpus
나는 또한 문서 문에서 참조를 반환 : 다음 작업은 다음과 같이 내가하려고 새로운 문서의 주제 분포를 찾을 수 있습니다 : "그런 다음 >>> doc_lda = lda [doc_bow]를 사용하여 보이지 않는 새 문서에 대한 주제 분포를 추측 할 수 있지만 여기에도 성공하지 못했습니다. 어떤 도움을 주셔서 감사합니다.