.. _physics-posteriorSampleStateInitialize: Posterior Sampling State Initialization ======================================= Class providing state initialization for Bayesian posterior sampling simulations---the strategy for choosing the starting point of each Markov chain before the main sampling loop begins. Implementations draw initial parameter vectors from the prior (random prior sampling), from a multivariate Gaussian centered on a maximum-likelihood estimate, or from a user-supplied restart file. Proper initialization helps the chains reach the high-probability region quickly and avoids premature convergence or long burn-in periods. **Default implementation:** ``posteriorSampleStateInitializePriorRandom`` Methods ------- ``initialize`` → ``void`` Set the initial parameter vector of the simulation state before the main sampling loop begins, also returning the initial log-likelihood, log-posterior, and elapsed evaluation time for the starting point. * ``class (posteriorSampleStateClass ), intent(inout) :: simulationState`` * ``type (modelParameterList ), intent(inout), dimension(:) :: modelParameters_`` * ``class (posteriorSampleLikelihoodClass), intent(inout) :: modelLikelihood`` * ``double precision , intent( out) :: timeEvaluatePrevious, logLikelihood, logPosterior`` .. _physics-posteriorSampleStateInitializeGaussianSphere: ``posteriorSampleStateInitializeGaussianSphere`` ------------------------------------------------ A posterior sampling state initialization class which initializes states using random draws from a Gaussian sphere centered on the mode of the prior distribution. **Parameters** * ``[radiusSphere]`` — The radius of the Gaussian sphere from which each chain's initial parameter vector is drawn; if ``radiusIsRelative`` is true this is expressed as a fraction of the prior extent, otherwise it is an absolute radius in parameter space. * ``[radiusIsRelative]`` — If true, the radius of the sphere is assumed to be relative to the extent of the prior, otherwise it is assumed to be an absolute radius. * ``[position]`` (default ``var_str('priorMedian')``) — The initial position for the sphere. If this is set to ``priorMedian``, then the sphere is placed at the median of the prior in each dimension. Otherwise, this must be a list of starting parameter values. .. _physics-posteriorSampleStateInitializeLatinHypercube: ``posteriorSampleStateInitializeLatinHypercube`` ------------------------------------------------ This class uses a :term:`Latin hypercube` design (in the cumulative prior probability distribution of each parameter) to assign initial state vectors. In particular, a :term:`maximin` design is used in which a number of trial :term:`Latin hypercube` are constructed and the hypercube with the greatest minimum distance between any pair of state vectors is selected. The ``[maximinTrialCount]`` parameter is used to specify the number of trial hypercubes to construct. **Parameters** * ``[maximinTrialCount]`` (default ``1000``) — The number of trial Latin Hypercubes to construct when seeking the maximum minimum separation sample. .. _physics-posteriorSampleStateInitializeMaximumLikelihood: ``posteriorSampleStateInitializeMaximumLikelihood`` --------------------------------------------------- This class initializes state to the maximum likelihood state from a previous simulation---the state will be the same for all chains. The ``[logFileRoot]`` parameter is used to specify the log-file root name used in the previous simulation. **Parameters** * ``[logFileRoot]`` — The root file name of the state files from which to maximum likelihood state. .. _physics-posteriorSampleStateInitializeParameterFile: ``posteriorSampleStateInitializeParameterFile`` ----------------------------------------------- This class initializes all chains to values read from a parameter file. **Parameters** * ``[fileName]`` — The name of the parameter file from which to read initial state. .. _physics-posteriorSampleStateInitializePosteriorMaximumGaussianSphere: ``posteriorSampleStateInitializePosteriorMaximumGaussianSphere`` ---------------------------------------------------------------- Initializes chains to the the maximum posterior point from a set of chain files, with a Gaussian sphere scatter around that point. **Parameters** * ``[logFileRoot]`` — The root file name of the state files from which to resume. * ``[radiusSphere]`` — The radius of the Gaussian sphere. * ``[radiusIsRelative]`` — If true, the radius of the sphere is assumed to be relative to the extent of the prior, otherwise it is assumed to be an absolute radius. .. _physics-posteriorSampleStateInitializePriorRandom: ``posteriorSampleStateInitializePriorRandom`` --------------------------------------------- A posterior sampling state initialization class which samples the initial state at random from the prior distribution(s). **(Default implementation)** .. _physics-posteriorSampleStateInitializeResume: ``posteriorSampleStateInitializeResume`` ---------------------------------------- This class resumes from a previous simulation by setting the chain states to the states at the end of that simulation. The ``[logFileRoot]`` parameter is used to specify the log-file root name used in the previous simulation. **Parameters** * ``[logFileRoot]`` — The root file name (without chain-index suffix) of the binary state files written by a previous run, from which chain positions and optionally full simulation state are restored to resume sampling. * ``[restoreState]`` — If true, restore the full internal simulation state (step counter, acceptance counts, covariance estimates) from the state files in addition to restoring the chain parameter vectors. .. _physics-posteriorSampleStateInitializeSwitched: ``posteriorSampleStateInitializeSwitched`` ------------------------------------------ A posterior sampling state initialization class which sets initial state by switching between two other options. **Methods** * ``fractionADAF`` — Return the fraction of the accretion flow to be represented as an ADAF. * ``efficiencyRadiativeScalingADAF`` — Return the scaling of radiative efficiency of the ADAF component in a switched accretion disk. **Parameters** * ``[modelParameterName1]`` — Names of parameters to be initialized by initializer number 1. * ``[modelParameterName2]`` — Names of parameters to be initialized by initializer number 2. * ``[accretionRateThinDiskMinimum]`` (default ``'0.01d0'``) — The accretion rate (in Eddington units) below which a switched accretion disk becomes an ADAF. * ``[accretionRateThinDiskMaximum]`` (default ``'0.3d0'``) — The accretion rate (in Eddington units) above which a switched accretion disk becomes an ADAF. * ``[accretionRateTransitionWidth]`` (default ``0.1d0``) — The width (in :math:`\ln[\dot{M}/\dot{M}_\mathrm{Eddington}]`) over which transitions between accretion disk states occur. * ``[scaleADAFRadiativeEfficiency]`` (default ``.true.``) — Specifies whether the radiative efficiency of the ADAF component in a switched accretion disk scales with accretion rate.