Show
Ignore:
Timestamp:
05/27/10 23:07:57 (14 years ago)
Author:
smidl
Message:

Mixtures example

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/bdmtoolbox/tutorial/userguide/mixef_basic.m

    r1013 r1014  
    55com.rgr = RV({},[],[]); 
    66 
    7 Data = [randn(2,50) randn(2,50)+10*ones(2,50)]; 
     7Data = [randn(2,50) randn(2,50)+[5*ones(1,50); 10*ones(1,50)]]; 
    88 
    9 [Mix0,P0]=mixef_init(Data,com); 
     9[Mix0,P0]=mixef_init(Data,com,4); 
    1010% show predictor 
    1111 
     
    1616hold on 
    1717epdf_2dplot(Pred); 
     18hold on 
     19for i=1:length(Pred.pdfs) 
     20    mea=epdf_mean(Pred.pdfs{i}); 
     21    plot(mea(1),mea(2),'+r'); 
     22end 
    1823 
    1924% Do Quasi Bayes 
     
    3237    % normalize weights 
    3338    w = exp(log_w_nn-max(log_w_nn)); 
    34     w = w/sum(w) 
     39    w = w/sum(w); 
    3540     
    3641    for c=1:n 
     
    5661epdf_2dplot(PredQB); 
    5762 
     63PredQBc = bm_epredictor(MixQBc); 
     64figure(3); 
     65hold off 
     66plot(Data(1,:), Data(2,:),'.'); 
     67hold on 
     68epdf_2dplot(PredQBc); 
     69 
    5870%% relations between components 
    5971Batta_dist=zeros(n);