I was curious about last part of Lab that how can I create plot as It was created in upper part of code.

I want to create a plot as this:

but facing error like this:

Error: "ValueError Traceback (most recent call last)

in

3

4 # Visualize the fit

----> 5 visualize_fit(X_val_high, mu_high, var_high)

6

7 # Draw a red circle around those outliers

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

44

45 X1, X2 = np.meshgrid(np.arange(0, 35.5, 0.5), np.arange(0, 35.5, 0.5))

—> 46 Z = multivariate_gaussian(np.stack([X1.ravel(), X2.ravel()], axis=1), mu, var)

47 Z = Z.reshape(X1.shape)

48

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

30 var = np.diag(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))

ValueError: operands could not be broadcast together with shapes (5041,2) (11,) "

Can anyone help to solve this error. Thankyou

regards

Ahmad Fareed Khan