# C2W1 frechet distance, #UNQ\_C2

**URL:** <https://community.deeplearning.ai/t/c2w1-frechet-distance-unq-c2/410597>\
**Category:** Build Better Generative Adversarial Networks\
**Tags:** week-module-1\
**Created:** [August 7, 2023, 9:37am UTC](https://community.deeplearning.ai/t/c2w1-frechet-distance-unq-c2/410597 "2023-08-07T09:37:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![g\_alzorriz](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@g\_alzorriz](https://community.deeplearning.ai/u/g_alzorriz)\
**Post date:** [August 7, 2023, 9:37am UTC](https://community.deeplearning.ai/t/c2w1-frechet-distance-unq-c2/410597/1 "2023-08-07T09:37:53Z")

</div>

Hi, I’m trying to implement the code for the frechet distance function but when I test it, it says AssertionError.

The code I wrote is this:

_{moderator edit - solution code removed}_

Does anybody know where’s the error?

---

<div class="post-metadata">

**Author:** ![Dmitriy\_Khvan](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@Dmitriy\_Khvan](https://community.deeplearning.ai/u/Dmitriy_Khvan)\
**Post date:** [August 7, 2023, 10:05am UTC](https://community.deeplearning.ai/t/c2w1-frechet-distance-unq-c2/410597/2 "2023-08-07T10:05:30Z")

</div>

Hi, @g_alzorriz.

It looks like you’re missing couple things in your formula.  
Firstly, the norm of the mean difference must be squared. Secondly, you’re missing coefficient 2 in front of matrix\_sqrt(sigma\_x @ sigma\_y)). Please refer to the equation above UNQ\_C2. Please tag me if you’re still unable to complete the cell.

---

<div class="post-metadata">

**Author:** ![g\_alzorriz](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@g\_alzorriz](https://community.deeplearning.ai/u/g_alzorriz)\
**Post date:** [August 7, 2023, 10:18am UTC](https://community.deeplearning.ai/t/c2w1-frechet-distance-unq-c2/410597/3 "2023-08-07T10:18:19Z")

</div>

solved! Thank you 🙂

---

<div class="post-metadata">

**Author:** ![Andy\_Davidson](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Andy\_Davidson](https://community.deeplearning.ai/u/Andy_Davidson)\
**Post date:** [July 9, 2024, 12:34am UTC](https://community.deeplearning.ai/t/c2w1-frechet-distance-unq-c2/410597/4 "2024-07-09T00:34:47Z")

</div>

many thanks I thought the “2” ment euclidian distance
