Stan  2.10.0
probability, sampling & optimization
Public Member Functions | List of all members
stan::services::sample::mcmc_writer< Model, SampleWriter, DiagnosticWriter, MessageWriter > Class Template Reference

mcmc_writer writes out headers and samples More...

#include <mcmc_writer.hpp>

Public Member Functions

 mcmc_writer (SampleWriter &sample_writer, DiagnosticWriter &diagnostic_writer, MessageWriter &message_writer)
 Constructor. More...
 
void write_sample_names (stan::mcmc::sample &sample, stan::mcmc::base_mcmc *sampler, Model &model)
 Outputs parameter string names. More...
 
template<class RNG >
void write_sample_params (RNG &rng, stan::mcmc::sample &sample, stan::mcmc::base_mcmc &sampler, Model &model)
 Outputs samples. More...
 
void write_adapt_finish (stan::mcmc::base_mcmc *sampler)
 Prints additional info to the streams. More...
 
void write_diagnostic_names (stan::mcmc::sample sample, stan::mcmc::base_mcmc *sampler, Model &model)
 Print diagnostic names. More...
 
void write_diagnostic_params (stan::mcmc::sample &sample, stan::mcmc::base_mcmc *sampler)
 Print diagnostic params to the diagnostic stream. More...
 
template<class Writer >
void write_timing (double warmDeltaT, double sampleDeltaT, Writer &writer)
 Internal method. More...
 
void write_timing (double warmDeltaT, double sampleDeltaT)
 Print timing information to all streams. More...
 

Detailed Description

template<class Model, class SampleWriter, class DiagnosticWriter, class MessageWriter>
class stan::services::sample::mcmc_writer< Model, SampleWriter, DiagnosticWriter, MessageWriter >

mcmc_writer writes out headers and samples

Template Parameters
ModelModel class
SampleWriterClass for recording samples
DiagnosticWriterClass for diagnostic samples

Definition at line 26 of file mcmc_writer.hpp.

Constructor & Destructor Documentation

template<class Model , class SampleWriter , class DiagnosticWriter , class MessageWriter >
stan::services::sample::mcmc_writer< Model, SampleWriter, DiagnosticWriter, MessageWriter >::mcmc_writer ( SampleWriter &  sample_writer,
DiagnosticWriter &  diagnostic_writer,
MessageWriter &  message_writer 
)
inline

Constructor.

Parameters
sample_writersamples are "written" to this stream (can abstract this?)
diagnostic_writerdiagnostic information is "written" to this stream
message_writermessages are written to this stream
Precondition
arguments == 0 if and only if they are not meant to be used
Postcondition
none
Side effects: streams are stored in this object

Definition at line 44 of file mcmc_writer.hpp.

Member Function Documentation

template<class Model , class SampleWriter , class DiagnosticWriter , class MessageWriter >
void stan::services::sample::mcmc_writer< Model, SampleWriter, DiagnosticWriter, MessageWriter >::write_adapt_finish ( stan::mcmc::base_mcmc sampler)
inline

Prints additional info to the streams.

Prints to the sample stream

Parameters
samplersampler

Definition at line 131 of file mcmc_writer.hpp.

template<class Model , class SampleWriter , class DiagnosticWriter , class MessageWriter >
void stan::services::sample::mcmc_writer< Model, SampleWriter, DiagnosticWriter, MessageWriter >::write_diagnostic_names ( stan::mcmc::sample  sample,
stan::mcmc::base_mcmc sampler,
Model &  model 
)
inline

Print diagnostic names.

Parameters
sampleunconstrained sample
samplersampler
modelmodel
Precondition
sample, sampler, and model are consistent.
Postcondition
none
Side effects: diagnostic_stream_ is appended with comma
separated names with newline at the end

Definition at line 149 of file mcmc_writer.hpp.

template<class Model , class SampleWriter , class DiagnosticWriter , class MessageWriter >
void stan::services::sample::mcmc_writer< Model, SampleWriter, DiagnosticWriter, MessageWriter >::write_diagnostic_params ( stan::mcmc::sample sample,
stan::mcmc::base_mcmc sampler 
)
inline

Print diagnostic params to the diagnostic stream.

Parameters
sampleunconstrained sample
samplersampler
Precondition
sample and sampler are consistent
Postcondition
none.
Side effects: diagnostic_stream_ is appended with csv values of the
sample's get_sample_params(), the sampler's get_sampler_params(), and get_sampler_diagnostics()

Definition at line 177 of file mcmc_writer.hpp.

template<class Model , class SampleWriter , class DiagnosticWriter , class MessageWriter >
void stan::services::sample::mcmc_writer< Model, SampleWriter, DiagnosticWriter, MessageWriter >::write_sample_names ( stan::mcmc::sample sample,
stan::mcmc::base_mcmc sampler,
Model &  model 
)
inline

Outputs parameter string names.

First outputs the names stored in the sample object (stan::mcmc::sample), then uses the sampler provided to output sampler specific names, then adds the model constrained parameter names.

The names are written to the sample_stream as comma separated values with a newline at the end.

Parameters
samplea sample (unconstrained) that works with the model
samplera stan::mcmc::base_mcmc object
modelthe model
Precondition
none
Postcondition
none
Side effects: sample_stream_ is written to with comma separated values
with a newline at the end

Definition at line 70 of file mcmc_writer.hpp.

template<class Model , class SampleWriter , class DiagnosticWriter , class MessageWriter >
template<class RNG >
void stan::services::sample::mcmc_writer< Model, SampleWriter, DiagnosticWriter, MessageWriter >::write_sample_params ( RNG &  rng,
stan::mcmc::sample sample,
stan::mcmc::base_mcmc sampler,
Model &  model 
)
inline

Outputs samples.

First outputs the values of the sample params from a stan::mcmc::sample, then outputs the values of the sampler params from a stan::mcmc::base_mcmc, then finally outputs the values of the model.

The samples are written to the sample_stream as comma separated values with a newline at the end.

Parameters
rngrandom number generator (used by model.write_array())
samplethe sample in constrained space
samplerthe sampler
modelthe model

Definition at line 98 of file mcmc_writer.hpp.

template<class Model , class SampleWriter , class DiagnosticWriter , class MessageWriter >
template<class Writer >
void stan::services::sample::mcmc_writer< Model, SampleWriter, DiagnosticWriter, MessageWriter >::write_timing ( double  warmDeltaT,
double  sampleDeltaT,
Writer &  writer 
)
inline

Internal method.

Prints timing information

Parameters
warmDeltaTwarmup time in seconds
sampleDeltaTsample time in seconds
writeroutput stream
Precondition
none
Postcondition
none
Side effects: stream is updated with information about timing

Definition at line 204 of file mcmc_writer.hpp.

template<class Model , class SampleWriter , class DiagnosticWriter , class MessageWriter >
void stan::services::sample::mcmc_writer< Model, SampleWriter, DiagnosticWriter, MessageWriter >::write_timing ( double  warmDeltaT,
double  sampleDeltaT 
)
inline

Print timing information to all streams.

Parameters
warmDeltaTwarmup time (sec)
sampleDeltaTsample time (sec)

Definition at line 237 of file mcmc_writer.hpp.


The documentation for this class was generated from the following file:

     [ Stan Home Page ] © 2011–2016, Stan Development Team.