Changeset f16fdcd in tol


Ignore:
Timestamp:
Sep 3, 2009, 10:41:59 PM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
40b58f9
Parents:
a171731
Message:

Calling to new method of _.sampler Real resume(Real unused) instead of Real initialize(Real unused) when we want to continue an stored chain

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/stdlib/math/stat/models/bayesian/bysMcmc/_cycler.tol

    ra171731 rf16fdcd  
    8383      Real kerDens.points   = _.config::report.kerDens.points
    8484    )};
    85     1
    86   };
    87 
    88   ////////////////////////////////////////////////////////////////////////////
    89   Text _.autodoc.member.initialize =
    90   "Initializes the Markov Chain";
    91   Real initialize(Real unused)
    92   ////////////////////////////////////////////////////////////////////////////
    93   {
    94     Real _.notifier::initializing(_.n, _.path);
    95     Real _.sampler::initialize(0);
    9685    1
    9786  };
    … …  
    156145            });
    157146            Matrix lastRow = Sub(resumed,m_,1,1,_.n);
    158           //WriteLn("TRACE "+_MID+"lastRow="<<lastRow);
     147            WriteLn(_MID+"Setting last resumed row as initial point");
    159148            Real _.sampler::setStore(lastRow);
    160149            m_
    … …  
    187176  {
    188177    Text _MID = "[Cycler::generate] ";
    189     Real WriteLn(_MID+_.name+
    190       "\n Storing MCMC in file ....... : "<<_.path+
    191       "\n Number of fixed variables .. : "<<_.sampler::_.fixedParamNum+
    192       "\n Number of reloaded variables : "<<_.sampler::_.reloadParamNum+
    193       "\n Number of sampled variables  : "<<_.sampler::_.freeParamNum+
    194       "\n Number of total variables .. : "<<_.n+
    195       "\n Number of simulations ...... : "<<sampleLength+
    196       "\n Cache length ............... : "<<cacheLength_+
    197       "\n Resume ..................... : "<<resume_+
    198       If(_mcmc.maxTime<1/0,
    199       "\n MaxTime               : "<<_mcmc.maxTime+" seconds",""));
    200178  //Ensures path is all right
    201179    Real OSDirMake(GetFilePath(_.path));
    … …  
    219197    Real end = GE(numSim,sampleLength);
    220198  //WriteLn("TRACE "+_MID+"end="<<end);
     199    Real runSim = 0;
     200    Real _.notifier::initializing(_.n, _.path);
     201    Real If(!savedSimulations,
     202    {
     203       _.sampler::initialize(0)
     204    },
     205    {
     206       _.sampler::resume(0)
     207    });
     208    Real WriteLn(_MID+_.name+
     209      "\n Storing MCMC in file ....... : "<<_.path+
     210      "\n Number of fixed variables .. : "<<_.sampler::_.fixedParamNum+
     211      "\n Number of reloaded variables : "<<_.sampler::_.reloadParamNum+
     212      "\n Number of sampled variables  : "<<_.sampler::_.freeParamNum+
     213      "\n Number of total variables .. : "<<_.n+
     214      "\n Number of simulations ...... : "<<sampleLength+
     215      "\n Cache length ............... : "<<cacheLength_+
     216      "\n Resume ..................... : "<<resume_+
     217      If(_mcmc.maxTime<1/0,
     218      "\n MaxTime ...................  : "<<_mcmc.maxTime+" seconds",""));
     219    If(numErr0<NError,
     220    {
     221      CMsg::Coded::show(BysMcmc::_.cmsg::_.cannotContinueSimulation,
     222      [[_MID, Real (NError-numErr0) ]])
     223    });
     224    Real If(_.config::do.mcmc.profiler,
     225      TolOprProfiler.Enabled := True);
    221226    While(!end,
    222227    {
     228      Real runSim := runSim+1;
    223229      Real numSim := numSim+1;
    224230    //WriteLn("TRACE "+_MID+"2 numSim="<<numSim);
    … …  
    281287      //WriteLn("TRACE "+_MID+"10");
    282288        Real CMsg::Coded::show(BysMcmc::_.cmsg::_.cannotContinueSimulation,
    283         [[
    284           _MID,
    285           Real (NError-numErr0)
    286         ]]);
     289        [[_MID,Real (NError-numErr0)]]);
    287290        Real end := True
    288291      });
    … …  
    290293    //WriteLn("TRACE "+_MID+"8");
    291294    });
     295    Real If(config::do.mcmc.profiler,
     296      TolOprProfiler.Dump(cycler::_.path+cycler::_.name));
    292297  //WriteLn("TRACE "+_MID+"11");
    293298    Matrix Do MatAppendFile(_.path, cache);
    294299  //WriteLn("TRACE "+_MID+"12");
    295300    Real savedSimulations := numSim;
    296     Real _.time := (Time - t0)/numSim;
     301    Real _.time := (Time - t0)/runSim;
    297302    WriteLn(" [time by simulation:"<<_.time+"]");
    298303    Real _.notifier::simulating(numSim, _.time);
Note: See TracChangeset for help on using the changeset viewer.