- Main Page
- Related Pages
- Classes
- Files

# work/git/mixpp/bdm/estim/mixef.h

Go to the documentation of this file.

    00001
    00013 #ifndef MEF_H
    00014 #define MEF_H
    00015
    00016 #include <itpp/itbase.h>
    00017 #include "../stat/libFN.h"
    00018 #include "../stat/libEF.h"
    00019 #include "../stat/emix.h"
    00020
    00021 using namespace itpp;
    00022
    00039 class MixEF: public BM {
    00040 protected:
    00042         int n;
    00044         Array<BMEF*> Coms;
    00046         multiBM weights;
    00048         eprod* est;
    00050
    00052         void build_est() {
    00053                 Array<const epdf*> epdfs ( n+1 );
    00054                 for ( int i=0;i<Coms.length();i++ ) {
    00055 //                      it_assert_debug(!x,"MixEF::MixEF : Incompatible components");
    00056                         epdfs ( i ) =& ( Coms ( i )->_epdf() );
    00057                 }
    00058                 // last in the product is the weight
    00059                 epdfs ( n ) =& ( weights._epdf() );
    00060                 est = new eprod ( epdfs );
    00061         }
    00062
    00063 public:
    00065         MixEF ( Array<BMEF*> &Coms0, const vec &alpha0 ) :
    00066                         BM ( RV() ), n ( Coms0.length() ), Coms ( n ),
    00067                         weights ( RV ( "{w }", vec_1 ( n ) ),alpha0 ) {
    00068                 it_assert_debug ( n>0,"MixEF::MixEF : Empty Component list" );
    00069
    00070                 for ( int i=0;i<n;i++ ) {Coms ( i ) = ( BMEF* ) Coms0 ( i )->_copy_();}
    00071                 build_est();
    00072         };
    00077         MixEF ( BMEF* Com0, const mat &Data, int c=5 );
    00078         //Destructor
    00079         ~MixEF() {
    00080                 delete est;
    00081                 for ( int i=0;i<n;i++ ) {delete Coms ( i );}
    00082         }
    00084         void bayes ( const vec &dt );
    00086         void bayes ( const mat &dt );
    00087         void bayesB ( const mat &dt );
    00088         double logpred ( const vec &dt ) const;
    00089         const epdf& _epdf() const {return *est;}
    00090 };
    00091
    00092
    00093 #endif // MEF_H
    00094
    00095