Script to test if functions are kernels, by Lilian Besson (C) 2016 MIT Licensed (http://lbesson.mit-license.org) Using N = 1000, T = 5. For test domains: - IR ~= [-300.0, 300.0], - IR+ ~= [ 0, 300.0], - IN ~= [ 0, 1000], - IN ~= [ 0, 30] (small to reduce overflow), Tolerance for small real values = 1e-12. Tolerance for success rates = 0.01. And sampling the a_i from uniform in [-50.0, 50.0]. Starting to test 14 kernels... - Testing the kernel abs_k K(x, y) = < x, y > = x * y : It has domain = REAL. Results of the N = 1000 tests: - Tested for positiveness : success rate 100.00%. - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel abs_k... - Testing the kernel one_by_k K(x, y) = 1 / (1 - x * y) : It has domain = MONEONE. Results of the N = 1000 tests: - Tested for positiveness : success rate 100.00%. - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel one_by_k... - Testing the kernel power_two_dot_k K(x, y) = 2 ** (x + y) : It has domain = SMALLINT. Results of the N = 1000 tests: - Tested for positiveness : success rate 100.00%. - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel power_two_dot_k... - Testing the kernel power_two_sum_k K(x, y) = 2 ** (x * y) : It has domain = SMALLINT. Results of the N = 1000 tests: - Tested for positiveness : success rate 100.00%. - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel power_two_sum_k... - Testing the kernel log_k K(x, y) = log(1 + x * y) : It has domain = REALPLUS. Results of the N = 1000 tests: - Tested for positiveness : success rate 96.50%. ===> I guess this kernel log_k K(x, y) = log(1 + x * y) is NOT a positive definite kernel ! - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel log_k... - Testing the kernel exp_k K(x, y) = exp(-(x-y)^2) : It has domain = REAL. Results of the N = 1000 tests: - Tested for positiveness : success rate 100.00%. - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel exp_k... - Testing the kernel cos_plus_k K(x, y) = cos(x + y) : It has domain = REAL. Results of the N = 1000 tests: - Tested for positiveness : success rate 46.60%. ===> I guess this kernel cos_plus_k K(x, y) = cos(x + y) is NOT a positive definite kernel ! - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel cos_plus_k... - Testing the kernel cos_minus_k K(x, y) = cos(x - y) : It has domain = REAL. Results of the N = 1000 tests: - Tested for positiveness : success rate 100.00%. - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel cos_minus_k... - Testing the kernel min_k K(x, y) = min(x, y) : It has domain = REALPLUS. Results of the N = 1000 tests: - Tested for positiveness : success rate 100.00%. - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel min_k... - Testing the kernel max_k K(x, y) = max(x, y) : It has domain = REALPLUS. Results of the N = 1000 tests: - Tested for positiveness : success rate 78.60%. ===> I guess this kernel max_k K(x, y) = max(x, y) is NOT a positive definite kernel ! - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel max_k... - Testing the kernel min_by_max_k K(x, y) = min(x, y) / max(x, y) : It has domain = REALPLUS. Results of the N = 1000 tests: - Tested for positiveness : success rate 100.00%. - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel min_by_max_k... - Testing the kernel gcd_k K(x, y) = gcd(x, y) : It has domain = INTEGER. Results of the N = 1000 tests: - Tested for positiveness : success rate 100.00%. - Tested for definiteness : success rate 100.00%. - Tested for symmetry : success rate 100.00%. Finished for the kernel gcd_k... - Testing the kernel lcm_k K(x, y) = lcm(x, y) : It has domain = INTEGER. Results of the N = 1000 tests: - Tested for positiveness : success rate 58.80%. ===> I guess this kernel lcm_k K(x, y) = lcm(x, y) is NOT a positive definite kernel ! - Tested for definiteness : success rate 99.95%. - Tested for symmetry : success rate 100.00%. Finished for the kernel lcm_k... - Testing the kernel gcd_by_lcm_k K(x, y) = gcd(x, y) / lcm(x, y) : It has domain = INTEGER. Results of the N = 1000 tests: - Tested for positiveness : success rate 100.00%. - Tested for definiteness : success rate 99.95%. - Tested for symmetry : success rate 100.00%. Finished for the kernel gcd_by_lcm_k... Done testing some kernels... - Apparently, the kernel log_k K(x, y) = log(1 + x * y) is NOT a positive definite kernel : because positivenesswas only observed with probability 96.50%. - Apparently, the kernel cos_plus_k K(x, y) = cos(x + y) is NOT a positive definite kernel : because positivenesswas only observed with probability 46.60%. - Apparently, the kernel max_k K(x, y) = max(x, y) is NOT a positive definite kernel : because positivenesswas only observed with probability 78.60%. - Apparently, the kernel lcm_k K(x, y) = lcm(x, y) is NOT a positive definite kernel : because positivenesswas only observed with probability 58.80%. - All the other kernel appeared to be positive definite. Now prove it. Finished for this script 'test_kernel.py'.