Changeset f558270 in tol
- Timestamp:
- May 15, 2009, 7:50:02 AM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- f9901a8
- Parents:
- b81b266
- Location:
- tol/stdlib/math/stat/models/bayesian/bysMcmc/bsr/gibbs
- Files:
-
- 2 edited
-
_basicMaster.tol (modified) (10 diffs)
-
_nonLinMaster.tol (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/stdlib/math/stat/models/bayesian/bysMcmc/bsr/gibbs/_basicMaster.tol
rb81b266 rf558270 11 11 MasterSampler BasicMaster(BSR.ModelDef modelDef, 12 12 McmcPartialHandler mcmcPartialHandler, 13 Real numBlock, 14 Real firstCol, 13 15 Config config) 14 16 ////////////////////////////////////////////////////////////////////////////// 15 17 { 18 Text name = modelDef->DocInfo->Model.Name; 16 19 BysMcmc::MasterSampler master = [[ 17 18 //Full MCMC partial sampling handler19 BysMcmc::McmcPartialHandler _.mcmcPartialHandler = mcmcPartialHandler;20 21 //--------------------------------------------------------------------------22 // Configuration members23 //--------------------------------------------------------------------------24 BysMcmc::Config _.config = config;25 20 26 21 //-------------------------------------------------------------------------- … … 35 30 VMatrix _.Y = _.modelDef->Y; 36 31 37 Text _.name = _.modelDef->DocInfo->Model.Name;32 BysMcmc::McmcPartialHandler _.mcmcPartialHandler = mcmcPartialHandler; 38 33 39 34 Text get.name(Real unused) … … 51 46 52 47 //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; 55 49 56 50 BysMcmc::Bsr::Gibbs::StdLinearBlock _.mln.blk = 57 51 BysMcmc::Bsr::Gibbs::MainLinearBlock 58 52 ( 59 "BSR.MainLinBlock."+ _.name,53 "BSR.MainLinBlock."+name, 60 54 EvalSet(_.modelDef->LinearBlock, Text(BSR.LinearBlock b){ b->Name }), 61 _.mcmcPartialHandler,55 mcmcPartialHandler, 62 56 1, 63 1,64 _.config57 firstCol, 58 config 65 59 ); 66 60 … … 68 62 BysMcmc::Bsr::Gibbs::SigmaBlock 69 63 ( 70 "BSR.SigmaBlock."+ _.name,64 "BSR.SigmaBlock."+name, 71 65 _.modelDef->NoiseDistrib, 72 _.mcmcPartialHandler,66 mcmcPartialHandler, 73 67 2, 74 68 _.mln.blk::_.lastCol+1, 75 _.config69 config 76 70 ); 77 71 … … 79 73 BysMcmc::Bsr::Gibbs::ArimaBlock 80 74 ( 81 "BSR.ArimaBlock."+ _.name,75 "BSR.ArimaBlock."+name, 82 76 _.modelDef->NoiseDistrib, 83 _.mcmcPartialHandler,77 mcmcPartialHandler, 84 78 3, 85 79 _.sig.blk::_.lastCol+1, 86 _.config80 config 87 81 ); 88 82 … … 90 84 BysMcmc::Bsr::Gibbs::InputMissingBlock 91 85 ( 92 "BSR.InputMissingBlock."+ _.name,86 "BSR.InputMissingBlock."+name, 93 87 _.modelDef->InputMissingBlock, 94 _.mcmcPartialHandler,88 mcmcPartialHandler, 95 89 4, 96 90 _.arm.blk::_.lastCol+1, 97 _.config91 config 98 92 ); 99 93 … … 101 95 BysMcmc::Bsr::Gibbs::OutputMissingBlock 102 96 ( 103 "BSR.OutputMissingBlock."+ _.name,97 "BSR.OutputMissingBlock."+name, 104 98 _.modelDef->OutputMissingBlock, 105 _.mcmcPartialHandler,99 mcmcPartialHandler, 106 100 5, 107 101 _.inpMis.blk::_.lastCol+1, 108 _.config102 config 109 103 ); 110 104 … … 117 111 _.outMis.blk 118 112 ]]; 113 114 Real _defined = define( 115 name, 116 get.colNames(0), 117 _.mcmcPartialHandler, 118 numBlock, 119 firstCol, 120 config); 119 121 120 122 //Output filtered by missing values … … 272 274 { 273 275 //WriteLn("TRACE "+_.name+"::setStore("<<Rows(values)+"x"<<Columns(values)+")"); 276 putStore(values); 274 277 setStore.blocks(values) 275 278 }; … … 356 359 { 357 360 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 }); 361 364 //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 363 368 }; 364 369 -
tol/stdlib/math/stat/models/bayesian/bysMcmc/bsr/gibbs/_nonLinMaster.tol
rb81b266 rf558270 12 12 McmcPartialHandler mcmcPartialHandler, 13 13 Set nonLinFilter, 14 Real numBlock, 15 Real firstCol, 14 16 Config config) 15 17 ////////////////////////////////////////////////////////////////////////////// 16 18 { 19 Text name = modelDef->DocInfo->Model.Name; 17 20 BysMcmc::MasterSampler master = [[ 18 21 … … 20 23 BysMcmc::McmcPartialHandler _.mcmcPartialHandler = mcmcPartialHandler; 21 24 22 BysMcmc::Config _.config = config;23 25 //-------------------------------------------------------------------------- 24 26 // Read only members … … 26 28 //The basic BSR master 27 29 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); 31 31 32 32 Text get.name(Real unused) … … 44 44 45 45 //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; 57 47 //The non linear blocks created from given filters 58 48 Set _.nonLinBlk = 59 49 { 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; 63 51 Set aux = For(1,Card(nonLinFilter), NameBlock(Real numBlk) 64 52 { 65 //WriteLn("TRACE "+_MID+"::_.nonLinBlk 3.1 numBlk="<<numBlk);66 53 NameBlock nlf = nonLinFilter[numBlk]; 67 54 BysMcmc::BlockSampler nlb = BysMcmc::Bsr::Gibbs::NonLinBlock … … 69 56 nlf, 70 57 _.bsrMst, 71 numBlk+ 1,72 firstCol,58 numBlk+numBlock, 59 nextCol, 73 60 config 74 61 ); … … 78 65 1 79 66 }); 80 Real firstCol := nlb::_.lastCol+1;67 Real nextCol := nlb::_.lastCol+1; 81 68 Eval(ToName(nlb::_.name)+"=nlb") 82 69 }); … … 84 71 }; 85 72 //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); 87 82 88 83 ////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.
