Some additional explanation for multi feature Anomaly Detection would be great

Hello,

It is difficult to understand the function def multivariate_gaussian(X, mu, var):

    p = (2* np.pi)**(-k/2) * np.linalg.det(var)**(-0.5) * \
        np.exp(-0.5 * np.sum(np.matmul(X, np.linalg.pinv(var)) * X, axis=1))

I would like to understand, how it works. It does not look like just multiplying probabilities like was said in video.

Thank you.

1 Like

Hi Andrei @lotgon,

It is multiplying probabilities. Please check out this page. The code line you quoted is the same as the first equation in the “Multivariate Normal Distributions” section. And if you keep following the text, you will see that, when the features are uncorrelated, the first equation can be reduced to the 5th equation (in the same section, note number 2) which is more familiar to us.

Raymond

2 Likes

Thank you, your link to the book is quite useful. Hoped to get some intuition about that formula, but found nothing in the Internet.

I would check out section 4.2 - Bivariate Normal Distribution of the same link for some visuals and for a simpler, more human-brain friendly 2 dimensional case. When you feel comfortable with the 2D case, then you can go back to the N-D case, or you may try to explain to yourself about the 1-D case.

1 Like