# Problem with C1\_W3 ex.5 compute\_pca

**URL:** <https://community.deeplearning.ai/t/problem-with-c1-w3-ex-5-compute-pca/281775>\
**Category:** NLP with Classification and Vector Spaces\
**Tags:** week-module-3\
**Created:** [February 27, 2023, 11:55am UTC](https://community.deeplearning.ai/t/problem-with-c1-w3-ex-5-compute-pca/281775 "2023-02-27T11:55:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vballestra](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/vballestra/32/40161_2.png) [@vballestra](https://community.deeplearning.ai/u/vballestra)\
**Post date:** [February 27, 2023, 11:55am UTC](https://community.deeplearning.ai/t/problem-with-c1-w3-ex-5-compute-pca/281775/1 "2023-02-27T11:55:29Z")

</div>

The unit test case fails, and I can’t figure out what’s wrong with my code because it just look correct and also the final graph confirms it:

 ![image](https://global.discourse-cdn.com/dlai/original/3X/d/6/d6b6d8d48eb4ae5a2b0795c15a7532284e1ee324.png)

I’ve tried all the possibilities:

- also normalizing using std
- denormalizing the final result
- using different options with `np.linalg.eigh`.

Nothing seams to work.

Anyone having the same issue?

---

<div class="post-metadata">

**Author:** ![arvyzukai](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/arvyzukai/32/165165_2.png) [@arvyzukai](https://community.deeplearning.ai/u/arvyzukai)\
**Post date:** [February 27, 2023, 5:54pm UTC](https://community.deeplearning.ai/t/problem-with-c1-w3-ex-5-compute-pca/281775/2 "2023-02-27T17:54:09Z")

</div>

Hi @vballestra

Could you provide more information which and how the test case fails?

---

<div class="post-metadata">

**Author:** ![vballestra](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/vballestra/32/40161_2.png) [@vballestra](https://community.deeplearning.ai/u/vballestra)\
**Post date:** [February 28, 2023, 3:41pm UTC](https://community.deeplearning.ai/t/problem-with-c1-w3-ex-5-compute-pca/281775/3 "2023-02-28T15:41:25Z")

</div>

Yeah, I figure I can’t post my solution, so I don’t know what else I can provide but here’s the issue:

 ![image](https://global.discourse-cdn.com/dlai/original/3X/4/e/4ef04f51d208a8db5c7acd465f3bca71c7f87e49.png)

It looks like I’m not computing it correctly but I’m quite sure it is correct in fact the final picture looks fine, as you can see.

Also, notice that the error message is wrong: the shape is correct but the values do not match with the expected.

---

<div class="post-metadata">

**Author:** ![arvyzukai](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/arvyzukai/32/165165_2.png) [@arvyzukai](https://community.deeplearning.ai/u/arvyzukai)\
**Post date:** [March 1, 2023, 7:04am UTC](https://community.deeplearning.ai/t/problem-with-c1-w3-ex-5-compute-pca/281775/4 "2023-03-01T07:04:07Z")

</div>

Could you private message me your Assignment notebook? It’s hard to predict where your mistake is. It’s clear that it is not the number of dimensions but the values are not correct.

---

<div class="post-metadata">

**Author:** ![arvyzukai](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/arvyzukai/32/165165_2.png) [@arvyzukai](https://community.deeplearning.ai/u/arvyzukai)\
**Post date:** [March 1, 2023, 8:04am UTC](https://community.deeplearning.ai/t/problem-with-c1-w3-ex-5-compute-pca/281775/5 "2023-03-01T08:04:24Z")

</div>

For future readers:

If you get the same values - please check the dimension over which you de-mean the data (use Hint 1).
