Changeset 211 for bdm/stat/emix.h

Show
Ignore:
Timestamp:
11/13/08 20:00:53 (16 years ago)
Author:
smidl
Message:

prejmenovani evalpdflog a evalcond

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bdm/stat/emix.h

    r204 r211  
    3232In particular this type of arise by conditioning of a mixture model. 
    3333 
    34 At present the only supported operation is evalcond(). 
     34At present the only supported operation is evallogcond(). 
    3535 */ 
    3636class mratio: public mpdf { 
     
    6060                den = nom->marginal ( rvc ); 
    6161        }; 
    62         double evalcond ( const vec &val, const vec &cond ) { 
     62        double evallogcond ( const vec &val, const vec &cond ) { 
    6363                vec nom_val ( rv.count() +rvc.count() ); 
    6464                dl.fill_val_cond ( nom_val,val,cond ); 
    65                 return exp ( nom->evalpdflog ( nom_val ) - den->evalpdflog ( cond ) ); 
     65                return exp ( nom->evallog ( nom_val ) - den->evallog ( cond ) ); 
    6666        } 
    6767        //! Object takes ownership of nom and will destroy it 
     
    102102                return mu; 
    103103        } 
    104         double evalpdflog ( const vec &val ) const { 
     104        double evallog ( const vec &val ) const { 
    105105                int i; 
    106106                double sum = 0.0; 
    107                 for ( i = 0;i < w.length();i++ ) {sum += w ( i ) * exp ( Coms ( i )->evalpdflog ( val ) );} 
     107                for ( i = 0;i < w.length();i++ ) {sum += w ( i ) * exp ( Coms ( i )->evallog ( val ) );} 
    108108                return log ( sum ); 
    109109        }; 
    110         vec evalpdflog_m ( const mat &Val ) const { 
     110        vec evallog_m ( const mat &Val ) const { 
    111111                vec x=zeros ( Val.cols() ); 
    112112                for ( int i = 0; i < w.length(); i++ ) { 
    113                         x+= w ( i ) *exp ( Coms ( i )->evalpdflog_m ( Val ) ); 
     113                        x+= w ( i ) *exp ( Coms ( i )->evallog_m ( Val ) ); 
    114114                } 
    115115                return log ( x ); 
    116116        }; 
    117         mat evalpdflog_M ( const mat &Val ) const { 
     117        mat evallog_M ( const mat &Val ) const { 
    118118                mat X ( w.length(), Val.cols() ); 
    119119                for ( int i = 0; i < w.length(); i++ ) { 
    120                         X.set_row ( i, w ( i ) *exp ( Coms ( i )->evalpdflog_m ( Val ) ) ); 
     120                        X.set_row ( i, w ( i ) *exp ( Coms ( i )->evallog_m ( Val ) ) ); 
    121121                } 
    122122                return X; 
     
    166166        }; 
    167167 
    168         double evalcond ( const vec &val, const vec &cond ) { 
     168        double evallogcond ( const vec &val, const vec &cond ) { 
    169169                int i; 
    170170                double res = 1.0; 
     
    174174                                                } 
    175175                                                // add logarithms 
    176                                                 res += epdfs ( i )->evalpdflog ( dls ( i )->get_val ( val ) );*/ 
    177                         res *= mpdfs ( i )->evalcond ( 
     176                                                res += epdfs ( i )->evallog ( dls ( i )->get_val ( val ) );*/ 
     177                        res *= mpdfs ( i )->evallogcond ( 
    178178                                   dls ( i )->get_val ( val ), 
    179179                                   dls ( i )->get_cond ( val, cond ) 
     
    196196                        dls ( i )->fill_val ( smp, smpi ); 
    197197                        // add ith likelihood contribution 
    198                         ll+=epdfs ( i )->evalpdflog ( smpi ); 
     198                        ll+=epdfs ( i )->evallog ( smpi ); 
    199199                } 
    200200                return smp; 
     
    244244                return tmp; 
    245245        } 
    246         double evalpdflog ( const vec &val ) const { 
     246        double evallog ( const vec &val ) const { 
    247247                double tmp=0; 
    248248                for ( int i=0;i<epdfs.length();i++ ) { 
    249                         tmp+=epdfs ( i )->evalpdflog ( dls ( i )->get_val ( val ) ); 
     249                        tmp+=epdfs ( i )->evallog ( dls ( i )->get_val ( val ) ); 
    250250                } 
    251251                return tmp;