brunch

You can make anything
by writing

C.S.Lewis

by 라인하트 Dec 07. 2020

앤드류 응의 머신러닝(15-7):다변량 가우시안 분포

   온라인 강의 플랫폼 코세라의 창립자인 앤드류 응 (Andrew Ng) 교수는 인공지능 업계의 거장입니다. 그가 스탠퍼드 대학에서 머신 러닝 입문자에게 한 강의를 그대로 코세라 온라인 강의 (Coursera.org)에서 무료로 배울 수 있습니다. 이 강의는 머신러닝 입문자들의 필수코스입니다. 인공지능과 머신러닝을 혼자 공부하면서 자연스럽게 만나게 되는 강의입니다. 



Anomaly Detection  

(이상 탐지)


Multivariate Gaussian Distribution

(다변량 가우시안 분포)    


Multivariate Gaussian Distribution (다변량 가우시안 분포)   


   In this and the next video, I'd like to tell you about one possible extension to the anomaly detection algorithm that we've developed so far. This extension uses something called the multivariate Gaussian distribution, and it has some advantages, and some disadvantages, and it can sometimes catch some anomalies that the earlier algorithm didn't. 


  이번 강의와 다음 강의에서 이상 탐지 알고리즘을 다변량 가우시안 분포를 활용하도록 확장합니다. 다변량 가우시안 분포도 다른 알고리즘과 마찬가지로 장점과 단점이 있고, 때때로 기존 알고리즘이 포착하지 못한 이상 현상을 포착할 수 있습니다. 



   To motivate this, let's start with an example. Let's say that so our unlabeled data looks like what I have plotted here. And I'm going to use the example of monitoring machines in the data center, monitoring computers in the data center. So my two features are x1 which is the CPU load and x2 which is maybe the memory use. 


   여기 레이블이 없는 데이터를 그린 그래프가 있습니다. 데이터 센터의 서버를 모니터링하면서 수집한 데이터의 피처 x1은 CPU 부하이고 피처 x2는 메모리 사용량입니다.



   So if I take my two features, x1 and x2, and I model them as Gaussians then here's a plot of my X1 features, here's a plot of my X2 features, and so if I fit a Gaussian to that, maybe I'll get a Gaussian like this, so here's P of X 1, which depends on the parameters mu 1, and sigma squared 1, and here's my memory used, and, you know, maybe I'll get a Gaussian that looks like this, and this is my P of X 2, which depends on mu 2 and sigma squared 2. And so this is how. the anomaly detection algorithm models X1 and X2. 


   두 가지 피처 x1과 x2을 각각 가우시안 분포로 p(x)를 모델링하였습니다. 우측 상단은 p(x1)을 우측 하단에 p(x2)입니다. x1과 x2 데이터에 적합한 가우시안 분포를 계산합니다. 우측 상단에 CPU 사용량 피처에 대한 확률 p(x1; μ1, σ1^2)는 파라미터 μ1과 σ1^2에 따라 달라집니다. 우측 하단에 메모리 사용량 피처에 관한 확률 p(x2; μ2, σ2^2)는 파라미터 μ2와 σ2^2에 따라 달라집니다. 이것이 x1과 x2를 모델링하는 방법입니다. 



   Now let's say that in the test sets I have an example that looks like this. The location of that green cross, so the value of X 1 is about 0.4, and the value of X 2 is about 1.5. Now, if you look at the data, it looks like, yeah, most of the data data lies in this region, and so that green cross is pretty far away from any of the data I've seen. It looks like that should be raised as an anomaly. So, in my data, in my, in the data of my good examples, it looks like, you know, the CPU load, and the memory use, they sort of grow linearly with each other. So if I have a machine using lots of CPU, you know memory use will also be high, whereas this example, this green example it looks like here, the CPU load is very low, but the memory use 

is very high, and I just have not seen that before in my training set. It looks like that should be an anomaly.


   여기 테스트 셋에 녹색 예제를 봅시다. 녹색 예제의 x1은 0.4이고, x2는 1.5입니다. 빨간색 예제는 대부분 파란색 타원 안에 있습니다. 녹색 예제는 정상 예제인 빨간색 예제와 상당히 먼 거리에 있기 때문에 이상 예제로 판단할 수 있습니다. 또한, 정상 예제는 CPU 사용량과 메모리 사용량이 선형적으로 증가합니다. 즉, CPU 사용량이 증가할수록 메모리 사용량도 증가합니다. 반면에 녹색 예제는 CPU 부하는 매우 낮지만 메모리 사용량은 매우 높습니다. 학습 셋에서 이런 데이터를 본 적이 없습니다. 녹색 예제는 이상 예제입니다.  



  

   But let's see what the anomaly detection algorithm will do. Well, for the CPU load, it puts it at around there 0.5 and this reasonably high probability is not that far from other examples we've seen, maybe, whereas, for the memory use, this appointment, 0.5, whereas for the memory use, it's about 1.5, which is there. Again, you know, it's all to us, it's not terribly Gaussian, but the value here and the value here is not that different from many other examples we've seen, and so P of X 1, will be pretty high, reasonably high. P of X 2 reasonably high. I mean, if you look at this plot right, this point here, it doesn't look that bad, and if you look at this plot, you know across here, doesn't look that bad. I mean, I have had examples with even greater memory used, or with even less CPU use, and so this example doesn't look that anomalous. And so, an anomaly detection algorithm will fail to flag this point as an anomaly. 

   And it turns out what our anomaly detection algorithm is doing is that it is not realizing that this blue ellipse shows the high probability region, is that, one of the thing is that, examples here, a high probability, and the examples, the next circle of from a lower probably, and examples here are even lower probability, and somehow, here are things that are, green cross there, it's pretty high probability, and in particular, it tends to think that, you know, everything in this region, everything on the line that I'm circling over, has, you know, about equal probability, and it doesn't realize that something out here actually has much lower probability than something over there.


   이상 탐지 알고리즘의 동작 방식을 정리합니다. 우측 상단의 CPU 부하를 나타내는 피처 x1은 0.5 정도로 높은 확률이지만 합리적입니다. 다른 예제들과 멀리 떨어져 있지 않습니다. 우측 하단의 메모리 사용량을 나타내는 피처 x2는 1.5이고 높은 확률이지만 합리적입니다. 정상적인 예제와 크게 다르지 않습니다. 즉, 녹색 십자가 데이터는 확률 p(x1)과 p(x2)가 꽤 높지만 그렇게 나쁘지 않습니다. 더 많은 메모리를 사용하는 예제도 있고, 더 적은 CPU를 사용하는 예제도 있으므로 녹색 예제는 정상 범위에 있습니다. 따라서 이상 탐지 알고리즘은 현재의 녹색 데이터를 이상으로 표시하지 않습니다.

   따라서, 이상 탐지 알고리즘은 파란색 타원이 높은 확률 영역을 보여주지 않는다는 것이 밝혀졌습니다. 높은 확률은 가장 작은 분홍색 원입니다. 그다음 중간 크기의 분홍색 원은 더 낮은 확률입니다. 가장 큰 분홍색 원은 가장 낮은 확률입니다. 꽤 높은 확률입니다. 같은 분홍색 원 위에 있는 데이터는 같은 확률을 가집니다. 그리고, 중간 크기의 분홍색 원 위의 위의 녹색 예제가 아래의 녹색 예제보다 훨씬 더 낮은 확률입니다. 



   So, in order to fix this, we can, we're going to develop a modified version of the anomaly detection algorithm, using something called the multivariate Gaussian distribution also called the multivariate normal distribution. So here's what we're going to do. We have features x which are in Rn and instead of P of X 1, P of X 2, separately, we're going to model P of X, all in one go, so model P of X, you know, all at the same time. So the parameters of the multivariate Gaussian distribution are mu, which is a vector, and sigma, which is an n by n matrix, called a covariance matrix, and this is similar to the covariance matrix that we saw when we were working with the PCA, with the principal components analysis algorithm. 

   For the second complete is, let me just write out the formula for the multivariate Gaussian distribution. So we say that probability of x, and this is parameterized by my parameters mu and sigma that the probability of x is equal to once again there's absolutely no need to memorize this formula. You know, you can look it up whenever you need to use it, but this is what the probability of X looks like. Transverse, 2nd inverse, X minus mu. And this thing here, the absolute value of sigma, this thing here when you write this symbol, this is called the determinate of sigma and this is a mathematical function of a matrix and you really don't need to know what the determinant of a matrix is, but really all you need to know is that you can compute it in octave by using the octave command DET of sigma. Okay, and again, just be clear, alright? In this expression, these sigmas here, these are just n by n matrix. This is not a summation and you know, the sigma there is an n by n matrix. 


   따라서, 이 문제를 해결하려면 다변량 정규 분포이자 다변량 가우시안 분포를 사용하는 변형된 버전의 이상  탐지 알고리즘이 필요합니다. x는 R^(n) 차원이고, p(x1), p(x2),..., p(xn)을 각각 모델링하지 않고 한꺼번에 모델링합니다. 따라서, 다변량 가우시안 분포의 파라미터 μ는 R^(n) 차원 벡터이고, Σ는 R^(n X n) 공분산 행렬입니다. 이것은 주성분 분석 알고리즘인 PCA를 공부할 때 보았던 공분산 행렬과 유사합니다. 공분산 행렬은 두 쌍의 행렬들이 얼마나 닮았는 지를 나타내는 행렬입니다. 


   두 번째로 다변량 가우스 분포에 대한 공식을 정리합니다. 데이터 x에 대한 확률을 예측하기 위해 필요한 파라미터는  μ와 Σ입니다.  

    이 공식이 필요할 때마다 참조하면 되므로 외울 필요가 없습니다. |Σ|은 행렬 Σ의 절대값입니다. Σ는 행렬식(determinant)입니다. 


   행렬식은 행렬의 성분들을 이용하여 계산한 실수 값입니다. 행렬식은 정방 행렬에 대해 행렬의 특성을 결정짓는 중요한 값입니다. 옥타브 프로그램에서 행렬식을 det() 함수를 사용합니다. 예를 들면, det(A) = 0 이면 행렬 A는 역행렬이 존재하지 않고 det(A)가 0이 아니면 역행렬이 존재합니다. 행렬식은 어떤 행렬이 역행렬이 존재하는지 여부를 판별합니다. 또한, 정방 행렬 A를 특정한 면적을 가진 도형 P에 곱하면 선형 변환을 합니다. 즉,


                 P' = AP 

                 P'(면적) = |det(A)| X P(면적)

   

   여기서, det(A) > 0면 도형의 방향(시계 방향 또는 반시계 방향)이 보존됩니다.



   행렬식(determinant)이 무엇인지 알 필요가 없지만, 옥타브 프로그램에서 계산하는 함수는 알아야 합니다. 옥타브 프로그램에서 행렬식 계산하는 코드는 다음과 같고, Σ는 R^(n X n) 정방 행렬입니다.


             det(Sigma);


      


   So that's the formula for P of X, but it's more interestingly, or more importantly, what does P of X actually looks like? Lets look at some examples of multivariate Gaussian distributions. So let's take a two dimensional example, say if I have N equals 2, I have two features, X 1 and X 2. Lets say I set MU to be equal to 0 and sigma to be equal to this matrix here. With 1s on the diagonals and 0s on the off-diagonals, this matrix is sometimes also called the identity matrix. In that case, p of x will look like this, and what I'm showing in this figure is, you know, for a specific value of X1 and for a specific value of X2, the height of this surface the value of p of x. And so with this setting the parameters p of x is highest when X1 and X2 equal zero 0, so that's the peak of this Gaussian distribution, and the probability falls off with this sort of two dimensional Gaussian or this bell shaped two dimensional bell-shaped surface.


    확률 추정 p(x)가 어떤 모양인지를 아는 것은 중요합니다. 다변량 가우스 분포의 몇 가지 예를 살펴보겠습니다. 2차원 예제를 살펴봅니다. 만일 n = 2 라면, x1과 x2의 두 가지 피처가 있습니다. 평균 파라미터 μ는 0입니다. 분산 파라미터 Σ를 여기 행렬과 같게 설정합니다. 대각선 부분에 1이 있고 나머지는 0인 단위행렬입니다. 이때 p(x)는 중간 그림과 같습니다. 여기서 피처 x1의 값과 피처 x2의 값에 대한 표면의 높이는 확률 p(x)입니다. 따라서, x1 = 0이고 x2 = 0 일 때 p(x)의 값이 가장 높습니다. 여기가 가우시안 분포의 정상입니다. 확률은 이런 종류의 2차원 가우시안 분포이거나 2차원의 종모양 표면입니다. 

      

   Down below is the same thing but plotted using a contour plot instead, or using different colors, and so this heavy intense red in the middle, corresponds to the highest values, and then the values decrease with the yellow being slightly lower values the cyan being lower values and this deep blue being the lowest values so this is really the same figure but plotted viewed from the top instead, using colors instead. And so, with this distribution, you see that it faces most of the probability near 0,0 and then as you go out from 0,0 the probability of X1 and X2 goes down.


   하단의 그림은 등고선으로 도식화하여 각각의 색을 사용하였습니다. 중간은 강렬한 빨간색으로 가장 높은 값에 해당하고, 노란색이 약간 낮은 값이고, 녹색은 더 낮은 값입니다. 실제로 동일한 그림이지만 색상을 사용하여 더 높은 확률을 구분합니다. 이 가우시안 분포에서 (0,0)에서 가장 가까운 확률에 직면하고 (0,0)에서 벗어나면 x1과 x2의 확률은 낮아집니다. 



   Now lets try varying some of the parameters and see what happens. So let's take sigma and change it so let's say sigma shrinks a little bit. Sigma is a covariance matrix and so it measures the variance or the variability of the features X1 X2. So if the shrink sigma then what you get is what you get is that the width of this bump diminishes and the height also increases a bit, because the area under the surface is equal to 1. So the integral of the volume under the surface is equal to 1, because probability distribution must integrate to one. But, if you shrink the variance, it's kinda like shrinking sigma squared, you end up with a narrower distribution, and one that's a little bit taller. And so you see here also the concentric ellipsis has shrunk a little bit. 


   이제 파라미터를 변경하면 어떤 일이 발생하는 지를 살펴보겠습니다. 파라마터 Σ를 변경합니다. 우선은 Σ가 줄어든다고 가정합시다. Σ는 공분산 행렬이므로 피처 x1과 x2의 분산과 변동성을 측정합니다. 따라서 Σ가 줄어들면 폭이 줄어들고 높이가 약간 증가합니다. 왜냐하면 표면 아래의 총면적은 1이기 때문입니다. 표면 아래 부피의 적분은 확률 분포이므로 총합이 1입니다. 그러나 분산을 축소하면 σ^2를 축소하는 것과 비슷합니다. 여기서 볼 수 있듯이 동심원의 크기가 약간 줄어듭니다. 



   Whereas in contrast if you were to increase sigma to 2 2 on the diagonals, so it is now two times the identity then you end up with a much wider and much flatter Gaussian. And so the width of this is much wider. This is hard to see but this is still a bell shaped bump, it's just flattened down a lot, it has become much wider and so the variance or the variability of X1 and X2 just becomes wider.


   반대로 Σ = [2, 0; 0, 2] 행렬로 대각선에 2, 2로 늘립니다. 두 배로 더 넓고 더 평평한 가우스 분포가 됩니다. 너비가 훨씬 더 넓습니다. 그래프는 여전히 종모양입니다. x1과 x2의 분산 또는 변화량이 더 넓어집니다.  



   Here are a few more examples. Now lets try varying one of the elements of sigma at the time. Let's say I send sigma to 0.6 there, and 1 over there. What this does, is this reduces the variance of the first feature, X 1, while keeping the variance of the second feature X 2, the same. And so with this setting of parameters, you can model things like that. X 1 has smaller variance, and X 2 has larger variance. Whereas if I do this, if I set this matrix to 2, 1 then you can also model examples where you know here we'll say X1 can have take on a large range of values whereas X2 takes on a relatively narrower range of values. And that's reflected in this figure as well, you know where, the distribution falls off more slowly as X 1 moves away from 0, and falls off very rapidly as X 2 moves away from 0.


   여기 몇 가지 사례가 있습니다. 이제 Σ 행렬의 성분 중 하나를 변경합니다. Σ를 x1의 분산은 0.6으로 하고, x2의 분산은 1로 합니다. 즉, x1의 분산은 줄이고 x2의 분산은 동일하게 유지합니다. 이 파라미터를 설정하여 p(x)를 모델링하면 세로로 길쭉한 타원 모양입니다. 또, Σ를 x1의 분산은 2로 하고, x2의 분산은 1로 합니다. x1의 분산은 늘리고 x2의 분산은 동일하게 유지합니다. 이 파라미터를 설정하여 p(x)를 모델링하면 가로로 길쭉한 타원 모양입니다. x1은 넓은 범위의 값을 가지고 있지만, x2는 상대적으로 좁은 범위의 값입니다. x1은 0에서 멀어짐에 따라 분포가 더 느리게 낮아지고, x 2가 0에서 멀어짐에 따라 매우 빠르게 떨어집니다. 


     


   And similarly if we were to modify this element of the matrix instead, then similar to the previous slide, except that here where you know playing around here saying that X2 can take on a very small range of values and so here if this is 0.6, we notice now X2 tends to take on a much smaller range of values than the original example, whereas if we were to set sigma to be equal to 2 then that's like saying X2 you know, has a much larger range of values.


   앞에서 한 것과 비슷하게 행렬의 성분을 변경합니다. x1의 분산은 고정하고, x2의 분산을 변경합니다. x2의 분산을 0.6으로 설정하여 p(x)를 모델링하면 가로로 길쭉한 타원 모양입니다. x2의 범위가 원래 예제보다 작아집니다. x2의 분산을 2로 설정하여 p(x)를 모델링하면 세로로 길쭉한 타원 모양입니다. x2의 범위가 원래 예제보다 더 크게 넓어집니다.  



   Now, one of the cool things about the multivariate Gaussian distribution is that you can also use it to model correlations between the data. That is we can use it to model the fact that X1 and X2 tend to be highly correlated with each other for example. So specifically if you start to change the off diagonal entries of this covariance matrix you can get a different type of Gaussian distribution. And so as I increase the off-diagonal entries from. 5 to. 8, what I get is this distribution that is more and more thinly peaked along this sort of x equals y line. And so here the contour says that x and y tend to grow together and the things that are with large probability are if either X1 is large and Y2 is large or X1 is small and Y2 is small. Or somewhere in between. And as this entry, 0.8 gets large, you get a Gaussian distribution, that's sort of where all the probability lies on this sort of narrow region, where x is approximately equal to y. This is a very tall, thin distribution you know line mostly along this line central region where x is close to y. So this is if we set these entries to be positive entries.


   다변량 가우스 분포의 멋진 것 중 하나는 데이터 간의 상관관계를 모델링할 수 있다는 것입니다. 예를 들어, x1과 x 2가 서로 높은 상관관계가 있다는 것을 모델링할 때 사용할 수 있습니다. 특히 이 공분산 행렬의 비대각선 항목을 변경하면 다른 유형의 가우스 분포를 만들 수 있습니다. 비대각선 항목을 0.5로 할 때와 0.8로 할 때의 그림이 있습니다. 숫자가 커질수록  x1 = x2 직선을 따라 가우스 분포는 점점 더 얇아지고 뾰족해집니다. x1 = x2 선을 따라 함께 증가하는 경향이 있습니다. 확률이 클 때는 x1이 크고 x2가 크거나, x1이 작고 x2가 작은 경우입니다. 비대각선 성분이 0.8일 때 가우스 분포입니다. x1 = x2 직선과 가까운 중앙을 따라 매우 높고 얇은 영역입니다. 이 부분이 이상이 있는 영역입니다.  



   In contrast if we set these to negative values, as I decreases it to -0.5 down to -0.8, then what we get is a model where we put most of the probability in this sort of negative X one in the next 2 correlation region, and so, most of the probability now lies in this region, where X 1 is about equal to -X 2, rather than X 1 equals X 2. And so this captures a sort of negative correlation between x1 and x2. And so this is a hopefully this gives you a sense of the different distributions that the multivariate Gaussian distribution can capture. 


   반대로, 비대각선 영역의 값을 마이너스 값으로 설정합니다. 비대각선 항목이 -0.5로 할 때와 -0.8로 할 때의 그림이 있습니다. 플러스 값과 반대의 모양입니다. x1은 x2와 같지 않고, x1이 -x2와 거의 같습니다. 이것은 x1과 x2는 일종의 음의 상관관계를 가집니다. 이것이 다변량 가우스 분포가 포착할 수 있는 다양한 분포입니다. 여러분들이 다변량 가우스 분포에 대한 감각을 익힐 수 있기를 바랍니다. 




   So follow up in varying, the covariance matrix sigma, the other thing you can do is also, vary the mean parameter mu, and so operationally, we have mu equal 0 0, and so the distribution was centered around X 1 equals 0, X2 equals 0, so the peak of the distribution is here, whereas, if we vary the values of mu, then that varies the peak of the distribution and so, if mu equals 0, 0.5, the peak is at, you know, X1 equals zero, and X2 equals 0.5, and so the peak or the center of this distribution has shifted, and if mu was 1.5 minus 0.5 then OK, and similarly the peak of the distribution has now shifted to a different location, corresponding to where, you know, X1 is 1.5 and X2 is -0.5, and so varying the mu parameter, just shifts around the center of this whole distribution. 


   공분산 행렬 Σ에서 성분 파라미터의 값을 변경하는 것이 아니라 평균 파라미터 벡터 μ를 변경합니다. 기본값은 μ = [0;0]이고, 분포는 x1 = 0, x2 = 0입니다. 분포의 가장 높은 확률인 피크는  (0,0) 지점입니다. 여기서 μ의 값을 변경하면 분포의 피크가 달라집니다. 예를 들면, x2의 μ의 값이 0.5 이면 피크는 (0,0.5)로 동심원이 x2 방향으로 0.5만큼 이동합니다. x1의 μ의 값이 1.5, x2의 μ의 값이 -0.5이면 피크는 (1.5, -0.5)로 동심원이 왼쪽 하단으로 크게 이동합니다. 


   So, hopefully, looking at all these different pictures gives you a sense of the sort of probability distributions that the Multivariate Gaussian Distribution allows you to capture. And the key advantage of it is it allows you to capture, when you'd expect two different features to be positively correlated, or maybe negatively correlated. In the next video, we'll take this multivariate Gaussian distribution and apply it to anomaly detection.


   따라서, 다변량 가우스 분포가 포착할 수 있는 다양한 확률 분포를 확인할 수 있습니다. 이것의 장점은 두 개의 서로 다른 피처가 양의 상관관계이거나 음의 상관계가 있을 것으로 예상할 때 상호 관련성을 확인할 수 있습니다. 다음 강의에서 다변량 가우시안 분포를 활용하여 이상 탐지에 적용합니다. 



앤드류 응의 머신러닝 동영상 강의



정리하며


다변량 가우시안 분포도 다른 알고리즘과 마찬가지로 장점과 단점이 있고, 원래 알고리즘이 포착하지 못한 이상 현상을 포착할 수 있습니다. 



   데이터 예제가 각 피처에 대한 확률 p(x1)과 p(x2)는 정상 범위 내에 있지만, p(x1)과 p(x2)의 상관관계를 나타내는 그래프에서는 정상 범위를 크게 벗어나 있습니다. 이런 데이터를 이상으로 탐지하기 위해서는 지금까지 다룬 원 모양의 가우시안 분포 그래프를 사용할 수 없습니다. 길쭉한 파란색 타원 모양의 가우시안 분포 그래프가 있어야 해결할 수 있습니다. 그래서, 이 문제를 해결하기 위해 다변량 정규 분포이자 다변량 가우시안 분포를 사용하는 변형된 버전의 이상  탐지 알고리즘을 개발해야 합니다.


   다변량 가우스 분포에 대한 공식을 정리합니다. 


       p(x; μ, Σ)

        =  1/ (√(2π)^(n/2) * | Σ|^(1/2)) exp(- 1/2 * (x-μ)^T * Σ^(-1)(x-μ))


    Σ는 R^(n X n) 행렬이고 이 복잡한 공식을 외울 필요는 없습니다. 단지 옥타브 프로그램에서 이 함수를 호출하는 명령어를 기억하면 됩니다. 

 

       det(sigma); 


   다변량 가우시안 분포 모델의 파라미터 Σ의 값을 변경하면 종모양 그래프가 달라집니다. 


    Σ = [1, 0; 0, 1]         % 종모양은 둥글고 중간 높이, 원은 중간 크기

    Σ = [0.6, 0; 0, 0.6]   % 종모양은 뾰족하고 높고, 원은 작은 크기 

    Σ = [2, 0; 0, 2]         % 종모양은 편편하고 낮고, 원은 큰 크기


    Σ = [1, 0; 0, 1]         % 종모양은 둥글고 중간 높이, 원은 중간 크기

    Σ = [1, 0.5; 0.5, 1]   % 종모양은 둥글고 중간 높이, 원은 좌측 하단에서 우측 상단으로 길쭉한 타원 

    Σ = [1, 0.8; 0.8, 1]   % 종모양은 뾰족하고 높고, 원은 좌측 하단에서 우측 상단으로 더 길쭉한 타원


    Σ = [1, 0; 0, 1]            % 종모양은 둥글고 중간 높이, 원은 중간 크기

    Σ = [1, -0.5; -0.5, 1]   % 종모양은 둥글고 중간 높이, 원은 좌측 하단에서 우측 상단으로 길쭉한 타원 

    Σ = [1, -0.8; -0.8, 1]   % 종모양은 뾰족하고 높고, 원은 좌측 하단에서 우측 상단으로 더 길쭉한 타원 

   

   다변량 가우시안 분포 모델의 파라미터  μ 의 값을 변경하면 종모양 그래프의 위치가 달라집니다. 


    μ = [0; 0]        % 종모양은 (0,0)의 위치에 있음

    μ = [0; 0.5]     % 종모양은 x2의 방향으로 0.5 만큼 이동



   정리하면, 다변량 가우시안 분포 모델은 다양한 모양과 형태의 확률 분포 모델을 만들 수 있습니다.   




문제 풀이


   다음의 다변량 가우시안 분포가 있습니다. 평균 파라미터와 시그마 파라미터의 값으로 올바른 것은 무엇일까요?



정답은 3번입니다. 


매거진의 이전글 앤드류 응의 머신러닝(15-6):이상 탐지 피처 선택
작품 선택
키워드 선택 0 / 3 0
댓글여부
afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari