示例#1
0
文件: test_utils.py 项目: 52nlp/lda-1
 def test_lists_to_matrix_sparse(self):
     dtm = self.dtm_sparse
     WS, DS = utils.matrix_to_lists(dtm)
     dtm_new = utils.lists_to_matrix(WS, DS)
     self.assertTrue(np.all(dtm == dtm_new))
示例#2
0
 def subprocess(self, key):
   model = PyLDA(n_topics=20, n_iter=1)
   words, documents, wordsDict = self.normalize(key)
   matrix = lists_to_matrix(words, documents)
   model.fit_transform(matrix)
   return (model, documents, wordsDict)
示例#3
0
文件: test_utils.py 项目: nvdnkpr/lda
 def test_lists_to_matrix(self):
     dtm = self.dtm
     WS, DS = utils.matrix_to_lists(dtm)
     dtm_new = utils.lists_to_matrix(WS, DS)
     self.assertTrue(np.all(dtm == dtm_new))