I have been for a while on the covariance_matrix_from_examples.

my issue seems to be with the assert evaluation section.

here is what I did. I am having a error flag but I am not able to figure out why it is not working.

```
examples_reshape = examples.reshape(2, examples.shape[0]*examples.shape[1], examples.shape[-1]//2)
return np.cov(examples_reshape[0], examples_reshape[1], rowvar= False)
```

I think youâ€™re making this way more complicated than it needs to be. Note that youâ€™ve given 3 distinct arguments to *reshape*. Whatâ€™s up with the 2 as the first dimension on the reshape? And the divide by 2 thing? Youâ€™re given a 3D array with â€śfeaturesâ€ť as the last dimension. All you need to do is preserve the â€śfeaturesâ€ť dimension and unroll the first two dimensions so that you end up with a 2D array with features as the second dimension. The easiest way is to use the -1 trick on *reshape* to say â€śUse whatever is left hereâ€ť for the first dimension.

1 Like

Got you! I was using a hammer to kill a fly. everything is ok now. Thank you!

Thatâ€™s a good analogy. And you missed the fly and hit your thumb instead.

Glad to hear you got it sorted out.