Exemple #1
0
 def test_precomputed_kernel(self):
     """Statistic Kernels"""
     d = np.random.randn(50, 50)
     nk = PrecomputedKernel(matrix=d)
     nk.compute()
     self.assertTrue((d == nk._k).all(),
                     'Failure setting and retrieving PrecomputedKernel data')
Exemple #2
0
 def test_precomputed_kernel(self):
     """Statistic Kernels"""
     d = np.random.randn(50, 50)
     nk = PrecomputedKernel(matrix=d)
     nk.compute()
     self.assertTrue((d == nk._k).all(),
                     'Failure setting and retrieving PrecomputedKernel data')
Exemple #3
0
        def test_sg_conversions(self):
            nk = PrecomputedKernel(matrix=np.random.randn(50, 50))
            nk.compute()

            skip_if_no_external('shogun',
                                ver_dep='shogun:rev', min_version=4455)
            sk = nk.as_sg()
            sk.compute()
            # CustomKernels interally store as float32 ??
            self.assertTrue((nk._k.astype('float32') == \
                             sk.as_raw_np().astype('float32')).all(),
                            'Failure converting arrays between NP as SG')
Exemple #4
0
        def test_sg_conversions(self):
            nk = PrecomputedKernel(matrix=np.random.randn(50, 50))
            nk.compute()

            skip_if_no_external('shogun',
                                ver_dep='shogun:rev', min_version=4455)
            sk = nk.as_sg()
            sk.compute()
            # CustomKernels interally store as float32 ??
            self.assertTrue((nk._k.astype('float32') == \
                             sk.as_raw_np().astype('float32')).all(),
                            'Failure converting arrays between NP as SG')