AI Coding · Amazon · Medium
Implement two functions that compute the arithmetic mean and the variance of a numerical array along a specified axis. The variance must support two conventions: dividing by the number of elements N (population variance) and dividing by N - 1 (sample variance). You may use only basic NumPy operations like sum, count_nonzero, and elementwise arithmetic; do not call np.mean or np.var. After coding the computation, provide a short written explanation that connects the formulas…