Did you ever get a response from them? Im hitting the same thing. 4 tests passing and 2 test failed.
This assignment and specifically the PCA part needs more attention.
Edit:
As is always the case I don’t find my issue until I actually make a post about it. But while I understand the mistake I made - the hint for mean was wrong.
I had the same issue as most of you and after a long debugging have found my mistake which perhaps is the same for some of you.
According to the way that you implement the eig.vectors sorting, it is possible that your row/col. are inverted and you have to apply a transpose to it.
I faced the same issue as well: 4 tests passed, but 2 failed! However, after playing with my code and debugging for a while, I could solve the problem. I would strongly recommend to pay attention to the “axis” value in np.mean() and the value of “rowvar” in np.cov() functions.
In addition, you do not necessarily need to transpose the matrices at the end. Note that X_demeaned is of size [n_observations, n_features], while eigen_vecs_subset is a matrix of size [n_features, n_components], and finally you need X_reduced to be of size [n_observations, n_components], so you could easily multiply X_demeaned by eigen_vecs_subset to obtain an output of the desired shape.
Make sure that when you call the eigen_vecs_sorted you use two colons when refering to your x and y values. The last colon seemed to have thrown everyone off when using the n_components value
One additional thing to consider - in the lectures we’re told to normalize the data. In the assignment, we are only asked to mean center the data (so no division by standard deviation). I actually got stucked here, as I went straight to the normalized data. So if you got 4 out of 6, please check the data preparation as well.
I just passed all the tests. It seems to me that this statement in the lab is incorrect!
# transform the data by multiplying the transpose of the eigenvectors with the transpose of the de-meaned data
# Then take the transpose of that product.
I experimented a lot with transposing the vectors, but ultimately the tests passed with untransposed vectors.
After reading carefully through the hints, which were not too clear given the incorrect default parameters that were posted for the mean and covariance calls, I had to set the np.mean axis parameter to 0 and the np.cov rowvar parameter to False. Then I was able to follow the instructions as given, and passed the unit tests