コード例 #1
0
 def test_fitpredicteigen(self):
     ldamodule = LDA(solver='eigen')
     self.assertIsNone(ldamodule.fit(self.data, self.labels))
     testdata = np.random.rand(100, 10)
     # testlabels = np.array([i%10 for i in range(testdata.shape[0])])
     scores = ldamodule.predict_log_prob(testdata)
     for scoreset in scores:
         for score in scoreset:
             self.assertLessEqual(score, 0)
コード例 #2
0
class LDATest(unittest.TestCase):
    def setUp(self):
        self.ldamodule1 = LDA('svd')
        self.ldamodule2 = SKLDA()
        self.data = np.random.rand(10, 10)
        self.labels = np.array([1, 1, 1, 2, 2, 2, 3, 3, 3, 3])

    def test_fitpredict(self):
        np.set_printoptions(precision=4)
        self.ldamodule1.fit(self.data, self.labels)
        self.ldamodule2.fit(self.data, self.labels)
        testdata = np.random.rand(10, 10)
        # testlabels = np.array([i%10 for i in range(testdata.shape[0])])
        scores = self.ldamodule1.predict_log_prob(testdata)
コード例 #3
0
ファイル: ldacomp.py プロジェクト: RicherMans/PLDA
class LDATest(unittest.TestCase):

    def setUp(self):
        self.ldamodule1 = LDA('svd')
        self.ldamodule2 = SKLDA()
        self.data = np.random.rand(10, 10)
        self.labels = np.array([1, 1, 1, 2, 2, 2, 3, 3, 3, 3])

    def test_fitpredict(self):
        np.set_printoptions(precision=4)
        self.ldamodule1.fit(self.data, self.labels)
        self.ldamodule2.fit(self.data, self.labels)
        testdata = np.random.rand(10, 10)
        # testlabels = np.array([i%10 for i in range(testdata.shape[0])])
        scores = self.ldamodule1.predict_log_prob(testdata)