Main Content

가우스 혼합 모델 생성하기

이 예제에서는 gmdistribution을 사용하고 성분 평균, 공분산, 혼합 비율을 지정하여 알려진 또는 완전히 지정된 GMM(가우스 혼합 모델) 객체를 만드는 방법을 보여줍니다. 데이터를 GMM에 피팅하여 GMM 객체를 만들려면 Fit Gaussian Mixture Model to Data 항목을 참조하십시오.

두 개의 성분을 갖는 이변량 가우스 분포의 혼합 모델에 대해 성분 평균, 공분산, 혼합 비율을 지정합니다.

mu = [1 2;-3 -5];                    % Means
sigma = cat(3,[2 0;0 .5],[1 0;0 1]); % Covariances
p = ones(1,2)/2;                     % Mixing proportions

mu의 행은 성분 평균 벡터에 대응되고 sigma의 페이지 sigma(:,;,J)는 성분 공분산 행렬에 대응됩니다.

gmdistribution을 사용하여 GMM 객체를 생성합니다.

gm = gmdistribution(mu,sigma,p);

GMM의 속성을 표시합니다.

properties(gm)
Properties for class gmdistribution:

    NumVariables
    DistributionName
    NumComponents
    ComponentProportion
    SharedCovariance
    NumIterations
    RegularizationValue
    NegativeLogLikelihood
    CovarianceType
    mu
    Sigma
    AIC
    BIC
    Converged
    ProbabilityTolerance

속성에 대한 설명은 gmdistribution 항목을 참조하십시오. 속성 값에 액세스하려면 점 표기법을 사용하십시오. 예를 들어 각 GMM 성분의 변수 수에 액세스할 수 있습니다.

dimension = gm.NumVariables
dimension = 2

pdf 및 MATLAB® 함수 fsurf를 사용하여 GMM의 확률 밀도 함수(pdf)를 시각화합니다.

gmPDF = @(x,y) arrayfun(@(x0,y0) pdf(gm,[x0 y0]),x,y);
fsurf(gmPDF,[-10 10])
title('Probability Density Function of GMM');

Figure contains an axes object. The axes object with title Probability Density Function of GMM contains an object of type functionsurface.

cdffsurf를 사용하여 GMM의 누적 분포 함수(cdf)를 시각화합니다.

gmCDF = @(x,y) arrayfun(@(x0,y0) cdf(gm,[x0 y0]),x,y);
fsurf(gmCDF,[-10 10])
title('Cumulative Distribution Function of GMM');

Figure contains an axes object. The axes object with title Cumulative Distribution Function of GMM contains an object of type functionsurface.

참고 항목

|

관련 항목