When i run this code, it throws a Wrong shape for mu. Expected: (3,) got: (2,)

mu = X_train.mean(axis=0)
var = (X_train.std(axis=0))**2

I am quite confused because X_train is a 2D array so i dont get it why the shape should be 3 instead of 2.
Could anyone help to explain why there is that shape error?
Thank you for your time!

when you implement this function you choose only the X_train (X_train.mean(axis=0)) but in function we send to the function parameter called X so yo convert all X_train in your code of function estimate_gaussian to X which is send you as parameter of function to make your code run generally on any test cases

please feel free to ask any questions,
Thanks,
Abdelrahman

1D, 2D, and 3D arrays should have shapes of (m, ), (m, n), (m, n, k) respectively. A 2D array has 2 axes, and so there are 2 numbers in its shape.

Please try to supply a simple 2D array of shape (2, 4) to your function and see if it works on your created array and gives you back arrays of shape (4, ).