Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mean = [0,0]
- cov = [[50,20],[80,15]]
- x1,x2 = np.random.multivariate_normal(mean,cov,100).T
- X = np.c_[x1,x2]
- plt.xlim(-30.0,30.0)
- plt.ylim(-30.0,30.0)
- plt.grid()
- plt.scatter(X[:,0],X[:,1])
- pca = PCA(n_components=1)
- pca.fit(X)
- axis /= axis.std()
- axis = pca.components_.T
- axis /= axis.std()
- x_axis, y_axis = axis
- plt.quiver(0, 0, x_axis, y_axis, zorder=11,width=0.01,scale=6, color='red')
- plt.savefig('pca')
- plt.show()
- mean = [0,0]
- cov = [[50,20],[80,15]]
- x1,x2 = np.random.multivariate_normal(mean,cov,100)
Add Comment
Please, Sign In to add comment