Created
May 2, 2022 12:34
-
-
Save VuongNM/085b256f41e1241ad7032662fb9cc421 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy import stats | |
import seaborn as sns | |
dims = [1,10,100,500] | |
plt.figure(figsize=(10,5),dpi=500) | |
for d in dims: | |
cov = np.eye(d) | |
n = np.random.multivariate_normal(mean=np.zeros((d,)),cov=cov,size=10000) | |
dist = np.linalg.norm(n,axis=1) | |
sns.kdeplot(dist,fill=True,label='dims={}'.format(d)) | |
plt.xlim([0,30]) | |
plt.legend() | |
plt.title("Distance of points from multivariate normal to the Origin") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment