Skip to content

Commit

Permalink
Merge pull request #688 from ajdapretnar/lda-random-state
Browse files Browse the repository at this point in the history
LDA: Add random state
  • Loading branch information
lanzagar authored Jul 21, 2021
2 parents 3fdb5e0 + 7c74a18 commit eddfa45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions orangecontrib/text/tests/test_topic_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ def test_fit_transform(self):
self.assertEqual(corpus.X.shape, (len(self.corpus), 5))
self.assertEqual(corpus.X.dtype, np.float64)

def test_random_seed(self):
corpus1 = self.model.fit_transform(self.corpus)
corpus2 = self.model.fit_transform(self.corpus)
np.testing.assert_array_equal(corpus1.X, corpus2.X)


class HdpTest(unittest.TestCase, BaseTests):
def setUp(self):
Expand Down
2 changes: 1 addition & 1 deletion orangecontrib/text/topics/lda.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ class LdaWrapper(GensimWrapper):
Model = models.LdaModel

def __init__(self, **kwargs):
super().__init__(**kwargs, dtype=float64)
super().__init__(random_state=0, **kwargs, dtype=float64)

0 comments on commit eddfa45

Please sign in to comment.