Exemplo n.º 1
0
 def test_precomputed_kernel(self):
     """Statistic Kernels"""
     d = np.random.randn(50, 50)
     nk = PrecomputedKernel(matrix=d)
     nk.compute()
     self.failUnless((d == nk._k).all(),
                     'Failure setting and retrieving PrecomputedKernel data')
Exemplo n.º 2
0
 def test_precomputed_kernel(self):
     """Statistic Kernels"""
     d = np.random.randn(50, 50)
     nk = PrecomputedKernel(matrix=d)
     nk.compute()
     self.failUnless(
         (d == nk._k).all(),
         'Failure setting and retrieving PrecomputedKernel data')
Exemplo n.º 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.failUnless(
                (nk._k.astype("float32") == sk.as_raw_np().astype("float32")).all(),
                "Failure converting arrays between NP as SG",
            )
Exemplo n.º 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.failUnless((nk._k.astype('float32') == \
                             sk.as_raw_np().astype('float32')).all(),
                            'Failure converting arrays between NP as SG')