Changeset 1020 for library/bdm/stat

Show
Ignore:
Timestamp:
05/28/10 22:50:46 (14 years ago)
Author:
smidl
Message:

DEBUG macro for conditional output + new class

Location:
library/bdm/stat
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/stat/emix.h

    r979 r1020  
    476476UIREGISTER(ProdBM); 
    477477 
     478//! \brief class for on-line model selection  
     479class 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 
    478506} 
    479507#endif //MX_H 
  • library/bdm/stat/exp_family.h

    r1015 r1020  
    7676//! Estimator for Exponential family 
    7777class BMEF : public BM { 
    78 protected: 
     78        public: 
    7979        //! forgetting factor 
    8080        double frg; 
     81        protected: 
    8182        //! cached value of lognc() in the previous step (used in evaluation of \c ll ) 
    8283        double last_lognc;