BCModelManager Class Reference

A class representing a set of BCModels. More...

#include <BCModelManager.h>

Public Member Functions

Constructors and destructor
 BCModelManager ()
 The default constructor. More...
 
 BCModelManager (const BCModelManager &other)
 The default copy constructor. More...
 
virtual ~BCModelManager ()
 The default destructor. More...
 
Member functions (get)
unsigned int GetNModels ()
 
BCModelGetModel (unsigned index)
 Returns the BCModel at a certain index of this BCModelManager. More...
 
BCDataSetGetDataSet ()
 Returns the common data set. More...
 
Member functions (set)
void SetDataSet (BCDataSet *dataset)
 Sets the data set common to all BCModels in this BCModelManager. More...
 
void SetPrecision (BCEngineMCMC::Precision precision)
 Set the precision for the MCMC run. More...
 
void SetNIterationsMax (int niterations)
 Sets the maximum number of iterations for the Monte Carlo integration for all BCModels in this BCModelManger. More...
 
void SetNIterationsMin (int niterations)
 Sets the minimum number of iterations for the Monte Carlo integration for all BCModels in this BCModelManager. More...
 
void SetNIterationsPrecisionCheck (int niterations)
 
void SetMarginalizationMethod (BCIntegrate::BCMarginalizationMethod method)
 
void SetIntegrationMethod (BCIntegrate::BCIntegrationMethod method)
 
void SetOptimizationMethod (BCIntegrate::BCOptimizationMethod method)
 
void SetRelativePrecision (double relprecision)
 
void SetAbsolutePrecision (double absprecision)
 Set absolute precision of the numerical integation.
 
void SetNbins (unsigned int n)
 
void SetNChains (unsigned int n)
 Sets the number of Markov chains.
 
Member functions (miscellaneous methods)
void AddModel (BCModel *model, double prior_probability=0.)
 Adds a model to the container. More...
 
void Integrate ()
 Calculates the normalization of the likelihood for each model in the container. More...
 
double BayesFactor (const unsigned int imodel1, const unsigned int imodel2) const
 Calculate Bayes factor for two models. More...
 
void FindMode ()
 Does the mode finding.
 
void MarginalizeAll ()
 Marginalize all probabilities wrt. More...
 
void WriteMarkovChain (bool flag)
 Turn on/off writing of Markov chains to root files for all models. More...
 
void WriteMarkovChainRun (bool flag)
 Turn on/off writing of Markov chain to root file during run for all models. More...
 
void WriteMarkovChainPreRun (bool flag)
 Turn on/off writing of Markov chain to root file during prerun for all models. More...
 
void WriteMarkovChain (const std::string &prefix, const std::string &option, bool flag_run=true, bool flag_prerun=true)
 Turn on writing of Markov chains to root files for all models. More...
 
void PrintModelComparisonSummary () const
 Prints a summary of the model comparison to the log. More...
 
void PrintSummary () const
 Prints a summary to the logs. More...
 

operators and swap

BCModelManageroperator= (BCModelManager modelmanager)
 The defaut assignment operator.
 
void swap (BCModelManager &A, BCModelManager &B)
 swap
 

Detailed Description

A class representing a set of BCModels.

Author
Daniel Kollar
Kevin Kröninger
Version
1.0
Date
08.2008

This class represents a manager for BCModels. It handles common data sets and performs operations on BCModels simultaneously. Model comparsion in terms of a posteriori probabilities is only possible with this class.

Definition at line 34 of file BCModelManager.h.

Constructor & Destructor Documentation

BCModelManager::BCModelManager ( )

The default constructor.

Definition at line 19 of file BCModelManager.cxx.

BCModelManager::BCModelManager ( const BCModelManager other)

The default copy constructor.

Definition at line 25 of file BCModelManager.cxx.

BCModelManager::~BCModelManager ( )
virtual

The default destructor.

Definition at line 34 of file BCModelManager.cxx.

Member Function Documentation

void BCModelManager::AddModel ( BCModel model,
double  prior_probability = 0. 
)

Adds a model to the container.

Parameters
modelThe model
prior_probabilityThe model's a-priori probability

Definition at line 66 of file BCModelManager.cxx.

double BCModelManager::BayesFactor ( const unsigned int  imodel1,
const unsigned int  imodel2 
) const

Calculate Bayes factor for two models.

Parameters
imodel1index of model 1 (numerator)
imodel2index of model 2 (denominator)
Returns
Bayes factor or -1. on error

Definition at line 177 of file BCModelManager.cxx.

BCDataSet* BCModelManager::GetDataSet ( )
inline

Returns the common data set.

Returns
The data set.

Definition at line 85 of file BCModelManager.h.

BCModel* BCModelManager::GetModel ( unsigned  index)
inline

Returns the BCModel at a certain index of this BCModelManager.

Parameters
indexThe index of the model in the BCModelManager.
Returns
The BCModel at the index.

Definition at line 79 of file BCModelManager.h.

unsigned int BCModelManager::GetNModels ( )
inline
Returns
The number of models.

Definition at line 72 of file BCModelManager.h.

void BCModelManager::Integrate ( )

Calculates the normalization of the likelihood for each model in the container.

Definition at line 157 of file BCModelManager.cxx.

void BCModelManager::MarginalizeAll ( )

Marginalize all probabilities wrt.

single parameters and all combinations of two parameters for all models.

Definition at line 225 of file BCModelManager.cxx.

void BCModelManager::PrintModelComparisonSummary ( ) const

Prints a summary of the model comparison to the log.

Definition at line 285 of file BCModelManager.cxx.

void BCModelManager::PrintSummary ( ) const

Prints a summary to the logs.

Definition at line 261 of file BCModelManager.cxx.

void BCModelManager::SetDataSet ( BCDataSet dataset)

Sets the data set common to all BCModels in this BCModelManager.

Note: Data set is not owned by the manager, nor the models.

Parameters
datasetA data set

Definition at line 55 of file BCModelManager.cxx.

void BCModelManager::SetIntegrationMethod ( BCIntegrate::BCIntegrationMethod  method)
Parameters
methodThe integration method

Definition at line 108 of file BCModelManager.cxx.

void BCModelManager::SetMarginalizationMethod ( BCIntegrate::BCMarginalizationMethod  method)
Parameters
methodThe marginalization method

Definition at line 115 of file BCModelManager.cxx.

void BCModelManager::SetNbins ( unsigned int  n)
Parameters
nNumber of bins per dimension for the marginalized distributions. Default is 100. Minimum number allowed is 2.

Definition at line 143 of file BCModelManager.cxx.

void BCModelManager::SetNIterationsMax ( int  niterations)

Sets the maximum number of iterations for the Monte Carlo integration for all BCModels in this BCModelManger.

Definition at line 87 of file BCModelManager.cxx.

void BCModelManager::SetNIterationsMin ( int  niterations)

Sets the minimum number of iterations for the Monte Carlo integration for all BCModels in this BCModelManager.

Parameters
niterations

Definition at line 94 of file BCModelManager.cxx.

void BCModelManager::SetNIterationsPrecisionCheck ( int  niterations)
Parameters
niterationsinterval for checking precision in integration routines

Definition at line 101 of file BCModelManager.cxx.

void BCModelManager::SetOptimizationMethod ( BCIntegrate::BCOptimizationMethod  method)
Parameters
methodThe mode finding method

Definition at line 122 of file BCModelManager.cxx.

void BCModelManager::SetPrecision ( BCEngineMCMC::Precision  precision)

Set the precision for the MCMC run.

Definition at line 80 of file BCModelManager.cxx.

void BCModelManager::SetRelativePrecision ( double  relprecision)
Parameters
relprecisionThe relative precision envisioned for Monte Carlo integration

Definition at line 129 of file BCModelManager.cxx.

void BCModelManager::WriteMarkovChain ( bool  flag)

Turn on/off writing of Markov chains to root files for all models.

If setting true, you must first set filename with function with filename arguments.

Parameters
flagFlag for writing Markov chain (run and prerun) to ROOT file.

Definition at line 233 of file BCModelManager.cxx.

void BCModelManager::WriteMarkovChain ( const std::string &  prefix,
const std::string &  option,
bool  flag_run = true,
bool  flag_prerun = true 
)

Turn on writing of Markov chains to root files for all models.

Parameters
prefixMCMC's written to files named "[prefix][Model safe name].root"
optionfile-open options (TFile), must be "NEW", "CREATE", "RECREATE", or "UPDATE" (i.e. writeable).
flag_runFlag for writing run Markov chain to ROOT file (true) or not (false).
flag_prerunFlag for writing prerun Markov chain to ROOT file (true) or not (false).

Definition at line 254 of file BCModelManager.cxx.

void BCModelManager::WriteMarkovChainPreRun ( bool  flag)

Turn on/off writing of Markov chain to root file during prerun for all models.

If setting either true, you must first set filename with function with filename arguments.

Parameters
flagFlag for writing prerun Markov chain to ROOT file (true) or not (false).

Definition at line 247 of file BCModelManager.cxx.

void BCModelManager::WriteMarkovChainRun ( bool  flag)

Turn on/off writing of Markov chain to root file during run for all models.

If setting either true, you must first set filename with function with filename arguments.

Parameters
flagFlag for writing run Markov chain to ROOT file (true) or not (false).

Definition at line 240 of file BCModelManager.cxx.


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