예제 #1
0
    def test_transform(self):
        ldamodule = LDA(solver='svd')
        self.assertIsNone(ldamodule.fit(self.data, self.labels))

        totransform = np.random.rand(100, 10)
        transformed = ldamodule.transform(totransform, 5)
        self.assertEqual(transformed.shape, (100, 5))
예제 #2
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)
예제 #3
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)
예제 #4
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)
예제 #5
0
파일: ldacomp.py 프로젝트: RicherMans/PLDA
 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])
예제 #6
0
 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])