Question on PCA

For the PCA lab, the last piece of code (below). It says this is the original data and the projection using axes as principal components. Shouldn’t it be the projection on the original axes? If we want to the projection on principal components, shouldn’t we be using plt.scatter(dataPCA[:, 0], np.zeros(nPoints)) instead?

===========
nPoints = len(data)

plt.scatter(data[:,0], data[:,1])

#Plot the projection along the first component in orange
plt.scatter(data[:,0], np.zeros(nPoints))

#Plot the projection along the second component in green
plt.scatter(np.zeros(nPoints), data[:,1])

plt.show()

1 Like

But note that here is the comment before that graph explaining what their intent is:

In the next figure, we can see the original data and its corresponding projection using dimenson axes as principal components. In other words, data comprised of a single variable.

So it is intended to be the original data and they are just projecting onto the x and y axes instead of the principal component eigenvectors. At least that’s my interpretation of what they are saying there.

3 Likes

My apologies, I misunderstood. Thank you for clarifying!

2 Likes