- Timestamp:
- 02/09/09 23:14:58 (16 years ago)
- Location:
- tests/UI
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
tests/UI/UIArxDS_test.cfg
r263 r265 18 18 r = [0.1, 0.0, 19 19 0.0, 1.0]; 20 opt="L_theta"; 20 21 }; 21 22 … … 29 30 //estimation 30 31 estimator = { 31 type = "ARX"; 32 32 type = "ARXest"; 33 ychns = [1]; 34 rgrid = [ 1, 1, 1, 2]; 35 delays = [-1, -2, -3, -1]; 36 37 //optional fields 38 dV0 = [1e-3, 1e-5, 1e-5, 1e-5, 1e-5]; //default: 1e-3 for y, 1e-5 for rgr 39 nu0 = 8.; //default: rgrlen + 2 40 frg = .990; // forgetting, default frg=1.0 33 41 }; 34 42 -
tests/UI/UIArxDS_test.cpp
r263 r265 1 1 /*! 2 \file 2 \file 3 3 \brief Test of UI builders for ARX 4 4 … … 9 9 10 10 #include <stat/libDS_ui.h> 11 #include <estim/arx_ui.h> 11 12 12 13 using namespace bdm; 13 14 int main() { 14 UIFile F ("UIArxDS_test.cfg");15 UIFile F ( "UIArxDS_test.cfg" ); 15 16 16 logger* L; 17 UIbuild (F.lookup("logger"),L);17 logger* L; 18 UIbuild ( F.lookup ( "logger" ),L ); 18 19 ArxDS * DS; 19 UIbuild (F.lookup("system"),DS);20 UIbuild ( F.lookup ( "system" ),DS ); 20 21 int Ndat; 21 F.lookupValue ("experiment.ndat",Ndat);22 F.lookupValue ( "experiment.ndat",Ndat ); 22 23 // SET SIMULATOR 24 BM* E; 25 UIbuild ( F.lookup ( "estimator" ),E ); 23 26 24 DS->log_add(*L); 27 DS->log_add ( *L ); 28 int L_est= L->add ( E->_epdf()._rv(), "est" ); // estimate 29 int L_lb = L->add ( E->_epdf()._rv(), "lb" ); // lower bound 30 int L_ub = L->add ( E->_epdf()._rv(), "ub" ); // upper bound 25 31 L->init(); 26 32 33 vec dt=zeros ( DS->_drv().count() ); //data variable 34 datalink_e2e dl ( E->_drv(),DS->_drv() ); //datalink between a datasource and estimator 35 27 36 for ( int tK=1;tK<Ndat;tK++ ) { 28 DS->step(); 29 DS->logit(*L); 37 DS->step(); // simulator step 38 DS->getdata ( dt ); // read data 39 E->bayes ( dl.get_val ( dt ) ); // update estimates 40 41 DS->logit ( *L ); 42 L->logit ( L_est, E->_epdf().mean() ); 43 L->logit ( L_lb, E->_epdf().mean()-2*sqrt ( E->_epdf().variance() ) ); 44 L->logit ( L_ub, E->_epdf().mean() +2*sqrt ( E->_epdf().variance() ) ); 45 30 46 L->step(); 31 47 } 32 33 L->finalize(); 34 48 49 L->finalize(); 50 35 51 delete L; 36 52 delete DS; 53 delete E; 37 54 return 0; 38 55 }