Changeset 201
- Timestamp:
- 11/10/08 15:40:25 (16 years ago)
- Files:
-
- 1 added
- 7 modified
Legend:
- Unmodified
- Added
- Removed
-
bdm/estim/arx.cpp
r199 r201 33 33 lll = pred.lognc(); 34 34 } 35 else 35 else//should be save: last_lognc is changed only by bayes; 36 36 if ( evalll ) {lll=last_lognc;} 37 37 else{lll=pred.lognc();} … … 39 39 V.opupdt ( dt,1.0 ); 40 40 nu+=1.0; 41 42 return pred.lognc()-lll ;41 // log(sqrt(2*pi)) = 0.91893853320467 42 return pred.lognc()-lll - 0.91893853320467; 43 43 } 44 44 -
bdm/stat/libBM.cpp
r192 r201 111 111 } 112 112 113 mat epdf::sample N( int N ) const {113 mat epdf::sample_m ( int N ) const { 114 114 mat X = zeros ( rv.count(), N ); 115 115 for ( int i = 0;i < N;i++ ) X.set_col ( i, this->sample() ); -
bdm/stat/libBM.h
r200 r201 169 169 virtual vec sample () const =0; 170 170 //! Returns N samples from density \f$epdf(rv)\f$ 171 virtual mat sampleN ( int N ) const; 172 //! Compute probability of argument \c val 173 virtual double eval ( const vec &val ) const {return exp ( this->evalpdflog ( val ) );}; 174 171 virtual mat sample_m ( int N ) const; 172 175 173 //! Compute log-probability of argument \c val 176 174 virtual double evalpdflog ( const vec &val ) const =0; … … 232 230 233 231 //! Shortcut for conditioning and evaluation of the internal epdf. In some cases, this operation can be implemented efficiently. 234 virtual double evalcond ( const vec &dt, const vec &cond ) {this->condition ( cond );return ep->eval ( dt );}; 232 virtual double evalcond ( const vec &dt, const vec &cond ) {this->condition ( cond );return exp(ep->evalpdflog ( dt ));}; 233 234 virtual vec evalcond_m ( const mat &Dt, const vec &cond ) {this->condition ( cond );return exp(ep->evalpdflog_m ( Dt ));}; 235 235 236 236 //! Destructor for future use; -
tests/CMakeLists.txt
r193 r201 40 40 # ESTIM TESTS 41 41 TEST(arx_test) 42 TEST(arx_elem_test) 42 43 TEST(merger_test) 43 44 TEST(merger_iter_test) -
tests/emix_test.cpp
r193 r201 77 77 vec ll ( N ); 78 78 vec ll2 ( N ); 79 mat Smp=M2.sample N( N );79 mat Smp=M2.sample_m ( N ); 80 80 ll = M2.evalpdflog_m(Smp); 81 81 -
tests/mixef_test.cpp
r191 r201 63 63 // Sample parameters 64 64 int ndat = 100; 65 mat Smp =Simul.sample N( ndat );65 mat Smp =Simul.sample_m ( ndat ); 66 66 67 67 cout << "Simulated means: " << m1 <<" and " << m2 <<endl; -
tests/testSmp.cpp
r179 r201 53 53 eG.set_parameters(a,b); 54 54 55 cout << eG.eval (a)<<endl;56 Smp = eG.sample N(N);55 cout << eG.evalpdflog(a)<<endl; 56 Smp = eG.sample_m(N); 57 57 58 58 vec g_mu = elem_div(a,b); … … 76 76 eMix.set_parameters(vec_2(0.5,0.5), Coms); 77 77 vec smp = eMix.sample(); 78 Smp = eMix.sample N(N);78 Smp = eMix.sample_m(N); 79 79 disp(eMix.mean(),zeros(2),Smp); 80 80