def testIsPolynomial(self): # Linear kernel is subclass of Polynomial kernel self.assertIsInstance(tfpk.Linear(), tfpk.Polynomial)
def testValuesAreCorrect(self): k = tfpk.Linear() x = np.random.uniform(-1, 1, size=[5, 3]).astype(np.float32) y = np.random.uniform(-1, 1, size=[4, 3]).astype(np.float32) self.assertAllClose(x.dot(y.T), self.evaluate(k.matrix(x, y)))
def testIsPolynomial(self): # Linear kernel is subclass of Polynomial kernel self.assertIsInstance(psd_kernels.Linear(), psd_kernels.Polynomial)