BayesianAnalysisToolkit  0.9.3
BCModelManager.h
Go to the documentation of this file.
1 #ifndef __BCMODELMANAGER__H
2 #define __BCMODELMANAGER__H
3 
17 /*
18  * Copyright (C) 2007-2013, the BAT core developer team
19  * All rights reserved.
20  *
21  * For the licensing terms see doc/COPYING.
22  * For documentation see http://mpp.mpg.de/bat
23  */
24 
25 // ---------------------------------------------------------
26 
27 #include "BCModel.h"
28 #include "BCDataSet.h"
29 
30 // ---------------------------------------------------------
31 
33 {
34 public:
35 
42 
45  BCModelManager(const BCModelManager & modelmanager);
46 
49  virtual ~BCModelManager();
50 
58  BCModelManager & operator = (const BCModelManager & modelmanager);
59 
67  unsigned int GetNModels()
68  { return fModelContainer -> size(); };
69 
74  BCModel * GetModel(int index)
75  { return fModelContainer -> at(index); };
76 
81  { return (fDataSet) ? fDataSet -> GetNDataPoints() : 0; };
82 
88  { return fDataSet -> GetDataPoint(index); };
89 
94  { return fDataSet; };
95 
105  void SetDataSet(BCDataSet * dataset);
106 
112  void SetSingleDataPoint(BCDataPoint * datapoint);
113 
120  void SetSingleDataPoint(BCDataSet * dataset, unsigned int index);
121 
122  void SetNIterationsMax(int niterations);
123 
128  void SetNIterationsMin(int niterations);
129 
132  void SetNIterationsPrecisionCheck(int niterations);
133 
136  void SetNIterationsOutput(int niterations);
140 
144 
148 
152  void SetRelativePrecision(double relprecision);
153 
156  void SetAbsolutePrecision(double absprecision);
157 
161  void SetNbins(unsigned int n);
162 
166  void SetDataPointLowerBoundaries(BCDataPoint * datasetlowerboundaries);
167 
171  void SetDataPointUpperBoundaries(BCDataPoint* datasetupperboundaries);
172 
176  void SetDataPointLowerBoundary(int index, double lowerboundary);
177 
181  void SetDataPointUpperBoundary(int index, double upperboundary);
182 
186  void SetDataBoundaries(int index, double lowerboundary, double upperboundary);
187 
190  void SetNChains(unsigned int n);
191 
203  void AddModel(BCModel * model, double probability=0.);
204 
208  void AddDataPoint(BCDataPoint * datapoint)
209  { fDataSet -> AddDataPoint(datapoint); };
210 
214  int ReadDataFromFile(const char * filename, const char * treename, const char * branchnames)
215  { return this -> ReadDataFromFileTree(filename, treename, branchnames); };
216 
217  int ReadDataFromFile(const char * filename, int nvariables)
218  { return this -> ReadDataFromFileTxt(filename, nvariables); };
219 
229  int ReadDataFromFileTree(const char * filename, const char * treename, const char * branchnames);
230 
239  int ReadDataFromFileTxt(const char * filename, int nbranches);
240 
244  void Integrate();
245 
251  double BayesFactor(const unsigned int imodel1, const unsigned int imodel2);
252 
255  void FindMode();
256 
260  void MarginalizeAll();
261 
264  void WriteMarkovChain(bool flag);
265 
269  { fDataSet -> Reset(); };
270 
275  void PrintModelComparisonSummary(const char * filename=0);
276 
282  void PrintSummary(const char * filename=0);
283 
286  void PrintResults();
287 
290  void CalculatePValue(bool flag_histogram=false);
291 
294 private:
295 
298  void Copy(BCModelManager & modelmanager) const;
299 
303 
307 
308 };
309 
310 // ---------------------------------------------------------
311 
312 #endif