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))
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)
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))