BCModel.cxx
136 double BCModel::HessianMatrixElement(unsigned index1, unsigned index2, const std::vector<double>& point)
247 prior = GetParameter(index).GetPrior()->GetBCH1D(h, Form("%s_%d_prior", GetSafeName().data(), index));
266 prior.GetHistogram()->SetTitle(Form("prior;%s;P(%s)", GetVariable(index).GetLatexNameWithUnits().data(), GetVariable(index).GetLatexName().data()));
292 TH2* h2 = fPriorModel->GetVariable(index1).CreateH2("getprior2d_temp", fPriorModel->GetVariable(index2));
293 prior = GetParameter(index1).GetPrior()->GetBCH2D(GetParameter(index2).GetPrior(), h2, Form("h2d_prior_%s_%d_%d", GetName().data(), index1, index2));
321 if (!prior.Valid() && (fPriorModel->MarginalizedHistogramExists(index1, index2) || fPriorModel->MarginalizedHistogramExists(index2, index1)))
335 unsigned BCModel::PrintKnowledgeUpdatePlots(const std::string& filename, unsigned hdiv, unsigned vdiv, bool call_likelihood)
410 BCLog::OutSummary(Form("Printing knowledge update plots (%lu x 1D + %lu x 2D = %u) into file %s", h1.size(), h2.size(), nplots, newFilename.data()));
486 BCAux::SetKnowledgeUpdateDrawingStyle(fBCH1DPriorDrawingOptions, fBCH1DPosteriorDrawingOptions, style);
487 BCAux::SetKnowledgeUpdateDrawingStyle(fBCH2DPriorDrawingOptions, fBCH2DPosteriorDrawingOptions, style);
Posterior drawn with detailed info, prior drawn as overlaid line.
Definition: BCAux.h:121
virtual TH1 * CreateH1(const std::string &name) const
Creates a 1D Histogram for this variable.
Definition: BCVariable.cxx:132
bool MarginalizedHistogramExists(unsigned index) const
Definition: BCEngineMCMC.h:511
void DrawKnowledgeUpdate(BCHistogramBase &prior, BCHistogramBase &posterior, bool draw_prior_first, BCTrash< TObject > &trash)
Draw knowledge update plot into current TPad.
Definition: BCAux.cxx:236
virtual BCPriorModel * GetPriorModel(bool prepare=true, bool call_likelihood=false)
Definition: BCModel.cxx:223
virtual double LogLikelihood(const std::vector< double > ¶ms)=0
Calculates natural logarithm of the likelihood.
BCH1D fBCH1DPosteriorDrawingOptions
knowledge update plot 1D posterior options.
Definition: BCModel.h:307
virtual double LogProbability(const std::vector< double > ¶meters)
Returns natural logarithm of the a posteriori probability given a set of parameter values...
Definition: BCModel.cxx:105
virtual std::vector< std::pair< unsigned, unsigned > > GetH2DPrintOrder() const
Definition: BCEngineMCMC.cxx:2902
bool fDrawPriorFirst
flag for ordering of drawing of prior and posterior in knowledge update plots.
Definition: BCModel.h:315
A class to represent a constant prior of a parameter.
Definition: BCConstantPrior.h:33
std::vector< double > FindMode(std::vector< double > start=std::vector< double >())
Do the mode finding using a method set via SetOptimizationMethod.
Definition: BCIntegrate.cxx:1022
void PrintParameters(const std::vector< double > &P, void(*output)(const std::string &)=BCLog::OutSummary) const
Print parameters.
Definition: BCEngineMCMC.cxx:2881
void PrintHessianMatrix(std::vector< double > parameters)
Prints matrix elements of the Hessian matrix.
Definition: BCModel.cxx:195
void PrintShortFitSummary()
Prints a short summary of the fit results on the screen.
Definition: BCModel.cxx:178
void SetDrawPriorFirst(bool b=true)
Set drawing of prior first (true) or posterior first (false) for knowledge update plots...
Definition: BCModel.h:155
virtual double LogProbabilityNN(const std::vector< double > ¶meters)
Returns the natural logarithm of likelihood times prior probability given a set of parameter values...
Definition: BCModel.cxx:88
Prior drawn with detailed info, posterior drawn as overlaid line.
Definition: BCAux.h:122
double HessianMatrixElement(unsigned index1, unsigned index2, const std::vector< double > &point)
Calculates the matrix element of the Hessian matrix.
Definition: BCModel.cxx:136
virtual std::vector< unsigned > GetH1DPrintOrder() const
Definition: BCEngineMCMC.cxx:2891
BCAux::BCTrash< TObject > fObjectTrash
Storage for plot objects with proper clean-up.
Definition: BCEngineMCMC.h:1832
virtual const std::string & GetLatexName() const
Definition: BCVariable.h:82
virtual void InitializeMarkovChainTree(bool replacetree=false, bool replacefile=false)
Initialize the trees containing the Markov chains and parameter info.
Definition: BCEngineMCMC.cxx:703
void SetKnowledgeUpdateDrawingStyle(BCH1D &prior, BCH1D &posterior, BCAux::BCKnowledgeUpdateDrawingStyle style=BCAux::kKnowledgeUpdateDefaultStyle)
Use pre-made drawing options for knowledge update plots.
Definition: BCAux.cxx:132
void SetDrawLocalMode(bool flag=true, bool arrows=true)
Set drawing of global mode.
Definition: BCHistogramBase.h:445
virtual void InitializeMarkovChainTree(bool replacetree=false, bool replacefile=false)
Initialize the trees containing the Markov chains and parameter info.
Definition: BCModel.cxx:117
BCH2D fBCH2DPosteriorDrawingOptions
knowledge update plot 2D posterior options.
Definition: BCModel.h:311
BCKnowledgeUpdateDrawingStyle
An enumerator for the knowledge update drawing style presets.
Definition: BCAux.h:119
virtual unsigned PrintKnowledgeUpdatePlots(const std::string &filename, unsigned hdiv=1, unsigned vdiv=1, bool call_likelihood=false)
Print a comparison of the prior knowledge to the posterior knowledge for each parameter.
Definition: BCModel.cxx:335
virtual bool Valid() const
Whether histogram has been set and filled.
Definition: BCHistogramBase.cxx:226
virtual std::string GetLatexNameWithUnits() const
Definition: BCVariable.h:92
virtual double LogAPrioriProbability(const std::vector< double > ¶meters)
Returns natural logarithm of the prior probability.
Definition: BCModel.h:178
void SetNBands(unsigned n)
Sets number of credibility interval bands to draw.
Definition: BCHistogramBase.h:424
void DefaultToPDF(std::string &filename)
Force file extension to be .pdf if not already .pdf or .ps.
Definition: BCAux.cxx:36
BCIntegrate & operator=(const BCIntegrate &)
Copy-assignment operator.
Definition: BCIntegrate.cxx:233
virtual BCH2D GetBCH2D(BCPrior *ordinate, TH2 *bins, const std::string &name="prior")
Get BCH2D object for prior.
Definition: BCPrior.cxx:176
BCPriorModel * fPriorModel
BCPriorModel object for drawing of knowledge update, and saving of samples according to prior...
Definition: BCModel.h:295
virtual double SamplingFunction(const std::vector< double > ¶meters)
Sampling function used for importance sampling.
Definition: BCModel.cxx:127
virtual BCH1D GetBCH1D(TH1 *bins, const std::string &name="prior")
Get BCH1D object for prior.
Definition: BCPrior.cxx:159
void SetKnowledgeUpdateDrawingStyle(BCAux::BCKnowledgeUpdateDrawingStyle style=BCAux::kKnowledgeUpdateDefaultStyle)
Set default drawing options for knowledge update plots.
Definition: BCModel.cxx:484
virtual double GetRangeWidth() const
Returns the range width of the variable values.
Definition: BCVariable.h:109
BCH1D GetMarginalized(const std::string &name) const
Obtain the individual marginalized distributions with respect to one parameter.
Definition: BCEngineMCMC.h:561
virtual BCH1D GetPrior(unsigned index)
Get prior of a variable as a BCH1D.
Definition: BCModel.cxx:234
virtual double Likelihood(const std::vector< double > ¶ms)
Returns the likelihood.
Definition: BCModel.h:185
virtual const std::vector< double > & GetBestFitParameters() const
Definition: BCIntegrate.cxx:274