# Wrong values of X\_reduced / compute\_pca implementation issue

**URL:** <https://community.deeplearning.ai/t/wrong-values-of-x-reduced-compute-pca-implementation-issue/498629>\
**Category:** NLP with Classification and Vector Spaces\
**Tags:** week-module-3\
**Created:** [November 19, 2023, 4:14pm UTC](https://community.deeplearning.ai/t/wrong-values-of-x-reduced-compute-pca-implementation-issue/498629 "2023-11-19T16:14:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rishav\_Kumar\_Paramh1](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@Rishav\_Kumar\_Paramh1](https://community.deeplearning.ai/u/Rishav_Kumar_Paramh1)\
**Post date:** [November 19, 2023, 4:14pm UTC](https://community.deeplearning.ai/t/wrong-values-of-x-reduced-compute-pca-implementation-issue/498629/1 "2023-11-19T16:14:13Z")

</div>

_{moderator edit - solution code removed}_

With this code, I get correct dimentionality of the X\_reduced, but incoorect values

Output  
Your original matrix was (3, 10) and it became:  
[[-0.43361498 -0.40920865]  
[0.03306764 -0.1293703]  
[-0.39103889 -0.3999264]]

I dont understand, if there is any fundamental mistake in my implementation of PCA? Can someone help? Thanks in advance

---

<div class="post-metadata">

**Author:** ![paulinpaloalto](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/paulinpaloalto/32/187_2.png) [@paulinpaloalto](https://community.deeplearning.ai/u/paulinpaloalto)\
**Post date:** [November 19, 2023, 5:04pm UTC](https://community.deeplearning.ai/t/wrong-values-of-x-reduced-compute-pca-implementation-issue/498629/2 "2023-11-19T17:04:27Z")

</div>

Notice in the very last comment, they are specific that you should be using the “demeaned” data, but that is not what you used.
