Hi,

I get below LinAlgError in Section 2.3.1 of anomaly detection lab. The test that checks mean, variance passed. But I get below error in multivariate_gaussian

# Returns the density of the multivariate normal

# at each data point (row) of X_train

p = multivariate_gaussian(X_train, mu, var)

LinAlgError Traceback (most recent call last)

in

1 # Returns the density of the multivariate normal

2 # at each data point (row) of X_train

----> 3 p = multivariate_gaussian(X_train, mu, var)

4

5 #Plotting code

~/work/utils.py in multivariate_gaussian(X, mu, var)

31

32 X = X - mu

—> 33 p = (2* np.pi)**(-k/2) * np.linalg.det(var)**(-0.5) *

34 np.exp(-0.5 * np.sum(np.matmul(X, np.linalg.pinv(var)) * X, axis=1))

35

<**array_function** internals> in det(*args, **kwargs)

/opt/conda/lib/python3.7/site-packages/numpy/linalg/linalg.py in det(a)

2111 a = asarray(a)

2112 _assert_stacked_2d(a)

→ 2113 _assert_stacked_square(a)

2114 t, result_t = _commonType(a)

2115 signature = ‘D->D’ if isComplexType(t) else ‘d->d’

/opt/conda/lib/python3.7/site-packages/numpy/linalg/linalg.py in _assert_stacked_square(*arrays)

211 m, n = a.shape[-2:]

212 if m != n:

→ 213 raise LinAlgError(‘Last 2 dimensions of the array must be square’)

214

215 def _assert_finite(*arrays):

LinAlgError: Last 2 dimensions of the array must be square