Compute_pca function passes only 4/6 tests

Hi team, I have followed the hints provided for this function, also tried to do the matrix multiplication by transposing. Still face errors in the numbers.
Screenshot 2023-07-21 at 23.37.59

Can someone please suggest something?

The plotted graph for words also looks reasonable.
Screenshot 2023-07-21 at 23.41.11

Hey @Harshita_Agarwala,
Welcome, and we are glad that you could become a part of our community :partying_face:

You have posted the discussion in the wrong category (Week 2). I have moved it to the correct category (Week 3) by using the little pencil icon next to the title.

Also, please check your DM.

Cheers,
Elemento

1 Like

Hey @Harshita_Agarwala,
The issue lies in the last step of your implementation of compute_pca. Please take a look at the comment carefully:

Transform the data by multiplying the transpose of the eigenvectors with the transpose of the de-meaned data. Then take the transpose of that product.

You are supposed to use the de-meaned data, i.e., X_demeaned, however, you have used X here. Additionally, please do take care of the transpose operations. You can print the shapes of the variables involved, and figure out where you should apply the transpose, and where not. I hope this helps.

Cheers,
Elemento

Thanks @Elemento! It works now :slight_smile: