Show
Ignore:
Timestamp:
05/27/10 13:08:31 (14 years ago)
Author:
smidl
Message:

new mexes + cleanup

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/bdmtoolbox/mex/mixef_init.cpp

    r801 r1002  
    2121                                                "  Data = [];                                 % matrix of data \n" 
    2222                                                "  Com1 = struct('class','BMEF_offspring');   % A typical component \n" 
     23                                                "  no_com = [10];                             % requested numbebr of component \n" 
    2324                                                "output:\n" 
    2425                                                "  structure with description of mixture." ); 
     
    3738         
    3839        UImxArray Cfg(input[1]); 
    39 //      Cfg.writeFile("mixef_init.cfg"); 
     40        Cfg.writeFile("mixef_init.cfg"); 
    4041 
     42        int no_com=10; 
     43        if (n_input>2){ 
     44                no_com = mxArray2double(input[2]); 
     45        } 
    4146#else 
    4247int main() { 
    4348        UIFile Cfg ( "mixef_init.cfg" ); 
    4449        mat Data=randn(2,100); // <<<<<<<<< ============== beware!!! 
     50        int no_com =10; 
    4551#endif 
    4652         
    4753        shared_ptr<BMEF> com1=UI::build<BMEF>(Cfg.getRoot()); 
    4854        MixEF mix; 
    49         mix.init(&(*com1),Data,10); 
     55        mix.init(&(*com1),Data,no_com); 
    5056        mix.bayes_batch(Data,zeros(0,Data.cols()),ones(Data.cols())); 
    51          
     57        shared_ptr<epdf> p=mix.epredictor(vec(0)); 
     58        UIFile prf; 
     59        UI::save(p.get(), prf.getRoot(),"predictor"); 
     60        prf.writeFile("mix_pred.cfg"); 
     61                 
    5262#ifdef MEX       
    5363        UImxArray out; 
    5464        UI::save( &mix, out ); 
    5565        output[0]= out.create_mxArray(); 
     66        if (n_output>1){ 
     67                UImxArray ep; 
     68                shared_ptr<epdf> p=mix.epredictor(vec(0)); 
     69                UI::save( p.get(), ep ); 
     70                output[1] = ep.create_mxArray(); 
     71        } 
     72         
    5673#else 
    5774        UIFile out;