Changeset f558270 in tol


Ignore:
Timestamp:
May 15, 2009, 7:50:02 AM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
f9901a8
Parents:
b81b266
Message:

A master is now a block

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@1015 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol/stdlib/math/stat/models/bayesian/bysMcmc/bsr/gibbs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tol/stdlib/math/stat/models/bayesian/bysMcmc/bsr/gibbs/_basicMaster.tol

    rb81b266 rf558270  
    1111MasterSampler BasicMaster(BSR.ModelDef modelDef,
    1212                          McmcPartialHandler mcmcPartialHandler,
     13                          Real numBlock,
     14                          Real firstCol,
    1315                          Config config)
    1416//////////////////////////////////////////////////////////////////////////////
    1517{
     18  Text name = modelDef->DocInfo->Model.Name;
    1619  BysMcmc::MasterSampler master = [[
    17 
    18   //Full MCMC partial sampling handler
    19   BysMcmc::McmcPartialHandler _.mcmcPartialHandler = mcmcPartialHandler;
    20 
    21   //--------------------------------------------------------------------------
    22   // Configuration members
    23   //--------------------------------------------------------------------------
    24   BysMcmc::Config _.config = config;
    2520
    2621  //--------------------------------------------------------------------------
    … …  
    3530  VMatrix _.Y = _.modelDef->Y;
    3631
    37   Text _.name = _.modelDef->DocInfo->Model.Name; 
     32  BysMcmc::McmcPartialHandler _.mcmcPartialHandler = mcmcPartialHandler;
    3833
    3934  Text get.name(Real unused)
    … …  
    5146
    5247  //Setting NameBlock description
    53   Text _.autodoc.description="Gibbs sampler for model "+_.name;
    54   Text _MID = "[BSR."+_.name+"] ";
     48  Text _.autodoc.description="Gibbs sampler for model "+name;
    5549
    5650  BysMcmc::Bsr::Gibbs::StdLinearBlock _.mln.blk =
    5751  BysMcmc::Bsr::Gibbs::MainLinearBlock
    5852  (
    59     "BSR.MainLinBlock."+_.name,
     53    "BSR.MainLinBlock."+name,
    6054    EvalSet(_.modelDef->LinearBlock, Text(BSR.LinearBlock b){ b->Name }),
    61     _.mcmcPartialHandler,
     55    mcmcPartialHandler,
    6256    1,
    63     1,
    64     _.config
     57    firstCol,
     58    config
    6559  );
    6660
    … …  
    6862  BysMcmc::Bsr::Gibbs::SigmaBlock
    6963  (
    70     "BSR.SigmaBlock."+_.name,
     64    "BSR.SigmaBlock."+name,
    7165    _.modelDef->NoiseDistrib,
    72     _.mcmcPartialHandler,
     66    mcmcPartialHandler,
    7367    2,
    7468    _.mln.blk::_.lastCol+1,
    75     _.config
     69    config
    7670  );
    7771
    … …  
    7973  BysMcmc::Bsr::Gibbs::ArimaBlock
    8074  (
    81     "BSR.ArimaBlock."+_.name,
     75    "BSR.ArimaBlock."+name,
    8276    _.modelDef->NoiseDistrib,
    83     _.mcmcPartialHandler,
     77    mcmcPartialHandler,
    8478    3,
    8579    _.sig.blk::_.lastCol+1,
    86     _.config
     80    config
    8781  );
    8882
    … …  
    9084  BysMcmc::Bsr::Gibbs::InputMissingBlock
    9185  (
    92     "BSR.InputMissingBlock."+_.name,
     86    "BSR.InputMissingBlock."+name,
    9387    _.modelDef->InputMissingBlock,
    94     _.mcmcPartialHandler,
     88    mcmcPartialHandler,
    9589    4,
    9690    _.arm.blk::_.lastCol+1,
    97     _.config
     91    config
    9892  );
    9993
    … …  
    10195  BysMcmc::Bsr::Gibbs::OutputMissingBlock
    10296  (
    103     "BSR.OutputMissingBlock."+_.name,
     97    "BSR.OutputMissingBlock."+name,
    10498    _.modelDef->OutputMissingBlock,
    105     _.mcmcPartialHandler,
     99    mcmcPartialHandler,
    106100    5,
    107101    _.inpMis.blk::_.lastCol+1,
    108     _.config
     102    config
    109103  );
    110104
    … …  
    117111    _.outMis.blk
    118112  ]];
     113
     114  Real _defined = define(
     115    name,
     116    get.colNames(0),
     117    _.mcmcPartialHandler,
     118    numBlock,
     119    firstCol,
     120    config);
    119121
    120122  //Output filtered by missing values
    … …  
    272274  {
    273275  //WriteLn("TRACE "+_.name+"::setStore("<<Rows(values)+"x"<<Columns(values)+")");   
     276    putStore(values);
    274277    setStore.blocks(values)
    275278  };
    … …  
    356359      {
    357360        Real _.mln.blk::_.buildWorkSpace(_Y, _X, _.arm.blk)
    358      });
    359      _.mln.blk::get.draw(numSim, False)
    360    });
     361      });
     362      _.mln.blk::get.draw(numSim, False)
     363    });
    361364  //WriteLn("TRACE"+_MID+" draw.sig.lin 6 _.beta="<<_.beta);
    362     _.beta << sig << arm << im << om
     365    VMatrix param = _.beta << sig << arm << im << om;
     366    Real putStoreV(param);
     367    param
    363368  };
    364369
  • tol/stdlib/math/stat/models/bayesian/bysMcmc/bsr/gibbs/_nonLinMaster.tol

    rb81b266 rf558270  
    1212                           McmcPartialHandler mcmcPartialHandler,
    1313                           Set nonLinFilter,
     14                           Real numBlock,
     15                           Real firstCol,
    1416                           Config config)
    1517//////////////////////////////////////////////////////////////////////////////
    1618{
     19  Text name = modelDef->DocInfo->Model.Name;
    1720  BysMcmc::MasterSampler master = [[
    1821
    … …  
    2023  BysMcmc::McmcPartialHandler _.mcmcPartialHandler = mcmcPartialHandler;   
    2124
    22   BysMcmc::Config _.config = config;
    2325  //--------------------------------------------------------------------------
    2426  // Read only members
    … …  
    2628  //The basic BSR master
    2729  BysMcmc::MasterSampler _.bsrMst = BysMcmc::Bsr::Gibbs::BasicMaster(
    28     modelDef, mcmcPartialHandler, config);
    29   //Model identifier is inherited from basic BSR
    30   Text _.name = modelDef->DocInfo->Model.Name; 
     30    modelDef, mcmcPartialHandler, numBlock, firstCol, config);
    3131
    3232  Text get.name(Real unused)
    … …  
    4444
    4545  //Setting NameBlock description
    46   Text _.autodoc.description="Gibbs sampler for model "+_.name;
    47   //Identifier prefix for messages
    48   Text _MID = "[NLBSR."+_.name+"] ";
    49   //The basic BSR master used as a block
    50   BysMcmc::BlockSampler _.bsrBlk = BysMcmc::Bsr::Gibbs::BsrAsBlock
    51   (
    52     _.bsrMst,
    53     1,
    54     1,
    55     config
    56   );
     46  Text _.autodoc.description="Gibbs sampler for model "+name;
    5747  //The non linear blocks created from given filters
    5848  Set _.nonLinBlk =
    5949  {
    60   //WriteLn("TRACE "+_MID+"::_.nonLinBlk 1 Card(nonLinFilter)="<<Card(nonLinFilter));
    61     Real firstCol = Card(_.bsrMst::get.colNames(0))+1;
    62   //WriteLn("TRACE "+_MID+"::_.nonLinBlk 2 firstCol="<<firstCol);
     50    Real nextCol = _.bsrMst::_.N+firstCol;
    6351    Set aux = For(1,Card(nonLinFilter), NameBlock(Real numBlk)
    6452    {
    65     //WriteLn("TRACE "+_MID+"::_.nonLinBlk 3.1 numBlk="<<numBlk);
    6653      NameBlock nlf = nonLinFilter[numBlk];
    6754      BysMcmc::BlockSampler nlb = BysMcmc::Bsr::Gibbs::NonLinBlock
    … …  
    6956        nlf,
    7057        _.bsrMst,
    71         numBlk+1,
    72         firstCol,
     58        numBlk+numBlock,
     59        nextCol,
    7360        config
    7461      );
    … …  
    7865        1
    7966      });
    80       Real firstCol := nlb::_.lastCol+1;
     67      Real nextCol := nlb::_.lastCol+1;
    8168      Eval(ToName(nlb::_.name)+"=nlb")
    8269    });
    … …  
    8471  };
    8572  //All blocks in expected order
    86   Set _.blocks = [[ _.bsrBlk ]] << _.nonLinBlk;
     73  Set _.blocks = [[ _.bsrMst ]] << _.nonLinBlk;
     74
     75  Real _defined = define(
     76    name,
     77    get.colNames(0);
     78    _.mcmcPartialHandler,
     79    numBlock,
     80    firstCol,
     81    config);
    8782
    8883  ////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.