Skip to content

Commit

Permalink
update requirements and numpy math api
Browse files Browse the repository at this point in the history
  • Loading branch information
William Wilkinson authored and William Wilkinson committed Dec 14, 2023
1 parent e9d6970 commit b899eed
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions demos/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions demos/positive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions demos/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_)

Expand Down
2 changes: 1 addition & 1 deletion demos/studentt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_)


Expand Down
2 changes: 1 addition & 1 deletion experiments/binary/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ numba
numpy
matplotlib
scipy
sklearn
pandas
scikit-learn
pandas
tensorflow_probability
2 changes: 1 addition & 1 deletion tests/normaliser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_gp_vs_markovgp_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gp_vs_markovgp_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sparsemarkov.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vs_exact_marg_lik.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vs_gpflow_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vs_gpflow_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit b899eed

Please sign in to comment.