Main Content

混合ガウス モデルから派生するデータのシミュレート

この例では、完全に指定した gmdistribution オブジェクトと関数 random を使用して、混合ガウス モデル (GMM) から派生するデータをシミュレートする方法を示します。

既知の 2 成分 GMM オブジェクトを作成します。

mu = [1 2;-3 -5];
sigma = cat(3,[2 0;0 .5],[1 0;0 1]);
p = ones(1,2)/2;
gm = gmdistribution(mu,sigma,p);

GMM の pdf の等高線図をプロットします。

gmPDF = @(x,y) arrayfun(@(x0,y0) pdf(gm,[x0 y0]),x,y);
fcontour(gmPDF,[-10 10]);
title('Contour lines of pdf');

Figure contains an axes object. The axes object with title Contour lines of pdf contains an object of type functioncontour.

GMM から 1000 個の確率変量を生成します。

rng('default') % For reproducibility
X = random(gm,1000);

これらの変量を pdf の等高線図と共にプロットします。

hold on
scatter(X(:,1),X(:,2),10,'.') % Scatter plot with points of size 10
title('Contour lines of pdf and Simulated Data')

Figure contains an axes object. The axes object with title Contour lines of pdf and Simulated Data contains 2 objects of type functioncontour, scatter.

参考

| | |

関連するトピック