Skip to content

Instantly share code, notes, and snippets.

@daniel-perry
Last active August 29, 2015 14:07
Show Gist options
  • Save daniel-perry/8001fd06a39a4ca20129 to your computer and use it in GitHub Desktop.
Save daniel-perry/8001fd06a39a4ca20129 to your computer and use it in GitHub Desktop.
# 30D gaussian data set with the following properties:
# anisotropic (covariance not scaled identity)
# non-axis aligned (rotated)
# non-centered (translated)
n = 300
d = 30
Sigma = eye(d)
Sigma[1,1] = 20
Sigma[10,10] = 25
Sigma[11,11] = 15
Sigma[19,19] = 10
Sigma[20,20] = 30
Sigma_decomp = chol(Sigma)
mu = ones(d,1)*10
X = (Sigma_decomp * randn(d,n))
# random rotation:
# since Q is an orthonormal matrix, it is a d-dimensional rotation matrix.
Q,R = qr(randn(d,d))
X = Q * X
X = (mu * ones(1,n)) .+ X
X = X' # expecting n x d matrix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment