MCPcopy Index your code
hub / github.com/ddbourgin/numpy-ml / test_polynomial_kernel

Function test_polynomial_kernel

numpy_ml/tests/test_utils.py:54–73  ·  view source on GitHub ↗
(N=1)

Source from the content-addressed store, hash-verified

52
53
54def test_polynomial_kernel(N=1):
55 np.random.seed(12345)
56 i = 0
57 while i < N:
58 N = np.random.randint(1, 100)
59 M = np.random.randint(1, 100)
60 C = np.random.randint(1, 1000)
61 gamma = np.random.rand()
62 d = np.random.randint(1, 5)
63 c0 = np.random.rand()
64
65 X = np.random.rand(N, C)
66 Y = np.random.rand(M, C)
67
68 mine = PolynomialKernel(gamma=gamma, d=d, c0=c0)(X, Y)
69 gold = sk_poly(X, Y, gamma=gamma, degree=d, coef0=c0)
70
71 np.testing.assert_almost_equal(mine, gold)
72 print("PASSED")
73 i += 1
74
75
76def test_radial_basis_kernel(N=1):

Callers

nothing calls this directly

Calls 1

PolynomialKernelClass · 0.90

Tested by

no test coverage detected