It says the shape of my output is wrong but as far as I see, it is the exact shape as the Expected matrices. How come this is happening?
My labID is ypuamskm, btw.

Hey @Cossy,
Please note that the error statements only account for a limited number of cases. As you can see in your output, although the dimensions are as expected, but the values are completely different. This indicates, that your implementation is wrong. There are a couple of ways, in which you can get the expected shape of the output, but wrong values. The easiest way to debug is to print the shape of the output after every step, and this will help you resolve your error. If you are unable to resolve the error, feel free to DM me the code, and I will help you do the same. I hope this helps.

Hey @rmahajanam,
Welcome to the community. Can you please check your code for the step mean center the data? Please ensure that when you are taking the mean of X, you are taking it along the proper axis. Let us know if this helps.

Hey @rmahajanam,
If you have an active subscription, you can always open the assignment. If you are unable to do so despite having one, then please contact Coursera Help Centre.

The above code will compute the mean for the flattened array, whereas, you are supposed to find out the mean for each of the features. Please take a close look at the axis parameter of the numpy.mean() method.

Additionally, you are only supposed to mean center the data, i.e., reduce the mean of the data to 0. You are not supposed to make the standard deviation 1.

hi Elemento,
Thanks for your suggestions, I was able to access my submission. Changed the centering of the data to:
X_demeaned = (X - np.mean(X, axis=0))

however, I’m getting an error still. My thought is I haven’t selected the subset of the eigenvectors properly…here’s the code:

select the first n eigenvectors (n is desired dimension

# of rescaled data array, or dims_rescaled_data)
eigen_vecs_subset = np.transpose(np.matmul(eigen_vecs_sorted, X_demeaned))[:, :n_components]
print(eigen_vecs_subset.shape)
# 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.
X_reduced = np.transpose(np.dot(eigen_vecs_subset.T, X_demeaned.T))

Hey @rmahajanam,
For eigen_vecs_subset, you are supposed to select the first n eigenvectors only. There is no matrix multiplication involved in that. I hope this helps.