I’m having trouble accessing the notebook right now, but we could try though experiments until later.
broadcasting is a way that numpy attempts to repeat rows/columns of a matrix in order to be compatible doing numerical operations against a matrix of a different size. It was not able to do this for your particular data.
Here is a good article regarding this kind of issue.
If you still have an issue after reviewing this article, let’s chat more!
Is n_features a local variable in your covariance_from_examples function? If not, that would be a problem. In my solution, I just used the appropriate dimension of the input examples tensor as the number of features. Referencing global variables from the local scope of a function is never a good idea at least the way they structure things in these courses.
Update: I checked my version of this notebook and there is a global variable n_features which happens to have the value 40, whereas the test cases for this function have 4 features. Hmmm.