Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder > Class Template Reference

mcmc_writer writes out headers and samples More...

#include <mcmc_writer.hpp>

Public Member Functions

 mcmc_writer (SampleRecorder &sample_recorder, DiagnosticRecorder &diagnostic_recorder, MessageRecorder &message_recorder, std::ostream *msg_stream=0)
 Constructor. More...
 
void write_sample_names (stan::mcmc::sample &sample, stan::mcmc::base_mcmc *sampler, M &model)
 Outputs parameter string names. More...
 
template<class RNG >
void write_sample_params (RNG &rng, stan::mcmc::sample &sample, stan::mcmc::base_mcmc &sampler, M &model)
 Outputs samples. More...
 
template<class Recorder >
void write_adapt_finish (stan::mcmc::base_mcmc *sampler, Recorder &recorder)
 Internal method. 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, M &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 Recorder >
void write_timing (double warmDeltaT, double sampleDeltaT, Recorder &recorder)
 Internal method. More...
 
void write_timing (double warmDeltaT, double sampleDeltaT)
 Print timing information to all streams. More...
 

Detailed Description

template<class M, class SampleRecorder, class DiagnosticRecorder, class MessageRecorder>
class stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder >

mcmc_writer writes out headers and samples

Template Parameters
MModel class
SampleRecorderClass for recording samples
DiagnosticRecorderClass for diagnostic samples

Definition at line 29 of file mcmc_writer.hpp.

Constructor & Destructor Documentation

template<class M , class SampleRecorder , class DiagnosticRecorder , class MessageRecorder >
stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder >::mcmc_writer ( SampleRecorder &  sample_recorder,
DiagnosticRecorder &  diagnostic_recorder,
MessageRecorder &  message_recorder,
std::ostream *  msg_stream = 0 
)
inline

Constructor.

Parameters
sample_streamsamples are "written" to this stream (can abstract this?)
diagnostic_streamdiagnostic information is "written" to this stream
msg_streammessages are output 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 51 of file mcmc_writer.hpp.

Member Function Documentation

template<class M , class SampleRecorder , class DiagnosticRecorder , class MessageRecorder >
template<class Recorder >
void stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder >::write_adapt_finish ( stan::mcmc::base_mcmc sampler,
Recorder &  recorder 
)
inline

Internal method.

Prints additional sampler info to the stream.

Parameters
samplersampler
streamstream to output stuff to

Definition at line 139 of file mcmc_writer.hpp.

template<class M , class SampleRecorder , class DiagnosticRecorder , class MessageRecorder >
void stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder >::write_adapt_finish ( stan::mcmc::base_mcmc sampler)
inline

Prints additional info to the streams.

Prints to both the sample stream and the diagnostic stream

Parameters
samplersampler

Definition at line 157 of file mcmc_writer.hpp.

template<class M , class SampleRecorder , class DiagnosticRecorder , class MessageRecorder >
void stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder >::write_diagnostic_names ( stan::mcmc::sample  sample,
stan::mcmc::base_mcmc sampler,
M &  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 175 of file mcmc_writer.hpp.

template<class M , class SampleRecorder , class DiagnosticRecorder , class MessageRecorder >
void stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder >::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 203 of file mcmc_writer.hpp.

template<class M , class SampleRecorder , class DiagnosticRecorder , class MessageRecorder >
void stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder >::write_sample_names ( stan::mcmc::sample sample,
stan::mcmc::base_mcmc sampler,
M &  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 79 of file mcmc_writer.hpp.

template<class M , class SampleRecorder , class DiagnosticRecorder , class MessageRecorder >
template<class RNG >
void stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder >::write_sample_params ( RNG &  rng,
stan::mcmc::sample sample,
stan::mcmc::base_mcmc sampler,
M &  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 107 of file mcmc_writer.hpp.

template<class M , class SampleRecorder , class DiagnosticRecorder , class MessageRecorder >
template<class Recorder >
void stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder >::write_timing ( double  warmDeltaT,
double  sampleDeltaT,
Recorder &  recorder 
)
inline

Internal method.

Prints timing information

Parameters
warmDeltaTwarmup time in seconds
sampleDeltaTsample time in seconds
streamoutput stream
prefixprepend each line with the prefix; default is ""
Precondition
none
Postcondition
none
Side effects: stream is updated with information about timing

Definition at line 231 of file mcmc_writer.hpp.

template<class M , class SampleRecorder , class DiagnosticRecorder , class MessageRecorder >
void stan::io::mcmc_writer< M, SampleRecorder, DiagnosticRecorder, MessageRecorder >::write_timing ( double  warmDeltaT,
double  sampleDeltaT 
)
inline

Print timing information to all streams.

Parameters
warmDeltaTwarmup time (sec)
sampleDeltaTsample time (sec)

Definition at line 267 of file mcmc_writer.hpp.


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

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