- Timestamp:
- 05/28/10 22:50:46 (14 years ago)
- Location:
- library/bdm
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/base/bdmbase.h
r1009 r1020 76 76 } 77 77 \enddot 78 79 RV name may be empty string! In that case, it is not a valid name but only a size holder. It will fail in comparison. 78 80 */ 79 81 … … 1023 1025 protected: 1024 1026 datalink_part dl; 1027 int vecfromlen; 1025 1028 public: 1026 1029 void update(const vec &v1){ 1027 1030 bdm_assert_debug(length()==dl._downsize(),"vec_from_vec incompatible"); 1028 bdm_assert_debug(v1.length()>=dl._upsize(),"vec_from_vec incompatible");//does not guarantee anything! 1031 bdm_assert_debug(v1.length()==vecfromlen,"This vec was connected to vec of length "+num2str(vecfromlen)+ 1032 ", but vec of length "+num2str(v1.length())+" was obtained" ); 1029 1033 dl.filldown(v1,*this); 1030 1034 }; 1031 void connect(const RV &vecrv, const RV & vec1){dl.set_connection(vecrv,vec1);set_length(vecrv._dsize());}; 1035 void connect(const RV &vecrv, const RV & vec1){ 1036 bdm_assert(vecrv._dsize()==length(),"Description of this vector, "+ vecrv.to_string() +" does not math it length: " + num2str(length())); 1037 dl.set_connection(vecrv,vec1); 1038 bdm_assert(dl._downsize()==length(), "Rv of this vector, "+vecrv.to_string() +" was not found in given rv: "+vec1.to_string()); 1039 }; 1032 1040 }; 1033 1041 … … 1252 1260 class BM : public root { 1253 1261 //! \var log_level_enums logfull 1254 //! TODO DOPLNIT1262 //! log full description of posterior in descriptive structure 1255 1263 1256 1264 //! \var log_level_enums logevidence 1257 //! TODO DOPLNIT1265 //! log value of eveidence in each step 1258 1266 1259 1267 //! \var log_level_enums logbounds 1260 //! TODO DOPLNIT1268 //! log lower and upper bounds of estimates 1261 1269 LOG_LEVEL(BM,logfull,logevidence,logbounds); 1262 1270 -
library/bdm/bdmerror.h
r766 r1020 48 48 #endif // if defined(NDEBUG) 49 49 50 #if defined(NDEBUG) 51 //! DO argument if in DEBUG model 52 #define DEBUG(command) ((void) 0) 53 #else 54 //! DO argument if in DEBUG model 55 #define DEBUG(command) command 56 #endif // if defined(NDEBUG) 57 50 58 //! Unconditionally throw std::runtime_error 51 59 #define bdm_error(s) \ -
library/bdm/stat/emix.h
r979 r1020 476 476 UIREGISTER(ProdBM); 477 477 478 //! \brief class for on-line model selection 479 class ModelComparator: public ProdBM{ 480 protected: 481 multiBM weights; 482 public: 483 void bayes(const vec &yt, const vec &cond){ 484 vec w_nn(no_bms()); 485 for (int i=0; i<no_bms(); i++){ 486 bm(i)->bayes(yt,cond); 487 w_nn(i) += bm(i)->_ll(); 488 } 489 vec w=exp(w_nn-max(w_nn)); 490 weights.bayes(w/sum(w)); 491 } 492 void validate(){ 493 ProdBM::validate(); 494 weights.validate(); 495 } 496 void from_setting(const Setting& set){ 497 ProdBM::from_setting(set); 498 UI::get(weights.frg, set, "frg",UI::optional); 499 } 500 void to_setting(Setting& set) const{ 501 ProdBM::to_setting(set); 502 UI::save(weights.frg, set, "frg"); 503 } 504 }; 505 478 506 } 479 507 #endif //MX_H -
library/bdm/stat/exp_family.h
r1015 r1020 76 76 //! Estimator for Exponential family 77 77 class BMEF : public BM { 78 protected:78 public: 79 79 //! forgetting factor 80 80 double frg; 81 protected: 81 82 //! cached value of lognc() in the previous step (used in evaluation of \c ll ) 82 83 double last_lognc;