diff --git a/demos/classification.py b/demos/classification.py index bc37716..4501b62 100644 --- a/demos/classification.py +++ b/demos/classification.py @@ -14,11 +14,11 @@ x = np.concatenate([x0, np.array([50]), x1], axis=0) # x = np.linspace(np.min(x), np.max(x), N) f = lambda x_: 6 * np.sin(np.pi * x_ / 10.0) / (np.pi * x_ / 10.0 + 1) -y_ = f(x) + np.math.sqrt(0.05)*np.random.randn(x.shape[0]) +y_ = f(x) + np.sqrt(0.05)*np.random.randn(x.shape[0]) y = np.sign(y_) y[y == -1] = 0 x_test = np.linspace(np.min(x)-5.0, np.max(x)+5.0, num=500) -y_test = np.sign(f(x_test) + np.math.sqrt(0.05)*np.random.randn(x_test.shape[0])) +y_test = np.sign(f(x_test) + np.sqrt(0.05)*np.random.randn(x_test.shape[0])) y_test[y_test == -1] = 0 x_plot = np.linspace(np.min(x)-10.0, np.max(x)+10.0, num=500) z = np.linspace(min(x), max(x), num=M) diff --git a/demos/positive.py b/demos/positive.py index 8b51093..479b02e 100644 --- a/demos/positive.py +++ b/demos/positive.py @@ -19,9 +19,9 @@ def wiggly_time_series(x_): # x = np.linspace(np.min(x), np.max(x), N) # f = lambda x_: 3 * np.sin(np.pi * x_ / 10.0) f = wiggly_time_series -y = nonlinearity(f(x)) + np.math.sqrt(0.1)*np.random.randn(x.shape[0]) +y = nonlinearity(f(x)) + np.sqrt(0.1)*np.random.randn(x.shape[0]) x_test = np.linspace(np.min(x), np.max(x), num=500) -y_test = nonlinearity(f(x_test)) + np.math.sqrt(0.05)*np.random.randn(x_test.shape[0]) +y_test = nonlinearity(f(x_test)) + np.sqrt(0.05)*np.random.randn(x_test.shape[0]) x_plot = np.linspace(np.min(x)-10.0, np.max(x)+10.0, num=500) M = 20 diff --git a/demos/regression.py b/demos/regression.py index 30b5cd0..e9fbf54 100644 --- a/demos/regression.py +++ b/demos/regression.py @@ -9,8 +9,8 @@ def wiggly_time_series(x_): noise_var = 0.2 # true observation noise # return 0.25 * (np.cos(0.04*x_+0.33*np.pi) * np.sin(0.2*x_) + return (np.cos(0.04*x_+0.33*np.pi) * np.sin(0.2*x_) + - np.math.sqrt(noise_var) * np.random.normal(0, 1, x_.shape) + - # np.math.sqrt(noise_var) * np.random.uniform(-4, 4, x_.shape) + + np.sqrt(noise_var) * np.random.normal(0, 1, x_.shape) + + # np.sqrt(noise_var) * np.random.uniform(-4, 4, x_.shape) + 0.0 * x_) # 0.02 * x_) # 0.0 * x_) + 2.5 # 0.02 * x_) diff --git a/demos/studentt.py b/demos/studentt.py index a4042ee..ef444cb 100644 --- a/demos/studentt.py +++ b/demos/studentt.py @@ -9,7 +9,7 @@ def wiggly_time_series(x_): noise_var = 0.2 # true observation noise scale return (np.cos(0.04*x_+0.33*np.pi) * np.sin(0.2*x_) + - np.math.sqrt(noise_var) * np.random.standard_t(3., x_.shape) + + np.sqrt(noise_var) * np.random.standard_t(3., x_.shape) + 0.0 * x_) diff --git a/experiments/binary/binary.py b/experiments/binary/binary.py index 2b5669c..58aede7 100644 --- a/experiments/binary/binary.py +++ b/experiments/binary/binary.py @@ -11,7 +11,7 @@ x = np.sort(70 * np.random.rand(N)) sn = 0.01 f = lambda x_: 12. * np.sin(4 * np.pi * x_) / (0.25 * np.pi * x_ + 1) -y_ = f(x) + np.math.sqrt(sn)*np.random.randn(x.shape[0]) +y_ = f(x) + np.sqrt(sn)*np.random.randn(x.shape[0]) y = np.sign(y_) y[y == -1] = 0 diff --git a/requirements.txt b/requirements.txt index 3129d1a..f3686f4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,6 @@ numba numpy matplotlib scipy -sklearn -pandas \ No newline at end of file +scikit-learn +pandas +tensorflow_probability \ No newline at end of file diff --git a/tests/normaliser_test.py b/tests/normaliser_test.py index a21c3d5..9c9f1fd 100644 --- a/tests/normaliser_test.py +++ b/tests/normaliser_test.py @@ -13,7 +13,7 @@ def wiggly_time_series(x_): noise_var = 0.15 # true observation noise return (np.cos(0.04*x_+0.33*np.pi) * np.sin(0.2*x_) + - np.math.sqrt(noise_var) * np.random.normal(0, 1, x_.shape) + + np.sqrt(noise_var) * np.random.normal(0, 1, x_.shape) + 0.0 * x_) # 0.02 * x_) diff --git a/tests/test_gp_vs_markovgp_class.py b/tests/test_gp_vs_markovgp_class.py index bbfc6c0..3d6365d 100644 --- a/tests/test_gp_vs_markovgp_class.py +++ b/tests/test_gp_vs_markovgp_class.py @@ -11,7 +11,7 @@ def build_data(N): x = 100 * np.random.rand(N) x = np.sort(x) # since MarkovGP sorts the inputs, they must also be sorted for GP f = lambda x_: 6 * np.sin(np.pi * x_ / 10.0) / (np.pi * x_ / 10.0 + 1) - y_ = f(x) + np.math.sqrt(0.05) * np.random.randn(x.shape[0]) + y_ = f(x) + np.sqrt(0.05) * np.random.randn(x.shape[0]) y = np.sign(y_) y[y == -1] = 0 x = x[:, None] diff --git a/tests/test_gp_vs_markovgp_reg.py b/tests/test_gp_vs_markovgp_reg.py index cf1999f..5fb65db 100644 --- a/tests/test_gp_vs_markovgp_reg.py +++ b/tests/test_gp_vs_markovgp_reg.py @@ -9,7 +9,7 @@ def wiggly_time_series(x_): noise_var = 0.15 # true observation noise return (np.cos(0.04*x_+0.33*np.pi) * np.sin(0.2*x_) + - np.math.sqrt(noise_var) * np.random.normal(0, 1, x_.shape)) + np.sqrt(noise_var) * np.random.normal(0, 1, x_.shape)) def build_data(N): diff --git a/tests/test_sparsemarkov.py b/tests/test_sparsemarkov.py index d55ba7b..91c199b 100644 --- a/tests/test_sparsemarkov.py +++ b/tests/test_sparsemarkov.py @@ -12,7 +12,7 @@ def wiggly_time_series(x_): noise_var = 0.15 # true observation noise return (np.cos(0.04*x_+0.33*np.pi) * np.sin(0.2*x_) + - np.math.sqrt(noise_var) * np.random.normal(0, 1, x_.shape)) + np.sqrt(noise_var) * np.random.normal(0, 1, x_.shape)) def build_data(N): diff --git a/tests/test_vs_exact_marg_lik.py b/tests/test_vs_exact_marg_lik.py index 10b1e5e..e0b5965 100644 --- a/tests/test_vs_exact_marg_lik.py +++ b/tests/test_vs_exact_marg_lik.py @@ -9,7 +9,7 @@ def wiggly_time_series(x_): noise_var = 0.15 # true observation noise return (np.cos(0.04*x_+0.33*np.pi) * np.sin(0.2*x_) + - np.math.sqrt(noise_var) * np.random.normal(0, 1, x_.shape)) + np.sqrt(noise_var) * np.random.normal(0, 1, x_.shape)) def build_data(N): diff --git a/tests/test_vs_gpflow_class.py b/tests/test_vs_gpflow_class.py index 391b475..44f5d82 100644 --- a/tests/test_vs_gpflow_class.py +++ b/tests/test_vs_gpflow_class.py @@ -15,7 +15,7 @@ def build_data(N): # np.random.seed(12345) x = 100 * np.random.rand(N) f = lambda x_: 6 * np.sin(np.pi * x_ / 10.0) / (np.pi * x_ / 10.0 + 1) - y_ = f(x) + np.math.sqrt(0.05) * np.random.randn(x.shape[0]) + y_ = f(x) + np.sqrt(0.05) * np.random.randn(x.shape[0]) y = np.sign(y_) y[y == -1] = 0 x = x[:, None] diff --git a/tests/test_vs_gpflow_reg.py b/tests/test_vs_gpflow_reg.py index 4be2d58..635a225 100644 --- a/tests/test_vs_gpflow_reg.py +++ b/tests/test_vs_gpflow_reg.py @@ -12,7 +12,7 @@ def wiggly_time_series(x_): noise_var = 0.15 # true observation noise return (np.cos(0.04*x_+0.33*np.pi) * np.sin(0.2*x_) + - np.math.sqrt(noise_var) * np.random.normal(0, 1, x_.shape)) + np.sqrt(noise_var) * np.random.normal(0, 1, x_.shape)) def build_data(N):