Beispiel #1
0
 def test_train_2d(self):
     N = 20
     x = 2 * np.pi * np.random.random_sample((N, 2))
     y = func_2d(x)
     for kernel in kernels_dict.values():
         k = kernel(30)
         for tail in tails_dict.values():
             t = tail()
             if t.degree >= k.dmin:
                 model = RBF(k, t)
                 model.train(x, y, method="Bounded", bounds=[1e-5, 20])
                 assert model._kernel.param >= 1e-5
                 assert model._kernel.param <= 20
                 assert model._is_fitted()
Beispiel #2
0
 def test_train_1d(self):
     N = 8
     x = np.linspace(0, 2 * np.pi, num=N)
     y = func_1d(x)
     for kernel in kernels_dict.values():
         k = kernel(30)
         for tail in tails_dict.values():
             t = tail()
             if t.degree >= k.dmin:
                 model = RBF(k, t)
                 model.train(x, y, method="Bounded", bounds=[1e-5, 20])
                 assert model._kernel.param >= 1e-5
                 assert model._kernel.param <= 20
                 assert model._is_fitted()