Changeset 77dfa39 in tol


Ignore:
Timestamp:
Nov 19, 2008, 9:50:26 AM (18 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
9ba790a
Parents:
8d09f87
Message:

User can specify the number of simulations to be resumed (do.resume>0) or las simulations to be skiped (do.resume<0)

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

Location:
tol/stdlib/math/stat/models
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tol/stdlib/math/stat/models/_init_models.tol

    r8d09f87 r77dfa39  
    55
    66Set Include("mle/_init_mle.tol");
    7 Set Include("bayesian/_init_bayesian.tol");
     7//Set Include("bayesian/_init_bayesian.tol");
  • tol/stdlib/math/stat/models/bayesian/bysMcmc/_build.tol

    r8d09f87 r77dfa39  
    8484      "\n Number of simulations : "<<sampleLength+
    8585      "\n Cache length          : "<<cacheLength_+
    86       "\n Resume                : "<<If(resume_,"True","False")+
     86      "\n Resume                : "<<resume_+
    8787      If(_mcmc.maxTime<1/0,
    8888      "\n MaxTime               : "<<_mcmc.maxTime+" seconds",""));
    … …  
    9292    Text numIterFmt = "% "+IntText(numDec)+".0lf";
    9393  //Resume or clean old simulations
    94     Real savedSimulations = If(!resume_,
     94    Real savedSimulations = If(resume_==0,
    9595    {
    9696      Real OSFilRemove(_.path);
    … …  
    117117        n==_.n,
    118118        {
    119           Real WriteLn(_MID+"resuming "<<m+" old simulations");
    120           Matrix lastRow = Sub(old.mcmc,m,1,1,_.n);
    121         //WriteLn("TRACE "+_MID+"lastRow="<<lastRow);
    122           Real _.sampler::setStore(lastRow);
    123           m
     119          Real m_ = Case(
     120            resume_>0, Min(m,resume_),
     121            resume_<0,  Max(0,m+resume_) );
     122          If(m_==0,
     123          {
     124            WriteLn(_MID+"There are not enougth old simulations to resume");
     125            Real OSFilRemove(_.path);
     126            0
     127          },
     128          {
     129            Real WriteLn(_MID+"resuming "<<m_+" old simulations");
     130            Real If(m_==m,0,
     131            {
     132              Real WriteLn(_MID+"Removing last "<<Real(m-m_)+" old simulations");
     133              Matrix resumed = Sub(old.mcmc,1,1,m_,_.n);
     134              Matrix MatWriteFile(_.path, resumed);
     135              1
     136            });
     137            Matrix lastRow = Sub(old.mcmc,m_,1,1,_.n);
     138          //WriteLn("TRACE "+_MID+"lastRow="<<lastRow);
     139            Real _.sampler::setStore(lastRow);
     140            m_
     141          })
    124142        },
    125143        1==1,
Note: See TracChangeset for help on using the changeset viewer.