- Timestamp:
- 11/10/08 15:40:29 (16 years ago)
- Location:
- mpdm
- Files:
-
- 1 added
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
mpdm/CMakeLists.txt
r198 r204 20 20 target_link_libraries (merg_pred ${BdmLibs}) 21 21 22 add_executable (merg_giw merg_giw.cpp) 23 target_link_libraries (merg_giw ${BdmLibs}) 24 22 25 add_executable (merger_iter_cond merger_iter_cond.cpp) 23 26 target_link_libraries (merger_iter_cond ${BdmLibs}) -
mpdm/merg_pred.cpp
r198 r204 34 34 mat V0g = 0.001*eye ( thrg.count() ); V0g ( 0,0 ) *= 10; // 35 35 double nu0 = ord+6.0; 36 double frg = 1.0;//0.99;36 double frg = 0.95; 37 37 38 38 ARX P1 ( thri, V0, nu0, frg ); … … 40 40 ARX PG ( thrg, V0g, nu0, frg ); 41 41 //Test estimation 42 int ndat = 500;42 int ndat = 200; 43 43 int t; 44 44 … … 51 51 int Li_Data = L.add ( RV ( "{Y U1 U2 }" ), "" ); 52 52 int Li_LL = L.add ( RV ( "{1 2 G }" ), "LL" ); 53 int Li_Pred = L.add ( RV ( "{1 2 G ar ge ln}" ), "Pred" );53 int Li_Pred = L.add ( RV ( "{1 2 G ar ge }" ), "Pred" ); 54 54 55 55 L.init(); … … 66 66 vec PostLLs(3); 67 67 vec PredLLs_m=zeros(5); 68 vec PostLLs_m=zeros(3);69 68 ivec ind_r1 = "0 1 3"; 70 69 ivec ind_r2 = "0 2 3"; … … 84 83 // Test predictors 85 84 if (t>2){ 86 mlnorm<ldmat>* P1p = P1.predictor _student(y,concat(ym,u1));87 mlnorm<ldmat>* P2p = P2.predictor _student(y,concat(ym,u2));88 mlnorm<ldmat>* Pgp = PG.predictor _student(y,concat(ym,uu));85 mlnorm<ldmat>* P1p = P1.predictor(y,concat(ym,u1)); 86 mlnorm<ldmat>* P2p = P2.predictor(y,concat(ym,u2)); 87 mlnorm<ldmat>* Pgp = PG.predictor(y,concat(ym,uu)); 89 88 90 89 Array<mpdf*> A(2); A(0)=P1p;A(1)=P2p; 91 90 merger M(A); 92 91 enorm<ldmat> g0(concat(yy,uu)); g0.set_parameters("0 0 0 0 ",3*eye(4)); 93 M.set_parameters(1 .2, 100,1);92 M.set_parameters(10000000.0, 100,1); 94 93 M.merge(&g0); 95 94 … … 98 97 double P2pl = P2p->evalcond(yt,rgr2); 99 98 double PGpl = Pgp->evalcond(yt,rgrg); 100 PredLLs(0) = log(P1pl); PredLLs(1) = log(P2pl); PredLLs(2) = log(PGpl); 99 { 100 cout << "yt: " << yt << endl; 101 cout << "yt_1: " << P1p->_epdf().mean() << endl; 102 cout << "yt_2: " << P2p->_epdf().mean() << endl; 103 cout << "yt_G: " << P2p->_epdf().mean() << endl; 104 } 105 double cP1pl; 106 double cP2pl; 101 107 { 102 108 ARX* Apred = (ARX*)M._Mix()._Coms(0); … … 107 113 mlnorm<ldmat>* cP2p = (mlnorm<ldmat>*)mP2p->condition(y); 108 114 109 double cP1pl = cP1p->evalcond(yt,rgr1); 110 double cP2pl = cP2p->evalcond(yt,rgr2); 111 PredLLs(3) = log(cP1pl); 112 PredLLs(4) = log(cP2pl); 115 cP1pl = cP1p->evalcond(yt,rgr1); 116 cP2pl = cP2p->evalcond(yt,rgr2); 117 118 cout << "ytm1: " << cP1p->_epdf().mean() << endl; 119 cout << "ytm2: " << cP2p->_epdf().mean() << endl; 113 120 } 114 121 115 L.logit(Li_Pred, PredLLs_m*frg+ PredLLs); //log-normal116 PredLLs _m *=frg;117 PredLLs_m += PredLLs;122 PredLLs *=frg; 123 PredLLs += log(concat(vec_3(P1pl, P2pl, PGpl), vec_2(cP1pl,cP2pl))); 124 L.logit(Li_Pred, PredLLs); //log-normal 118 125 119 126 delete P1p;