Changeset 183
- Timestamp:
- 10/17/08 10:28:16 (16 years ago)
- Files:
-
- 8 modified
Legend:
- Unmodified
- Added
- Removed
-
bdm/estim/merger.cpp
r182 r183 108 108 for ( int k= 0; k<Ns; k++ ) { 109 109 smpk=Smp( k ); 110 tmp_cond->condition ( get_vec ( smpk,zinrvc ) ); 111 lw_src ( k ) += tmp_cond->_epdf().evalpdflog ( get_vec ( smpk,zinrv ) ); 110 lw_src ( k ) += log( tmp_cond->evalcond ( get_vec ( smpk,zinrv ), get_vec ( smpk,zinrvc ) )); 112 111 } 113 112 delete tmp_cond; … … 152 151 // ==== stopping rule === 153 152 niter++; 154 converged = ( niter> 20);153 converged = ( niter>6); 155 154 } 156 155 -
bdm/math/chmat.h
r168 r183 63 63 Ch=chol ( M ); 64 64 }; 65 //! Constructor 66 chmat ( const chmat &M, const ivec &perm ):sqmat(M.rows()){it_error("not implemneted");}; 65 67 //! Access function 66 68 mat & _Ch() {return Ch;} -
bdm/math/libDC.h
r180 r183 131 131 //! Constructor 132 132 fsqmat ( const mat &M ); 133 //! Constructor 134 fsqmat ( const fsqmat &M, const ivec &perm ):sqmat(M.rows()){it_error("not implemneted");}; 133 135 //! Constructor 134 136 fsqmat ( const vec &d ):sqmat(d.length()){M=diag(d);}; -
bdm/stat/emix.cpp
r182 r183 35 35 for(int i=0;i<Coms.length();i++){Cn(i)=Coms(i)->marginal(rv);} 36 36 emix* tmp = new emix(rv); 37 tmp->set_parameters(w,C oms,false);37 tmp->set_parameters(w,Cn,false); 38 38 tmp->ownComs(); 39 39 return tmp; -
bdm/stat/emix.h
r182 r183 57 57 den = nom->marginal(rvc); 58 58 }; 59 double evalcond(const vec &val, const vec &cond) const{59 double evalcond(const vec &val, const vec &cond) { 60 60 return exp(nom->evalpdflog(concat(val,cond)) - den->evalpdflog(cond)); 61 61 } … … 100 100 int i; 101 101 double sum = 0.0; 102 for ( i = 0;i < w.length();i++ ) {sum += w ( i ) * Coms ( i )->evalpdflog ( val);}102 for ( i = 0;i < w.length();i++ ) {sum += w ( i ) * exp(Coms ( i )->evalpdflog ( val ));} 103 103 return log ( sum ); 104 104 }; -
bdm/stat/libBM.h
r182 r183 182 182 } 183 183 //! Return conditional density on the given RV, the remaining rvs will be in conditioning 184 virtual mpdf* condition(const RV &rv) const {it_warning("Not implemented"); return NULL;}184 virtual mpdf* condition(const RV &rv) const {it_warning("Not implemented"); return NULL;} 185 185 //! Return marginal density on the given RV, the remainig rvs are intergrated out 186 epdf* marginal(const RV &rv) const {it_warning("Not implemented"); return NULL;}186 virtual epdf* marginal(const RV &rv) const {it_warning("Not implemented"); return NULL;} 187 187 188 188 //! return expected value -
bdm/stat/libEF.h
r182 r183 130 130 double lognc () const; 131 131 vec mean() const {return mu;} 132 mlnorm<sq_T>* condition ( const RV &rvn ) const ; 133 enorm<sq_T>* marginal ( const RV &rv ) const; 132 // mlnorm<sq_T>* condition ( const RV &rvn ) const ; 133 mpdf* condition ( const RV &rvn ) const ; 134 // enorm<sq_T>* marginal ( const RV &rv ) const; 135 epdf* marginal ( const RV &rv ) const; 134 136 //Access methods 135 137 //! returns a pointer to the internal mean value. Use with Care! … … 597 599 598 600 template<class sq_T> 599 e norm<sq_T>* enorm<sq_T>::marginal ( const RV &rvn ) const {601 epdf* enorm<sq_T>::marginal ( const RV &rvn ) const { 600 602 ivec irvn = rvn.dataind ( rv ); 601 603 … … 607 609 608 610 template<class sq_T> 609 m lnorm<sq_T>* enorm<sq_T>::condition ( const RV &rvn ) const {611 mpdf* enorm<sq_T>::condition ( const RV &rvn ) const { 610 612 611 613 RV rvc = rv.subt ( rvn ); -
tests/enorm_test.cpp
r182 r183 52 52 cout << "original empirical variance: " <<Er <<endl; 53 53 54 e norm<ldmat>* Mg = E.marginal ( y );55 m lnorm<ldmat>* Cn = E.condition ( x );54 epdf* Mg = E.marginal ( y ); 55 mpdf* Cn = E.condition ( x ); 56 56 57 57