Reputation: 7404
I can generate a gaussian process with np.random.normal(0,1)
. This GP is uncorrelated. How can I generate a gaussian process with correlation?
Upvotes: 0
Views: 1030
Reputation: 97591
I think numpy.random.multivariate_normal(mu, cov)
does just what you need.
You can also generate it with:
assert cov.shape == (N, N)
assert mu.shape == (N,)
L = np.linalg.cholesky(cov)
process = mu + L.T @ np.random.normal(0,1,N)
but this will fail for singular covariance matrices
Remember that you can only generate samples from a Gaussian process, since a process has infinitely many values
Upvotes: 1