Why did we keep axis = 0?

Greetings, fellow learners it is requested to clarify that why did we keep axis 0 in this practice lab?

Hello @Talha1234

axis = 0, will find the mean of each row
axis = 1, will find the mean of each column

As an example: lets say we have 2 samples under a cluster. Each sample being a 3-D vector
sample 1: [x_1^{(1)}, x_2^{(1)}, x_3^{(1)}]
sample 2: [x_1^{(2)}, x_2^{(2)}, x_3^{(2)}]
To find the cluster centroid, we need to take the mean of each dimension by setting the option axis = 0
If we keep axis = 0, np.mean() will give us [\frac {x_1^{(1)} + x_1^{(2)}}{2}, \frac {x_2^{(1)} + x_2^{(2)}}{2}, \frac{x_3^{(1)} + x_3^{(2)}}{2}]
On the other hand, If we keep axis = 1, np.mean() will give us [\frac {x_1^{(1)} + x_2^{(1)} + x_3^{(1)} }{3}, \frac {x_1^{(2)} + x_2^{(2)} + x_3^{(2)} }{3}]