mercredi 11 novembre 2020

Efficient sampling from Gaussian

I'm trying to efficiently sample from a "high-dimensional" normal distribution with mean μm and covariance Σ. What I do know is that Σ = x^T x for some known vector x.
I can naively do it in numpy via something like:

Generate dummy inputs:

N = 10**2
m = np.ones(N)
x = np.ones(N)

Perform random sampling:

C = np.matmul(np.transpose(x),x)
A = np.random.multivariate_normal(m, C, 1).T

However, when N is extremly large, say 10^7 then this becomes infeasible to store x^Tx. Are there known tricks to sample in this case without having to compute and store x^Tx?




Aucun commentaire:

Enregistrer un commentaire