?? emsamp.m
字號:
function [data,labels] = emsamp(mixture, n)% EMSAMP Generates a sample of N data points from MoG in mixture% % Description% DATA = EMSAMP(MIXTURE,N) generates a data matrix that has N rows% (n data points) and each point is drawn from the MoG MIXTURE % [DATA, LABELS] = EMSAMP(MIXTURE,N) generates along with the data% a labeling from which gaussian in the mixture a point was% generated. % Determine number to sample from each component. Now i am not sure% if this function is wokring properly?????% % SEE also VSAMPlabels=zeros(n,1);priors = rand(1,n);% Pre-allocate data arraydata = zeros(n, mixture.dim);cum_prior = 0; % Cumulative sum of priorstotal_samples = 0; % Cumulative sum of number of sampled pointsfor j = 1:mixture.num_clus num_samples = sum(priors >= cum_prior & ... priors < cum_prior + mixture.priors(j)); kappa = mixture.kappas(j); data(total_samples+1:total_samples+num_samples, :) = ... vsamp((mixture.centers(j, :))', kappa, num_samples); labels(total_samples+1:total_samples+num_samples) = j; cum_prior = cum_prior + mixture.priors(j); total_samples = total_samples + num_samples;end
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -