(N=1)
| 52 | |
| 53 | |
| 54 | def 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 | |
| 76 | def test_radial_basis_kernel(N=1): |
nothing calls this directly
no test coverage detected