matlab - Multivariate Gaussian distribution formula implementation -
I have a definite problem when implementing multivariate Gaussian distribution for discrepancy detection.
I have given reference to the formula from Andrew NG
http://www.holehouse.org/mlclass/15_Anomaly_Detection.html
< P> Below is the problem I have Suppose I have a data set with two attributes and the number of training numbers is n = 2 and my polygonal probability p. (X; mu; Sigma) which should be [m * 1] matrix because it has to face the problem
I have to face the problem of matrix [M * 1] I am unable to use the formula to produce.
I am using Octave as IDE to develop algorithms.
Below is a snapshot of my problem showing
Please help me understand that I am wrong
thanks
< / Div>
I think you have wrong dimensions.
Assume that you have a 2-dimensional ( n = 2
) data for the m
examples. We will call this data in MATLAB a N-by-m
can be stored in the form of matrix (columns are data instances, rows represent the feature / dimension) in this case we have:
-
X
size data matrixnxm
, each example isx = X (:, i)
a vector of sizenx1
( Column vector in our conference). -
mu
mean vector (mu = means (x, 2)
). It is also a column vector of a size whose example isnx1
. -
Sigma
co-operative matrix (sigma = COV (x. ')
). Its size isnxn
(it describes how each dimension varies with each other's dimensions).
Therefore, the part you have highlighted in red, it involves the following: Size:
= ([nx1] - [nx1]) '* [Nxn] * ([nx1] - [nx1]) = [1xn] * [nxn] * [nx1] = 1x1
Comments
Post a Comment