MCPcopy
hub / github.com/GPflow/GPflow / generate_data

Function generate_data

doc/sphinx/notebooks/tailor/external-mean-function.pct.py:48–63  ·  view source on GitHub ↗

For each function, sample the value at `N` equally spaced points in the [−5, 5] interval (Fortuin and Rätsch, 2019). Returns: Tuple of np.arrays of size (N, 1) and (N, num_functions).

(num_functions=10, N=500)

Source from the content-addressed store, hash-verified

46
47# %%
48def generate_data(num_functions=10, N=500):
49 """
50 For each function, sample the value at `N` equally spaced
51 points in the [−5, 5] interval (Fortuin and Rätsch, 2019).
52
53 Returns:
54 Tuple of np.arrays of size (N, 1) and (N, num_functions).
55 """
56 jitter = 1e-6
57 Xs = np.linspace(-5.0, 5.0, N)[:, None]
58 kernel = RBF(lengthscales=1.0)
59 cov = kernel(Xs)
60 L = np.linalg.cholesky(cov + np.eye(N) * jitter)
61 epsilon = np.random.randn(N, num_functions)
62 F = np.sin(Xs) + np.matmul(L, epsilon)
63 return Xs, F
64
65
66# %% [markdown]

Calls 1

kernelFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…