Ejemplo n.º 1
0
 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))
Ejemplo n.º 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)
Ejemplo n.º 3
0
 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))