mkdata.m

来自「混合高斯模型 对于给定的数据」· M 代码 · 共 75 行

M
75
字号
close allclear allN=500;R1 = [ 1, 0.1; 0.1, 1];mu1 = [2, 2]';R2 = [ 1, -0.1; -0.1, 1];mu2 = [-2, -2]';R3 = [ 1, 0.2; 0.2, 0.5];mu3 = [5.5, 2]';Pi = [0.4, 0.4, 0.2];% Generate Data from Gaussian mixture modelx1 = GMM(N,Pi,mu1,mu2,mu3,R1,R2,R3); % trainingy1 = GMM(N/20,Pi,mu1,mu2,mu3,R1,R2,R3); % testingaxis([-8,10,-7,7])plot(x1(1,:),x1(2,:),'bo');title('Scatter Plot of Multimodal Traning Data for Class 0')xlabel('first component')ylabel('second component')hold onR1 = [ 1, 0.1; 0.1, 1];mu1 = [-2, 2]';                                                                                R2 = [ 1, -0.1; -0.1, 1];mu2 = [2, -2]';                                                                                R3 = [ 1, 0.2; 0.2, 0.5];mu3 = [-5.5, 2]';                                                                                Pi = [0.4, 0.4, 0.2];                                                                                % Generate Data from Gaussian mixture modelx2 = GMM(N,Pi,mu1,mu2,mu3,R1,R2,R3); % trainingy2 = GMM(N/20,Pi,mu1,mu2,mu3,R1,R2,R3); % testing                                                                                plot(x2(1,:),x2(2,:),'rx');title('Scatter Plot of Multimodal Training Data for Class 1')xlabel('first component')ylabel('second component')                                                                                % Concatenate testing data from two distributionsy = [y1,y2];figureplot(y(1,:),y(2,:),'rx');title('Scatter Plot of Multimodal Testing Data')xlabel('first component')ylabel('second component')% Save data to filesx1 = x1';save TrainingData1 x1 /asciix2 = x2';save TrainingData2 x2 /asciiy = y';save TestingData y /ascii

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?