-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.py
53 lines (42 loc) · 1.26 KB
/
functions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import numpy as np
# defining the functions
# D_{f_i} -> R with D_{f_i} = [0, 1]x[0, 1]x ... x[0, 1] (times the dimensions)
mean = 0
std = 0.01
# monotonic increasing in x
def f1(x):
noise = np.random.normal(mean, std, x.shape)
return (x+1)**2 + noise
# monotonic decreasing in x
def f2(x):
noise = np.random.normal(mean, std, x.shape)
return -(x+1)**2 + noise
# monotonic increasing in x and y
def f3(x, y):
noise = np.random.normal(mean, std, x.shape)
return x+y + noise
# monotonic increasing in x and decreasing in y
def f4(x, y):
noise = np.random.normal(mean, std, x.shape)
return x-y + noise
# non-monotonic in x
def f5(x):
noise = np.random.normal(mean, std, x.shape)
return np.cos(x) + noise
# monotonic increasing in x and non-monotonic in y
def f6(x, y):
noise = np.random.normal(mean, std, x.shape)
#
return x**2 + y**2
# monotonic increasing in x, y and z
def f7(x, y):
noise = np.random.normal(mean, std, x.shape)
return x**3 + 0.5*np.sin(4*np.pi*y) + noise
# non-monotonic in x and y
def f8(x):
noise = np.random.normal(mean, std, x.shape)
return x**3 + x**2 + x + 1 # + noise
# non-monotonic in x and y
def f9(x, y):
noise = np.random.normal(mean, std, x.shape)
return x**2 - y**2