차라리 원래의 신체에 대한 래퍼로 Latent Semantic Indexing와 gensim 사용합니다 : : 오히려 fit_transform
를 사용하는 대신, 별도로 fit
및 transform
를 사용하는 경우 그것은 것을 명확하게 이해 할 수 bow-> tfidf-> LSI
tfidf = models.TfidfModel(corpus)
corpus_tfidf = tfidf[corpus]
lsi = models.LsiModel(corpus_tfidf, id2word=dictionary, num_topics=300)
corpus_lsi = lsi[corpus_tfidf] # create a double wrapper over the original corpus: bow->tfidf->fold-in-lsi
그럼 당신은 훈련을 계속해야하는 경우 :
new_tfidf = models.TfidfModel(corpus)
new_corpus_tfidf = new_tfidf[corpus]
lsi.add_documents(another_tfidf_corpus) # now LSI has been trained on corpus_tfidf + another_tfidf_corpus
lsi_vec = model[tfidf_vec] # convert some new document into the LSI space
코퍼스 가방 - 중 - 단어입니다
당신이 그들의 tutorials에서 읽을 수 있듯이 :
LSI 교육은 우리가 단순히 더 많은 교육 문서를 제공함으로써, 어느 시점에서 "교육"을 계속할 수 있다는 점에서 독특하다. 이는 온라인 교육이라는 프로세스에서 기본 모델에 대한 증분 업데이트로 수행됩니다. 이 기능 덕분에 입력 문서 스트림이 무한 할 수도 있습니다. 단, 도착한대로 LSI 새 문서를 계속 공급하면서 계산 된 변환 모델을 읽기 전용으로 사용하십시오!
sci-kit를 좋아한다면 gensim도 compatible with numpy
입니다.