Changeset 1068

Show
Ignore:
Timestamp:
06/09/10 18:35:14 (14 years ago)
Author:
mido
Message:

patch of documentation - all conditional pdfs revised

Location:
library/bdm
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/base/bdmbase.h

    r1066 r1068  
    694694        dimc = d; 
    695695    } 
    696     //! Load from structure with elements: 
    697     //!  \code 
    698     //! { class = "pdf_offspring", 
    699     //!   rv = {class="RV", names=(...),}; // RV describing meaning of random variable 
    700     //!   rvc= {class="RV", names=(...),}; // RV describing meaning of random variable in condition 
    701     //!   // elements of offsprings 
    702     //! } 
    703     //! \endcode 
    704     //!@} 
     696 
     697    /*! Create object from the following structure 
     698    \code 
     699    class = 'pdf'; 
     700    --- optional fields --- 
     701    rv = RV({'names',...},[sizes,...],[times,...]);  % description of the random variable - typically delayed values, time=-1, etc.!     
     702    rvc= RV({'names',...},[sizes,...],[times,...]);  % description of the random variable in condition 
     703    --- inherited fields --- 
     704    bdm::root::from_setting 
     705    \endcode 
     706    */ 
     707    //! @} 
    705708    void from_setting ( const Setting &set ); 
    706709 
  • library/bdm/estim/particles.h

    r1066 r1068  
    2828    shared_ptr<BM> bm; 
    2929 
    30     // custom posterior - product of empirical and exact part 
     30    //! \brief Internal class for custom posterior - product of empirical and exact part 
    3131    class eprod_2:public eprod_base { 
    3232    protected: 
  • library/bdm/stat/emix.cpp

    r1064 r1068  
    133133 
    134134 
    135 void    emix::validate () { 
     135void     emix::validate () { 
    136136    emix_base::validate(); 
    137137    dim = Coms ( 0 )->dimension(); 
     
    143143    double res = 0.0; 
    144144    for ( i = pdfs.length() - 1; i >= 0; i-- ) { 
    145         /*                      if ( pdfs(i)->_rvc().count() >0) { 
    146                                         pdfs ( i )->condition ( dls ( i )->get_cond ( val,cond ) ); 
    147                                 } 
    148                                 // add logarithms 
    149                                 res += epdfs ( i )->evallog ( dls ( i )->pushdown ( val ) );*/ 
     145        /*            if ( pdfs(i)->_rvc().count() >0) { 
     146                        pdfs ( i )->condition ( dls ( i )->get_cond ( val,cond ) ); 
     147                    } 
     148                    // add logarithms 
     149                    res += epdfs ( i )->evallog ( dls ( i )->pushdown ( val ) );*/ 
    150150        res += pdfs ( i )->evallogcond ( 
    151151                   dls ( i )->pushdown ( val ), 
     
    198198    set_elements ( temp_array ); 
    199199} 
    200 void    mprod::to_setting  (Setting  &set) const { 
     200void     mprod::to_setting  (Setting  &set) const { 
    201201    pdf::to_setting(set); 
    202202    UI::save( pdfs, set, "pdfs"); 
     
    243243} 
    244244 
    245 void    mmix::to_setting  (Setting  &set) const { 
     245void     mmix::to_setting  (Setting  &set) const { 
    246246    pdf::to_setting(set); 
    247247    UI::save( Coms, set, "pdfs"); 
  • library/bdm/stat/emix.h

    r1066 r1068  
    2424 
    2525/*! \brief Class representing ratio of two densities 
     26 
    2627which arise e.g. by applying the Bayes rule. 
    2728It represents density in the form: 
     
    266267    } 
    267268 
    268     //! Load from structure with elements: 
    269     //!  \code 
    270     //! { class='mprod'; 
    271     //!   pdfs = (..., ...);     // list of pdfs in the order of chain rule 
    272     //! } 
     269    //! Create object from the following structure 
     270    //! \code 
     271    //! class='mprod'; 
     272    //! pdfs = { list of bdm::pdf };          % list of bdm::pdf offsprings stored in the order of chain rule, bdm::pdf::from_setting 
     273    //! --- inherited fields --- 
     274    //! bdm::pdf::from_setting 
    273275    //! \endcode 
    274276    //!@} 
    275277    void from_setting ( const Setting &set ) ; 
    276     void     to_setting  (Setting  &set) const; 
    277  
    278  
     278    void to_setting  (Setting  &set) const;     
    279279}; 
    280280UIREGISTER ( mprod ); 
     
    370370UIREGISTER(eprod); 
    371371 
    372 //! \brief Internal class similar to eprod - factors are external pointers. To be used only internally!   
     372//! \brief Internal class similar to eprod - factors are external pointers. To be used internally!   
    373373class eprod_internal: public eprod_base { 
    374374protected: 
     
    409409    vec samplecond ( const vec &cond ); 
    410410 
    411     //! Load from structure with elements: 
    412     //!  \code 
    413     //! { class='mmix'; 
    414     //!   pdfs = (..., ...);     // list of pdfs in the mixture 
    415     //!   weights = ( 0.5, 0.5 ); // weights of pdfs in the mixture 
    416411    //! } 
    417412    //! \endcode 
    418413    //!@} 
     414    
     415    /*! Create object from the following structure 
     416    \code 
     417    class = 'mmix'; 
     418    pdfs = { list of components bdm::pdf };          % list of pdf offsprings, bdm::pdf::from_setting 
     419    --- optional fields --- 
     420    weights = [...];                                 % weights of pdfs in the mixture 
     421    --- inherited fields --- 
     422    bdm::pdf::from_setting 
     423    \endcode 
     424    \endcode 
     425    If the optional fields are not given, they will be filled as follows: 
     426    \code 
     427    weights = 1/n * [1,1,1,...]; 
     428    \endcode 
     429    */ 
    419430    void from_setting ( const Setting &set ); 
    420431    void     to_setting  (Setting  &set) const; 
     
    430441    Array<vec_from_vec> bm_yt; 
    431442    Array<vec_from_2vec> bm_cond; 
     443 
     444    //! \brief Internal class 
    432445    class eprod_bm : public eprod_base { 
    433446        ProdBMBase & pb; 
  • library/bdm/stat/exp_family.cpp

    r1064 r1068  
    134134 
    135135    double m = nu - nPsi - dimx - 1; 
    136 #define log2  0.693147180559945286226763983 
    137 #define logpi 1.144729885849400163877476189 
     136#define    log2  0.693147180559945286226763983 
     137#define    logpi 1.144729885849400163877476189 
    138138#define log2pi 1.83787706640935 
    139139#define Inf std::numeric_limits<double>::infinity() 
     
    149149                 - 0.5 * dimx * ( m * log2 + 0.5 * ( dimx - 1 ) * log2pi )  - lg; 
    150150 
    151 //      bdm_assert_debug ( ( ( -nkG - nkW ) > -Inf ) && ( ( -nkG - nkW ) < Inf ), "ARX improper" ); 
     151//    bdm_assert_debug ( ( ( -nkG - nkW ) > -Inf ) && ( ( -nkG - nkW ) < Inf ), "ARX improper" ); 
    152152    if ( -nkG - nkW == Inf ) { 
    153153        cout << "??" << endl; 
     
    186186        M = iLsub * Lpsi; 
    187187    } 
    188     /*  if ( 0 ) { // test with Peterka 
    189                 mat VF = V.to_mat(); 
    190                 mat Vf = VF ( 0, dimx - 1, 0, dimx - 1 ); 
    191                 mat Vzf = VF ( dimx, end, 0, dimx - 1 ); 
    192                 mat VZ = VF ( dimx, end, dimx, end ); 
    193  
    194                 mat Lam2 = Vf - Vzf.T() * inv ( VZ ) * Vzf; 
    195         }*/ 
     188    /*    if ( 0 ) { // test with Peterka 
     189            mat VF = V.to_mat(); 
     190            mat Vf = VF ( 0, dimx - 1, 0, dimx - 1 ); 
     191            mat Vzf = VF ( dimx, end, 0, dimx - 1 ); 
     192            mat VZ = VF ( dimx, end, dimx, end ); 
     193 
     194            mat Lam2 = Vf - Vzf.T() * inv ( VZ ) * Vzf; 
     195        }*/ 
    196196} 
    197197 
     
    203203 
    204204        mat Lsub = L ( 1, end, 1, end ); 
    205 //              mat Dsub = diag ( D ( 1, end ) ); 
     205//        mat Dsub = diag ( D ( 1, end ) ); 
    206206 
    207207        ldmat LD ( inv ( Lsub ).T(), 1.0 / D ( 1, end ) ); 
     
    715715} 
    716716 
    717 void    euni::to_setting  (Setting  &set) const { 
     717void     euni::to_setting  (Setting  &set) const { 
    718718    epdf::to_setting ( set ); 
    719719    UI::save ( high, set, "high" ); 
     
    731731    pdf::from_setting(set); 
    732732    g=UI::build<fnc>(set,"g",UI::compulsory); 
    733     validate(); 
    734 } 
     733} 
     734 
    735735void mgdirac::to_setting(Setting &set) const { 
    736736    pdf::to_setting(set); 
    737737    UI::save(g.get(), set, "g"); 
    738738} 
     739 
    739740void mgdirac::validate() { 
    740741    pdf::validate(); 
  • library/bdm/stat/exp_family.h

    r1066 r1068  
    124124}; 
    125125 
    126 /*! Dirac delta density with predefined transformation 
     126/*! \brief Dirac delta density with predefined transformation 
    127127 
    128128Density of the type:\f[ f(x_t | y_t) = \delta (x_t - g(y_t)) \f] 
     
    141141        return std::numeric_limits< double >::max(); 
    142142    } 
     143 
     144    /*! Create object from the following structure 
     145 
     146    \code 
     147    class = 'mgdirac'; 
     148    g = function bdm::fnc;      % any offspring of fnc, bdm::fnc::from_setting 
     149    --- inherited fields --- 
     150    bdm::pdf::from_setting 
     151    \endcode 
     152    */ 
    143153    void from_setting(const Setting& set); 
    144154    void to_setting(Setting &set) const; 
     
    666676UIREGISTER ( eBeta ); 
    667677 
    668 /*! Random Walk on Dirichlet 
     678/*! \brief Random Walk on Dirichlet 
     679 
    669680Using simple assignment 
    670681 \f[ \beta = rvc / k + \beta_c \f] 
     
    676687 By default is it set to 0.1; 
    677688*/ 
    678  
    679689class mDirich: public pdf_internal<eDirich> { 
    680690protected: 
     
    690700        _beta =  val / k + betac; 
    691701    }; 
    692     /*! Create Dirichlet random walk 
    693     \f[ f(rv|rvc) = Di(rvc*k) \f] 
    694     from structure 
     702 
     703    /*! Create object from the following structure 
    695704    \code 
    696705    class = 'mDirich'; 
    697     k = 1;                      // multiplicative constant k 
     706    k = 1;                      % multiplicative constant k 
    698707    --- optional --- 
    699     rv = RV({'name'},size)      // description of RV 
    700     beta0 = [];                 // initial value of beta 
    701     betac = [];                 // initial value of beta 
     708    beta0 = [...];              % initial values of beta 
     709    betac = [...];              % initial values of beta stabilizing coefficients 
     710    --- inherited fields --- 
     711    bdm::pdf::from_setting 
     712    \endcode 
     713    fulfilling form  \f[ f(rv|rvc) = Di(rvc*k) \f] 
     714 
     715    If the optional fields are not given, they will be filled as follows: 
     716    \code 
     717    beta0 = [1,1,1,...];                 
     718    betac = 0.1 * [1,1,1,...]; 
    702719    \endcode 
    703720    */ 
     
    709726 
    710727/*! \brief Random Walk with vector Beta distribution 
     728 
    711729Using simple assignment 
    712730\f{eqnarray*} 
     
    733751    }; 
    734752 
    735     /*! Create Beta random walk 
    736     \f[ f(rv|rvc) = \prod Beta(rvc,k) \f] 
    737     from structure 
     753    /*! Create object from the following structure 
    738754    \code 
    739755    class = 'mBeta'; 
    740     k = 1;                      // multiplicative constant k 
    741     --- optional --- 
    742     rv = RV({'name'},size)      // description of RV 
    743     beta  = [];                 // initial value of beta 
    744     betac = [];                 // initial value of beta stabilizing constant 
     756    k = [...];          % vector of multiplicative constants k 
     757    --- optional fields --- 
     758    beta  = [...];      % initial values of beta 
     759    betac = [...];      % initial values of beta stabilizing constants 
     760    --- inherited fields --- 
     761    bdm::pdf::from_setting 
    745762    \endcode 
     763    fulfilling form \f[ f(rv|rvc) = \prod Beta(rvc,k) \f] 
     764 
     765    If the optional fields are not given, they will be filled as follows: 
     766    \code 
     767    beta  = [1,1,1,...]; 
     768    betac = 0.1 * [1,1,1,...]; 
     769    \endcode 
     770     
    746771    */ 
    747772    void from_setting ( const Setting &set ); 
     
    928953*/ 
    929954 
    930 //!  Uniform distributed density on a rectangular support 
    931  
     955//! \brief Uniform distributed density on a rectangular support 
    932956class euni: public epdf { 
    933957protected: 
     
    9761000        return ( pow ( high, 2 ) + pow ( low, 2 ) + elem_mult ( high, low ) ) / 3.0; 
    9771001    } 
    978     /*! Create Uniform density 
    979     \f[ f(rv) = U(low,high) \f] 
    980     from structure 
     1002 
     1003 
     1004     /*! Create object from the following structure 
    9811005     \code 
     1006     
    9821007     class = 'euni' 
    983      high = [...];          // vector of upper bounds 
    984      low = [...];           // vector of lower bounds 
    985      rv = RV({'name'});     // description of RV 
     1008     high = [...];          % vector of upper bounds 
     1009     low = [...];           % vector of lower bounds      
     1010      rv = RV({'names',...},[sizes,...],[times,...]);   % description of RV 
     1011     --- inherited fields --- 
     1012     bdm::epdf::from_setting 
    9861013     \endcode 
     1014 
     1015     fulfilling form \f[ f(rv) = U(low,high) \f] 
    9871016     */ 
    9881017    void from_setting ( const Setting &set ); 
     
    10031032        iepdf.set_parameters ( mea - delta, mea + delta ); 
    10041033    } 
    1005     //! load from 
     1034 
     1035    /*! Create object from the following structure 
     1036    \code 
     1037    class = 'mguni'; 
     1038    mean = function bdm::fnc;       % any offspring of fnc, bdm::fnc::from_setting 
     1039    delta = [...];                  % distance from mean to both sides 
     1040    --- inherited fields --- 
     1041    bdm::pdf::from_setting 
     1042    \endcode 
     1043    */ 
    10061044    void from_setting ( const Setting &set ) { 
    10071045        pdf::from_setting ( set ); //reads rv and rvc 
     
    12041242 
    12051243 
    1206 /*! (Approximate) Student t density with linear function of mean value 
     1244/*! \brief (Approximate) Student t density with linear function of mean value 
    12071245 
    12081246The internal epdf of this class is of the type of a Gaussian (enorm). 
     
    12711309        _beta = k / val; 
    12721310    }; 
    1273     /*! Create Gamma density with conditional mean value 
    1274     \f[ f(rv|rvc) = \Gamma(k, k/rvc) \f] 
    1275     from structure 
     1311 
     1312    /*! Create object from the following structure 
    12761313    \code 
    1277       class = 'mgamma'; 
    1278       beta = [...];          // vector of initial alpha 
    1279       k = 1.1;               // multiplicative constant k 
    1280       rv = RV({'name'})      // description of RV 
    1281       rvc = RV({'name'})     // description of RV in condition 
    1282      \endcode 
     1314    class = 'mgamma';     
     1315    beta = [...];      % vector of initial beta 
     1316    k = x;             %  multiplicative scalar constant k 
     1317    --- inherited fields --- 
     1318    bdm::pdf::from_setting 
     1319    \endcode 
     1320    fulfilling form \f[ f(rv|rvc) = \Gamma(k, k/rvc) \f] 
    12831321    */ 
    12841322    void from_setting ( const Setting &set ); 
     
    13401378    }; 
    13411379}; 
    1342  
    13431380 
    13441381/*! 
     
    13691406    }; 
    13701407 
    1371     void     validate () { 
     1408    void validate () { 
    13721409        mgamma::validate(); 
    13731410        dimc = dimension(); 
     
    14201457    }; 
    14211458 
    1422  
    1423     /*! Create inverse-Gamma density with conditional mean value 
    1424     \f[ f(rv|rvc) = i\Gamma(k, k/(rvc^l \circ ref^{(1-l)}) \f] 
    1425     from structure 
     1459    /*! Create object from the following structure 
    14261460    \code 
    14271461    class = 'migamma_ref'; 
    1428     ref = [1e-5; 1e-5; 1e-2 1e-3];            // reference vector 
    1429     l = 0.999;                                // constant l 
    1430     k = 0.1;                                  // constant k 
    1431     rv = RV({'name'})                         // description of RV 
    1432     rvc = RV({'name'})                        // description of RV in condition 
     1462    ref = [...];           % reference vector 
     1463    l = [];                % constant scalar l 
     1464    k = [];                % constant scalar k     
     1465    --- inherited fields --- 
     1466    bdm::migamma::from_setting 
    14331467    \endcode 
     1468    fulfilling form \f[ f(rv|rvc) = i\Gamma(k, k/(rvc^l \circ ref^{(1-l)}) \f] 
    14341469     */ 
    14351470    void from_setting ( const Setting &set ); 
     
    14421477SHAREDPTR ( migamma_ref ); 
    14431478 
    1444 /*! Log-Normal probability density 
    1445  only allow diagonal covariances! 
     1479/*! \brief Log-Normal probability density - it allows only diagonal covariances! 
    14461480 
    14471481Density of the form \f$ \log(x)\sim \mathcal{N}(\mu,\sigma^2) \f$ , i.e. 
     
    14991533    }; 
    15001534 
    1501     /*! Create logNormal random Walk 
    1502     \f[ f(rv|rvc) = log\mathcal{N}( \log(rvc)-0.5\log(k^2+1), k I) \f] 
    1503     from structure 
     1535    /*! Create object from the following structure 
    15041536    \code 
    15051537    class = 'mlognorm'; 
    1506     k   = 0.1;               // "variance" k 
    1507     mu0 = 0.1;               // Initial value of mean 
    1508     rv  = RV({'name'})       // description of RV 
    1509     rvc = RV({'name'})       // description of RV in condition 
     1538    k   = [];               % "variance" k 
     1539    mu0 = [];               % initial value of mean 
     1540    --- inherited fields --- 
     1541    bdm::pdf_internal<elognorm>::from_setting 
    15101542    \endcode 
     1543    fulfilling form \f[ f(rv|rvc) = log\mathcal{N}( \log(rvc)-0.5\log(k^2+1), k I) \f] 
    15111544    */ 
    15121545    void from_setting ( const Setting &set ); 
     
    15181551SHAREDPTR ( mlognorm ); 
    15191552 
    1520 /*! inverse Wishart density defined on Choleski decomposition 
    1521  
     1553/*! \brief Inverse Wishart density defined on Choleski decomposition 
    15221554*/ 
    15231555class eWishartCh : public epdf { 
  • library/bdm/stat/merger.cpp

    r1064 r1068  
    160160    vec mea = mean(); 
    161161 
    162 //                      cout << sum (w) << "," << w*w << endl; 
     162//             cout << sum (w) << "," << w*w << endl; 
    163163 
    164164    mat Tmp = zeros ( dim, dim ); 
     
    174174} 
    175175 
     176 
     177void merger_base::from_setting ( const Setting& set ) { 
     178    // get support 
     179    // find which method to use 
     180    epdf::from_setting (set); 
     181    string meth_str; 
     182    UI::get( meth_str, set, "method", UI::compulsory ); 
     183    if ( meth_str == "arithmetic" ) 
     184        set_method ( ARITHMETIC ); 
     185    else if ( meth_str == "geometric" ) 
     186        set_method ( GEOMETRIC ); 
     187    else if ( meth_str ==  "lognormal" ) { 
     188        set_method ( LOGNORMAL ); 
     189        UI::get(beta, set, "beta", UI::compulsory ); 
     190    } 
     191 
     192 
     193    string dbg_filename; 
     194    if ( UI::get ( dbg_filename, set, "dbg_file" ) ) 
     195        set_debug_file( dbg_filename ); 
     196 
     197} 
     198 
     199void merger_base::to_setting  (Setting  &set) const { 
     200    epdf::to_setting(set); 
     201 
     202    UI::save( METHOD, set, "method"); 
     203 
     204    if( METHOD == LOGNORMAL ) 
     205        UI::save (beta, set, "beta" ); 
     206 
     207    if( DBG ) 
     208        UI::save ( dbg_file->get_fname(), set, "dbg_file" ); 
     209} 
     210 
     211void merger_base::validate() { 
     212//        bdm_assert ( eSmp._w().length() > 0, "Empty support, use set_support()." ); 
     213//        bdm_assert ( dim == eSmp._samples() ( 0 ).length(), "Support points and rv are not compatible!" ); 
     214    epdf::validate(); 
     215    bdm_assert ( isnamed(), "mergers must be named" ); 
     216} 
     217 
     218// DEFAULTS FOR MERGER_BASE 
     219const MERGER_METHOD merger_base::DFLT_METHOD = LOGNORMAL; 
     220const double merger_base::DFLT_beta = 1.2; 
     221 
    176222void merger_mix::merge ( ) { 
    177223    if(Npoints<1) { 
     
    190236    } 
    191237 
    192     if ( DBG )  *dbg_file << Name ( "Smp_0" ) << Smp_ex; 
     238    if ( DBG )    *dbg_file << Name ( "Smp_0" ) << Smp_ex; 
    193239 
    194240    // Stuff for merging 
    195     vec lw_src ( Npoints );             // weights of the ith source 
    196     vec lw_mix ( Npoints );             // weights of the approximating mixture 
    197     vec lw ( Npoints );                 // tmp 
     241    vec lw_src ( Npoints );        // weights of the ith source 
     242    vec lw_mix ( Npoints );        // weights of the approximating mixture 
     243    vec lw ( Npoints );            // tmp 
    198244    mat lW = zeros ( Nsources, Npoints ); // array of weights of all sources 
    199245    vec vec0 ( 0 ); 
     
    285331                    } 
    286332 
    287 //                                      sprintf ( str,"marg%d",niter ); 
    288 //                                      *dbg << Name ( str ) << lw_src; 
     333//                     sprintf ( str,"marg%d",niter ); 
     334//                     *dbg << Name ( str ) << lw_src; 
    289335 
    290336                } 
     
    345391    } 
    346392    delete Mpred; 
    347 //              cout << endl; 
     393//        cout << endl; 
    348394 
    349395} 
     
    359405} 
    360406 
    361 void    merger_mix::to_setting  (Setting  &set) const  { 
     407void merger_mix::to_setting  (Setting  &set) const  { 
    362408    merger_base::to_setting(set); 
    363409    UI::save( Ncoms, set, "ncoms"); 
     
    371417} 
    372418 
    373 void merger_base::from_setting ( const Setting& set ) { 
    374     // get support 
    375     // find which method to use 
    376     epdf::from_setting (set); 
    377     string meth_str; 
    378     UI::get( meth_str, set, "method", UI::compulsory ); 
    379     if ( meth_str == "arithmetic" ) 
    380         set_method ( ARITHMETIC ); 
    381     else if ( meth_str == "geometric" ) 
    382         set_method ( GEOMETRIC ); 
    383     else if ( meth_str ==  "lognormal" ) { 
    384         set_method ( LOGNORMAL ); 
    385         UI::get(beta, set, "beta", UI::compulsory ); 
    386     } 
    387  
    388  
    389     string dbg_filename; 
    390     if ( UI::get ( dbg_filename, set, "dbg_file" ) ) 
    391         set_debug_file( dbg_filename ); 
    392  
    393 } 
    394  
    395 void merger_base::to_setting  (Setting  &set) const { 
    396     epdf::to_setting(set); 
    397  
    398     UI::save( METHOD, set, "method"); 
    399  
    400     if( METHOD == LOGNORMAL ) 
    401         UI::save (beta, set, "beta" ); 
    402  
    403     if( DBG ) 
    404         UI::save ( dbg_file->get_fname(), set, "dbg_file" ); 
    405 } 
    406  
    407 void merger_base::validate() { 
    408 //              bdm_assert ( eSmp._w().length() > 0, "Empty support, use set_support()." ); 
    409 //              bdm_assert ( dim == eSmp._samples() ( 0 ).length(), "Support points and rv are not compatible!" ); 
    410     epdf::validate(); 
    411     bdm_assert ( isnamed(), "mergers must be named" ); 
    412 } 
    413  
    414 // DEFAULTS FOR MERGER_BASE 
    415 const MERGER_METHOD merger_base::DFLT_METHOD = LOGNORMAL; 
    416 const double merger_base::DFLT_beta = 1.2; 
    417419// DEFAULTS FOR MERGER_MIX 
    418420const int merger_mix::DFLT_Ncoms = 10; 
  • library/bdm/stat/merger.h

    r1064 r1068  
    2525 
    2626/*! 
    27 @brief Base class for general combination of pdfs on discrete support 
     27@brief Base class (interface) for for general combination of pdfs on discrete support 
    2828 
    2929Mixtures of Gaussian densities are used internally. Switching to other densities should be trivial. 
     
    4242For merging of more general cases, use offsprings merger_mix and merger_grid. 
    4343*/ 
    44  
    4544class merger_base : public epdf { 
    4645protected: 
     
    168167    } 
    169168 
    170     //! load from setting 
     169 
     170    } 
     171 
     172    /*! Create object from the following structure 
     173 
     174    \code 
     175    class = 'merger_base'; 
     176    method = 'arithmetic' or 'geometric' or 'lognormal';   % name of the model used for merging  
     177    --- compulsory only for lognormal merging model --- 
     178    beta = x;                                              % scalar prior on the log-normal merging model 
     179    --- optional fields --- 
     180    dbg_file = '...';                                      % name of the file to store debug informations 
     181    --- inherited fields --- 
     182    bdm::epdf::from_setting 
     183    \endcode 
     184    */ 
    171185    void from_setting ( const Setting& set ); 
    172186 
     
    179193SHAREDPTR ( merger_base ); 
    180194 
    181 //! Merger using importance sampling with mixture proposal density 
     195//! \brief Merger using importance sampling with mixture proposal density 
    182196class merger_mix : public merger_base { 
    183197protected: 
     
    249263        return tmp; 
    250264    } 
    251     //! from_settings 
     265    /*! Create object from the following structure 
     266 
     267    \code 
     268    class = 'merger_mix'; 
     269    --- optional fields --- 
     270    ncoms = [];        % number of components in a mixture 
     271    effss_coef = [];   % coefficient of resampling from interval [0,1] 
     272    stop_niter = [];   % number of interations 
     273    --- inherited fields --- 
     274    bdm::merger_base::from_setting 
     275    \endcode     
     276    If the optional fields are not given, they will be filled as follows: 
     277    \code 
     278    ncoms = 10;        
     279    effss_coef = 0.9;   
     280    stop_niter = 10;   
     281    \endcode 
     282 
     283    */ 
    252284    void from_setting ( const Setting& set ); 
    253     void        to_setting  (Setting  &set) const; 
     285 
     286    void to_setting  (Setting  &set) const; 
    254287    void validate(); 
    255288 
    256289    //! @} 
    257  
    258290}; 
    259291UIREGISTER ( merger_mix );