MaCh3  2.8.0
Reference Guide
Functions
PredictiveThrower.cpp File Reference
#include "Fitters/Algorithms/PredictiveThrower.h"
#include "Parameters/ParameterHandlerGeneric.h"
#include "TH3.h"
Include dependency graph for PredictiveThrower.cpp:

Go to the source code of this file.

Functions

bool CheckBounds (const std::vector< const M3::float_t * > &BoundValuePointer, const std::vector< std::pair< double, double >> &ParamBounds)
 
void AccumulateWAICToy (const double neg_LLH_temp, double &mean_llh, double &mean_llh_squared, double &sum_exp_llh)
 
void AccumulateWAICBin (double &mean_llh, double &mean_llh_squared, double &sum_exp_llh, const unsigned int Ntoys, double &lppd, double &p_WAIC)
 

Function Documentation

◆ AccumulateWAICBin()

void AccumulateWAICBin ( double &  mean_llh,
double &  mean_llh_squared,
double &  sum_exp_llh,
const unsigned int  Ntoys,
double &  lppd,
double &  p_WAIC 
)

Definition at line 1930 of file PredictiveThrower.cpp.

1931  {
1932 // ****************
1933  // Compute the mean log-likelihood and the squared mean
1934  mean_llh /= Ntoys;
1935  mean_llh_squared /= Ntoys;
1936  sum_exp_llh /= Ntoys;
1937  sum_exp_llh = std::log(sum_exp_llh);
1938 
1939  // Log pointwise predictive density based on Eq. 4 in Gelman2014
1940  lppd += sum_exp_llh;
1941 
1942  // Compute the effective number of parameters for WAIC
1943  p_WAIC += mean_llh_squared - (mean_llh * mean_llh);
1944 }

◆ AccumulateWAICToy()

void AccumulateWAICToy ( const double  neg_LLH_temp,
double &  mean_llh,
double &  mean_llh_squared,
double &  sum_exp_llh 
)

Definition at line 1915 of file PredictiveThrower.cpp.

1918  {
1919 // ****************
1920  // Negate the negative log-likelihood to get the actual log-likelihood
1921  double LLH_temp = -neg_LLH_temp;
1922 
1923  mean_llh += LLH_temp;
1924  mean_llh_squared += LLH_temp * LLH_temp;
1925  sum_exp_llh += std::exp(LLH_temp);
1926 }

◆ CheckBounds()

bool CheckBounds ( const std::vector< const M3::float_t * > &  BoundValuePointer,
const std::vector< std::pair< double, double >> &  ParamBounds 
)

Definition at line 462 of file PredictiveThrower.cpp.

463  {
464 // *************************
465  for (size_t i = 0; i < BoundValuePointer.size(); ++i) {
466  const double val = *(BoundValuePointer[i]);
467  const double minVal = ParamBounds[i].first;
468  const double maxVal = ParamBounds[i].second;
469 
470  if (val < minVal || val > maxVal)
471  return false; // out of bounds
472  }
473  return true; // all values are within bounds
474 }