Changeset 1002 for applications/bdmtoolbox/mex/mixef_init.cpp
- Timestamp:
- 05/27/10 13:08:31 (14 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/bdmtoolbox/mex/mixef_init.cpp
r801 r1002 21 21 " Data = []; % matrix of data \n" 22 22 " Com1 = struct('class','BMEF_offspring'); % A typical component \n" 23 " no_com = [10]; % requested numbebr of component \n" 23 24 "output:\n" 24 25 " structure with description of mixture." ); … … 37 38 38 39 UImxArray Cfg(input[1]); 39 //Cfg.writeFile("mixef_init.cfg");40 Cfg.writeFile("mixef_init.cfg"); 40 41 42 int no_com=10; 43 if (n_input>2){ 44 no_com = mxArray2double(input[2]); 45 } 41 46 #else 42 47 int main() { 43 48 UIFile Cfg ( "mixef_init.cfg" ); 44 49 mat Data=randn(2,100); // <<<<<<<<< ============== beware!!! 50 int no_com =10; 45 51 #endif 46 52 47 53 shared_ptr<BMEF> com1=UI::build<BMEF>(Cfg.getRoot()); 48 54 MixEF mix; 49 mix.init(&(*com1),Data, 10);55 mix.init(&(*com1),Data,no_com); 50 56 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 52 62 #ifdef MEX 53 63 UImxArray out; 54 64 UI::save( &mix, out ); 55 65 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 56 73 #else 57 74 UIFile out;