#include <BCModelManager.h>
Public Member Functions | |
Member functions (miscellaneous methods) | |
void | AddDataPoint (BCDataPoint *datapoint) |
void | AddModel (BCModel *model, double probability=0.) |
double | BayesFactor (const unsigned int imodel1, const unsigned int imodel2) |
void | CalculatePValue (bool flag_histogram=false) |
void | FindMode () |
void | MarginalizeAll () |
void | Normalize () |
void | PrintModelComparisonSummary (const char *filename=0) |
void | PrintResults () |
void | PrintSummary (const char *filename=0) |
int | ReadDataFromFile (const char *filename, int nvariables) |
int | ReadDataFromFile (const char *filename, const char *treename, const char *branchnames) |
int | ReadDataFromFileTree (const char *filename, const char *treename, const char *branchnames) |
int | ReadDataFromFileTxt (const char *filename, int nbranches) |
void | ResetDataSet () |
void | WriteMarkovChain (bool flag) |
Constructors and destructors | |
BCModelManager (const BCModelManager &modelmanager) | |
BCModelManager () | |
virtual | ~BCModelManager () |
Member functions (set) | |
void | FixDataAxis (int index, bool fixed) |
void | SetDataBoundaries (int index, double lowerboundary, double upperboundary) |
void | SetDataPointLowerBoundaries (BCDataPoint *datasetlowerboundaries) |
void | SetDataPointLowerBoundary (int index, double lowerboundary) |
void | SetDataPointUpperBoundaries (BCDataPoint *datasetupperboundaries) |
void | SetDataPointUpperBoundary (int index, double upperboundary) |
void | SetDataSet (BCDataSet *dataset) |
void | SetFillErrorBand (bool flag=true) |
void | SetFitFunctionIndexX (int index) |
void | SetFitFunctionIndexY (int index) |
void | SetFitFunctionIndices (int indexx, int indexy) |
void | SetFlagPCA (bool flag) |
void | SetIntegrationMethod (BCIntegrate::BCIntegrationMethod method) |
void | SetMarginalizationMethod (BCIntegrate::BCMarginalizationMethod method) |
void | SetNbins (unsigned int n) |
void | SetNChains (unsigned int n) |
void | SetNiterationsPerDimension (unsigned int niterations) |
void | SetNSamplesPer2DBin (unsigned int n) |
void | SetOptimizationMethod (BCIntegrate::BCOptimizationMethod method) |
void | SetRelativePrecision (double relprecision) |
void | SetSingleDataPoint (BCDataSet *dataset, unsigned int index) |
void | SetSingleDataPoint (BCDataPoint *datapoint) |
void | UnetFillErrorBand () |
Member functions (get) | |
BCDataPoint * | GetDataPoint (int index) |
BCDataSet * | GetDataSet () |
BCModel * | GetModel (int index) |
int | GetNDataPoints () |
unsigned int | GetNModels () |
Assignment operators | |
BCModelManager & | operator= (const BCModelManager &modelmanager) |
Private Member Functions | |
void | Copy (BCModelManager &modelmanager) const |
Private Attributes | |
BCDataSet * | fDataSet |
BCModelContainer * | fModelContainer |
Definition at line 34 of file BCModelManager.h.
BCModelManager::BCModelManager | ( | ) |
The default constructor.
Definition at line 25 of file BCModelManager.cxx.
00026 { 00027 fModelContainer = new BCModelContainer(); 00028 fDataSet = 0; 00029 }
BCModelManager::BCModelManager | ( | const BCModelManager & | modelmanager | ) |
The default copy constructor.
Definition at line 43 of file BCModelManager.cxx.
00044 { 00045 modelmanager.Copy(*this); 00046 }
BCModelManager::~BCModelManager | ( | ) | [virtual] |
The default destructor.
Definition at line 33 of file BCModelManager.cxx.
00034 { 00035 delete fModelContainer; 00036 00037 if (fDataSet) 00038 delete fDataSet; 00039 }
void BCModelManager::AddDataPoint | ( | BCDataPoint * | datapoint | ) | [inline] |
Adds a data point to the data container.
datapoint | The data point |
Definition at line 240 of file BCModelManager.h.
00241 { fDataSet -> AddDataPoint(datapoint); };
void BCModelManager::AddModel | ( | BCModel * | model, | |
double | probability = 0. | |||
) |
Adds a model to the container
model | The model | |
probability | The a priori probability |
SetModelPrior(BCModel * model, double probability)
Definition at line 96 of file BCModelManager.cxx.
00097 { 00098 // create index 00099 unsigned int index = fModelContainer -> size(); 00100 00101 // set index of new model 00102 model -> SetIndex(index); 00103 00104 // set a priori probability of new model 00105 model -> SetModelAPrioriProbability(probability); 00106 00107 // set data set 00108 model -> SetDataSet(fDataSet); 00109 00110 // fill model into container 00111 fModelContainer -> push_back(model); 00112 }
double BCModelManager::BayesFactor | ( | const unsigned int | imodel1, | |
const unsigned int | imodel2 | |||
) |
Calculate Bayes factor for two models.
imodel1 | index of model 1 (numerator) | |
imodel2 | index of model 2 (denominator) |
Definition at line 396 of file BCModelManager.cxx.
00397 { 00398 // Bayes Factors are the likelihoods integrated over the parameters 00399 // Is this equal to the posteriors? 00400 // NOOOO 00401 // But it is equal to normalization factors. 00402 00403 const double norm1 = fModelContainer -> at(imodel1) -> GetNormalization(); 00404 const double norm2 = fModelContainer -> at(imodel2) -> GetNormalization(); 00405 00406 // check model 1 00407 if(norm1<0.) 00408 { 00409 BCLog::OutError( 00410 Form("Model %s (index %d) not normalized. Cannot calculate Bayes factor.", 00411 fModelContainer->at(imodel1)->GetName().data(),imodel1)); 00412 return -1.; 00413 } 00414 00415 // check model 2 00416 if(norm2<0.) 00417 { 00418 BCLog::OutError( 00419 Form("Model %s (index %d) not normalized. Cannot calculate Bayes factor.", 00420 fModelContainer->at(imodel2)->GetName().data(),imodel2)); 00421 return -1.; 00422 } 00423 00424 // denominator cannot be zero 00425 if(norm2==0. && norm1!=0.) // not good since norm2 is double !!! 00426 { 00427 BCLog::OutError( 00428 Form("Model %s (index %d) has ZERO probability. Bayes factor is infinite.", 00429 fModelContainer->at(imodel2)->GetName().data(),imodel2)); 00430 return -1.; 00431 } 00432 00433 // denominator cannot be zero unless also numerator is zero 00434 if(norm2==0. && norm1==0.) // not good since norm2 and norm1 are both double !!! 00435 { 00436 BCLog::OutWarning( 00437 Form("Models %s and %s have ZERO probability. Bayes factor is unknown. Returning 1.", 00438 fModelContainer->at(imodel2)->GetName().data(),fModelContainer->at(imodel1)->GetName().data())); 00439 return 1.; 00440 } 00441 00442 // now calculate the factor 00443 return norm1/norm2; 00444 }
void BCModelManager::CalculatePValue | ( | bool | flag_histogram = false |
) |
Definition at line 475 of file BCModelManager.cxx.
00476 { 00477 // calculate p-value for all models 00478 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00479 this -> GetModel(i) -> CalculatePValue(this -> GetModel(i) -> GetBestFitParameters(), flag_histogram); 00480 }
void BCModelManager::Copy | ( | BCModelManager & | modelmanager | ) | const [private] |
Definition at line 661 of file BCModelManager.cxx.
00662 { 00663 // don't copy the content only the pointers 00664 modelmanager.fModelContainer = this -> fModelContainer; 00665 modelmanager.fDataSet = this -> fDataSet; 00666 }
void BCModelManager::FindMode | ( | ) |
Does the mode finding
Definition at line 448 of file BCModelManager.cxx.
00449 { 00450 // finds mode for all models registered 00451 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00452 this -> GetModel(i) -> FindMode(); 00453 }
void BCModelManager::FixDataAxis | ( | int | index, | |
bool | fixed | |||
) |
Definition at line 272 of file BCModelManager.cxx.
00273 { 00274 // fix axis for all models 00275 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00276 this -> GetModel(i) -> FixDataAxis(index, fixed); 00277 }
BCDataPoint* BCModelManager::GetDataPoint | ( | int | index | ) | [inline] |
Returns a data point of the common data set at an index.
index | The index of the data point in the data set. |
Definition at line 89 of file BCModelManager.h.
00090 { return fDataSet -> GetDataPoint(index); };
BCDataSet* BCModelManager::GetDataSet | ( | ) | [inline] |
Returns the common data set.
Definition at line 95 of file BCModelManager.h.
00096 { return fDataSet; };
BCModel* BCModelManager::GetModel | ( | int | index | ) | [inline] |
Returns the BCModel at a certain index of this BCModelManager.
index | The index of the model in the BCModelManager. |
Definition at line 76 of file BCModelManager.h.
00077 { return fModelContainer -> at(index); };
int BCModelManager::GetNDataPoints | ( | ) | [inline] |
Returns the number of entries in the common data set.
Definition at line 82 of file BCModelManager.h.
00083 { return (fDataSet) ? fDataSet -> GetNDataPoints() : 0; };
unsigned int BCModelManager::GetNModels | ( | ) | [inline] |
Definition at line 69 of file BCModelManager.h.
00070 { return fModelContainer -> size(); };
void BCModelManager::MarginalizeAll | ( | ) |
Marginalize all probabilities wrt. single parameters and all combinations of two parameters for all models.
Definition at line 457 of file BCModelManager.cxx.
00458 { 00459 // marginalizes all models registered 00460 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00461 this -> GetModel(i) -> MarginalizeAll(); 00462 }
void BCModelManager::Normalize | ( | ) |
Calculates the normalization of the likelihood for each model in the container.
Definition at line 369 of file BCModelManager.cxx.
00370 { 00371 // initialize likelihood norm 00372 double normalization = 0.0; 00373 00374 // BCLog::Out(BCLog::summary, BCLog::summary, "Running normalization of all models."); 00375 BCLog::OutSummary("Running normalization of all models."); 00376 00377 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00378 { 00379 fModelContainer -> at(i) -> Normalize(); 00380 00381 // add to total normalization 00382 normalization += (fModelContainer -> at(i) -> GetNormalization() * 00383 fModelContainer -> at(i) -> GetModelAPrioriProbability()); 00384 } 00385 00386 // set model a posteriori probabilities 00387 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00388 fModelContainer -> at(i) -> SetModelAPosterioriProbability( 00389 (fModelContainer -> at(i) -> GetNormalization() * 00390 fModelContainer -> at(i) -> GetModelAPrioriProbability()) / 00391 normalization); 00392 }
BCModelManager & BCModelManager::operator= | ( | const BCModelManager & | modelmanager | ) |
The defaut assignment operator
Definition at line 50 of file BCModelManager.cxx.
00051 { 00052 if (this != &modelmanager) 00053 modelmanager.Copy(* this); 00054 00055 return * this; 00056 }
void BCModelManager::PrintModelComparisonSummary | ( | const char * | filename = 0 |
) |
Prints a summary of model comparison into a file. If filename is omitted the summary will be printed onto the screen
filename | name of the file to write into. |
Definition at line 561 of file BCModelManager.cxx.
00562 { 00563 ofstream out; 00564 std::streambuf * old_buffer = 0; 00565 00566 if(file) 00567 { 00568 out.open(file); 00569 if (!out.is_open()) 00570 { 00571 std::cerr<<"Couldn't open file "<<file<<std::endl; 00572 return; 00573 } 00574 old_buffer = std::cout.rdbuf(out.rdbuf()); 00575 } 00576 00577 // model summary 00578 int nmodels = fModelContainer -> size(); 00579 std::cout 00580 <<std::endl 00581 <<"==========================================="<<std::endl 00582 <<" Model Comparison Summary"<<std::endl 00583 <<"==========================================="<<std::endl 00584 <<std::endl 00585 <<" Number of models : "<<nmodels<<std::endl 00586 <<std::endl; 00587 00588 // probability summary 00589 std::cout 00590 <<" - A priori probabilities:"<<std::endl 00591 <<std::endl; 00592 00593 for (int i=0; i<nmodels; i++) 00594 std::cout 00595 <<" p("<< fModelContainer -> at(i) -> GetName() 00596 <<") = "<< fModelContainer -> at(i) -> GetModelAPrioriProbability() 00597 <<std::endl; 00598 std::cout<<std::endl; 00599 00600 std::cout 00601 <<" - A posteriori probabilities:"<<std::endl 00602 <<std::endl; 00603 00604 for (int i = 0; i < nmodels; i++) 00605 std::cout 00606 <<" p("<< fModelContainer -> at(i) -> GetName() 00607 <<" | data) = "<< fModelContainer -> at(i) -> GetModelAPosterioriProbability() 00608 <<std::endl; 00609 std::cout<<std::endl; 00610 00611 // Bayes factors summary 00612 std::cout 00613 <<" - Bayes factors:"<<std::endl 00614 <<std::endl; 00615 for (int i = 0; i < nmodels-1; i++) 00616 for (int j = i+1; j < nmodels; j++) 00617 std::cout 00618 <<" K = p(data | "<<fModelContainer -> at(i) -> GetName()<<") / " 00619 <<"p(data | "<<fModelContainer -> at(j) -> GetName()<<") = " 00620 <<BayesFactor(i,j)<<std::endl; 00621 std::cout<<std::endl; 00622 00623 // p-values summary 00624 std::cout 00625 <<" - p-values:"<<std::endl 00626 <<std::endl; 00627 00628 for (int i = 0; i < nmodels; i++) 00629 { 00630 double p = fModelContainer -> at(i) -> GetPValue(); 00631 std::cout 00632 <<" "<< fModelContainer -> at(i) -> GetName(); 00633 if(p>=0.) 00634 std::cout<<": p-value = "<< p; 00635 else 00636 std::cout<<": p-value not calculated"; 00637 std::cout<<std::endl; 00638 } 00639 std::cout<<std::endl; 00640 00641 std::cout 00642 <<"==========================================="<<std::endl 00643 <<std::endl; 00644 00645 if (file) 00646 std::cout.rdbuf(old_buffer); 00647 00648 }
void BCModelManager::PrintResults | ( | ) |
Definition at line 652 of file BCModelManager.cxx.
00653 { 00654 // print summary of all models 00655 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00656 this -> GetModel(i) -> PrintResults(Form("%s.txt", this -> GetModel(i) -> GetName().data())); 00657 }
void BCModelManager::PrintSummary | ( | const char * | filename = 0 |
) |
Prints a summary into a file. If filename is omitted the summary will be printed onto the screen. This method is obsolete. Use PrintResults() instead.
filename | name of the file to write into. |
Definition at line 484 of file BCModelManager.cxx.
00485 { 00486 ofstream out; 00487 std::streambuf * old_buffer = 0; 00488 00489 if(file) 00490 { 00491 out.open(file); 00492 if (!out.is_open()) 00493 { 00494 std::cerr<<"Couldn't open file "<<file<<std::endl; 00495 return; 00496 } 00497 old_buffer = std::cout.rdbuf(out.rdbuf()); 00498 } 00499 00500 // model summary 00501 int nmodels = fModelContainer -> size(); 00502 std::cout 00503 <<std::endl 00504 <<"======================================"<<std::endl 00505 <<" Summary"<<std::endl 00506 <<"======================================"<<std::endl 00507 <<std::endl 00508 <<" Number of models : "<<nmodels<<std::endl 00509 <<std::endl 00510 <<" - Models:"<<std::endl; 00511 00512 for (int i = 0; i < nmodels; i++) 00513 fModelContainer -> at(i) -> PrintSummary(); 00514 00515 // data summary 00516 std::cout 00517 <<" - Data:"<<std::endl 00518 <<std::endl 00519 <<" Number of entries: "<<fDataSet -> GetNDataPoints()<<std::endl 00520 <<std::endl; 00521 00522 std::cout 00523 <<"======================================"<<std::endl 00524 <<" Model comparison"<<std::endl 00525 <<std::endl; 00526 00527 // probability summary 00528 std::cout 00529 <<" - A priori probabilities:"<<std::endl 00530 <<std::endl; 00531 00532 for (int i=0; i<nmodels; i++) 00533 std::cout 00534 <<" p("<< fModelContainer -> at(i) -> GetName() 00535 <<") = "<< fModelContainer -> at(i) -> GetModelAPrioriProbability() 00536 <<std::endl; 00537 std::cout<<std::endl; 00538 00539 std::cout 00540 <<" - A posteriori probabilities:"<<std::endl 00541 <<std::endl; 00542 00543 for (int i = 0; i < nmodels; i++) 00544 std::cout 00545 <<" p("<< fModelContainer -> at(i) -> GetName() 00546 <<" | data) = "<< fModelContainer -> at(i) -> GetModelAPosterioriProbability() 00547 <<std::endl; 00548 std::cout<<std::endl; 00549 00550 std::cout 00551 <<"======================================"<<std::endl 00552 <<std::endl; 00553 00554 if (file) 00555 std::cout.rdbuf(old_buffer); 00556 00557 }
int BCModelManager::ReadDataFromFile | ( | const char * | filename, | |
int | nvariables | |||
) | [inline] |
Definition at line 249 of file BCModelManager.h.
00250 { return this -> ReadDataFromFileTxt(filename, nvariables); };
int BCModelManager::ReadDataFromFile | ( | const char * | filename, | |
const char * | treename, | |||
const char * | branchnames | |||
) | [inline] |
Reads data from a file. For a description see the following member functions.
Definition at line 246 of file BCModelManager.h.
00247 { return this -> ReadDataFromFileTree(filename, treename, branchnames); };
int BCModelManager::ReadDataFromFileTree | ( | const char * | filename, | |
const char * | treename, | |||
const char * | branchnames | |||
) |
Reads tree data from a ROOT file. Opens a ROOT file and gets a ROOT tree. It creates data set containing the values read from the file.
filename | The filename of the ROOT file | |
treename | The name of the ROOT tree | |
branchnames | A vector of the names of the branches |
ReadDataFromFileTxt(char * filename, int nbranches);
Definition at line 299 of file BCModelManager.cxx.
00300 { 00301 if (fModelContainer -> size() < 0) 00302 { 00303 BCLog::Out(BCLog::warning, BCLog::warning, "BCModelManager::ReadDataFromFileTree : No model defined."); 00304 return ERROR_NOMODELS; 00305 } 00306 00307 // create data set 00308 if (!fDataSet) 00309 fDataSet = new BCDataSet(); 00310 else 00311 fDataSet -> Reset(); 00312 00313 // read data from tree 00314 int read_file = fDataSet -> ReadDataFromFileTree(filename, treename, branchnames); 00315 00316 if (read_file >=0) 00317 { 00318 this -> SetDataSet(fDataSet); 00319 00320 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00321 fModelContainer -> at(i) -> SetDataSet(fDataSet); 00322 } 00323 else if (read_file == ERROR_FILENOTFOUND) 00324 { 00325 delete fDataSet; 00326 return ERROR_FILENOTFOUND; 00327 } 00328 00329 return 0; 00330 }
int BCModelManager::ReadDataFromFileTxt | ( | const char * | filename, | |
int | nbranches | |||
) |
Reads data from a txt file. Opens a txt file and creates data set containing the values read from the file.
filename | The filename of the ROOT file | |
nbranches | The number of variables |
ReadDataFromFileHist(char * filename, char * histname, const char * branchnames);
Definition at line 334 of file BCModelManager.cxx.
00335 { 00336 if (fModelContainer -> size() < 0) 00337 { 00338 BCLog::Out(BCLog::warning, BCLog::warning, "BCModelManager::ReadDataFromFileTree. No model defined."); 00339 return ERROR_NOMODELS; 00340 } 00341 00342 // create data set 00343 if (!fDataSet) 00344 fDataSet = new BCDataSet(); 00345 else 00346 fDataSet -> Reset(); 00347 00348 // read data from txt file 00349 int read_file = fDataSet -> ReadDataFromFileTxt(filename, nbranches); 00350 00351 if (read_file >=0) 00352 { 00353 this -> SetDataSet(fDataSet); 00354 00355 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00356 fModelContainer -> at(i) -> SetDataSet(fDataSet); 00357 } 00358 else 00359 { 00360 delete fDataSet; 00361 return ERROR_FILENOTFOUND; 00362 } 00363 00364 return 0; 00365 }
void BCModelManager::ResetDataSet | ( | ) | [inline] |
Resets the data set
Definition at line 300 of file BCModelManager.h.
00301 { fDataSet -> Reset(); };
void BCModelManager::SetDataBoundaries | ( | int | index, | |
double | lowerboundary, | |||
double | upperboundary | |||
) |
Set the lower and upper boundaries for possible data values for a particular variable
Definition at line 263 of file BCModelManager.cxx.
00264 { 00265 // set lower and upper boundary values for all models registered 00266 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00267 this -> GetModel(i) -> SetDataBoundaries(index, lowerboundary, upperboundary); 00268 }
void BCModelManager::SetDataPointLowerBoundaries | ( | BCDataPoint * | datasetlowerboundaries | ) |
Sets the data point containing the lower boundaries of possible data values
Definition at line 227 of file BCModelManager.cxx.
00228 { 00229 // set lower boundary point for all models registered 00230 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00231 this -> GetModel(i) -> SetDataPointLowerBoundaries(datasetlowerboundaries); 00232 }
void BCModelManager::SetDataPointLowerBoundary | ( | int | index, | |
double | lowerboundary | |||
) |
Sets the lower boundary of possible data values for a particular variable
Definition at line 245 of file BCModelManager.cxx.
00246 { 00247 // set lower bounday values for all models registered 00248 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00249 this -> GetModel(i) -> SetDataPointLowerBoundary(index, lowerboundary); 00250 }
void BCModelManager::SetDataPointUpperBoundaries | ( | BCDataPoint * | datasetupperboundaries | ) |
Sets the data point containing the upper boundaries of possible data values
Definition at line 236 of file BCModelManager.cxx.
00237 { 00238 // set upper boundary point for all models registered 00239 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00240 this -> GetModel(i) -> SetDataPointUpperBoundaries(datasetupperboundaries); 00241 }
void BCModelManager::SetDataPointUpperBoundary | ( | int | index, | |
double | upperboundary | |||
) |
Sets the upper boundary of possible data values for a particular variable
Definition at line 254 of file BCModelManager.cxx.
00255 { 00256 // set upper boundary values for all models registered 00257 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00258 this -> GetModel(i) -> SetDataPointUpperBoundary(index, upperboundary); 00259 }
void BCModelManager::SetDataSet | ( | BCDataSet * | dataset | ) |
Sets the data set common to all BCModels in this BCModelManager.
dataset | A data set |
Definition at line 60 of file BCModelManager.cxx.
00061 { 00062 // set data set 00063 fDataSet = dataset; 00064 00065 // set data set of all models in the manager 00066 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00067 this -> GetModel(i) -> SetDataSet(fDataSet); 00068 }
void BCModelManager::SetFillErrorBand | ( | bool | flag = true |
) |
Turn on or off the filling of the error band during the MCMC run for all models added to the model manager before calling this method.
flag | set to true for turning on the filling |
Definition at line 192 of file BCModelManager.cxx.
00193 { 00194 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00195 this -> GetModel(i) -> SetFillErrorBand(flag); 00196 }
void BCModelManager::SetFitFunctionIndexX | ( | int | index | ) |
Sets index of the x values in function fits.
index | Index of the x values |
Definition at line 200 of file BCModelManager.cxx.
00201 { 00202 // set fit function x index for all models registered 00203 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00204 this -> GetModel(i) -> SetFitFunctionIndexX(index); 00205 }
void BCModelManager::SetFitFunctionIndexY | ( | int | index | ) |
Sets index of the y values in function fits.
index | Index of the y values |
Definition at line 209 of file BCModelManager.cxx.
00210 { 00211 // set fit function y index for all models registered 00212 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00213 this -> GetModel(i) -> SetFitFunctionIndexY(index); 00214 }
void BCModelManager::SetFitFunctionIndices | ( | int | indexx, | |
int | indexy | |||
) |
Definition at line 218 of file BCModelManager.cxx.
00219 { 00220 // set fit function indices for all models registered 00221 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00222 this -> GetModel(i) -> SetFitFunctionIndices(indexx, indexy); 00223 }
void BCModelManager::SetFlagPCA | ( | bool | flag | ) |
Definition at line 290 of file BCModelManager.cxx.
00291 { 00292 // sets the flag for PCA 00293 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00294 this -> GetModel(i) -> MCMCSetFlagPCA(flag); 00295 }
void BCModelManager::SetIntegrationMethod | ( | BCIntegrate::BCIntegrationMethod | method | ) |
method | The integration method |
Definition at line 128 of file BCModelManager.cxx.
00129 { 00130 // set integration method for all models registered 00131 00132 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00133 this -> GetModel(i) -> SetIntegrationMethod(method); 00134 }
void BCModelManager::SetMarginalizationMethod | ( | BCIntegrate::BCMarginalizationMethod | method | ) |
Sets the maximum number of iterations for the Monte Carlo integration for all BCModels in this BCModelManager.
niterations | ||
method | The marginalization method |
Definition at line 138 of file BCModelManager.cxx.
00139 { 00140 // set marginalization method for all models registered 00141 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00142 this -> GetModel(i) -> SetMarginalizationMethod(method); 00143 };
void BCModelManager::SetNbins | ( | unsigned int | n | ) |
n | Number of bins per dimension for the marginalized distributions. Default is 100. Minimum number allowed is 2. |
Definition at line 183 of file BCModelManager.cxx.
00184 { 00185 // set number of bins for all models registered 00186 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00187 this -> GetModel(i) -> BCIntegrate::SetNbins(n); 00188 }
void BCModelManager::SetNChains | ( | unsigned int | n | ) |
Definition at line 281 of file BCModelManager.cxx.
00282 { 00283 // set number of Markov chains for all models registered 00284 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00285 this -> GetModel(i) -> MCMCSetNChains(n); 00286 }
void BCModelManager::SetNiterationsPerDimension | ( | unsigned int | niterations | ) |
niterations | Number of iterations per dimension for Monte Carlo integration. |
Definition at line 156 of file BCModelManager.cxx.
00157 { 00158 // set number of iterations per dimension for all models registered 00159 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00160 this -> GetModel(i) -> SetNiterationsPerDimension(niterations); 00161 }
void BCModelManager::SetNSamplesPer2DBin | ( | unsigned int | n | ) |
n | Number of samples per 2D bin per variable in the Metropolis marginalization. Default is 100. |
Definition at line 165 of file BCModelManager.cxx.
00166 { 00167 // set samples per 2d bin for all models registered 00168 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00169 this -> GetModel(i) -> SetNSamplesPer2DBin(n); 00170 }
void BCModelManager::SetOptimizationMethod | ( | BCIntegrate::BCOptimizationMethod | method | ) |
method | The mode finding method |
Definition at line 147 of file BCModelManager.cxx.
00148 { 00149 // set mode finding method for all models registered 00150 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00151 this -> GetModel(i) -> SetOptimizationMethod(method); 00152 }
void BCModelManager::SetRelativePrecision | ( | double | relprecision | ) |
relprecision | The relative precision envisioned for Monte Carlo integration |
Definition at line 174 of file BCModelManager.cxx.
00175 { 00176 // set relative precision for all models registered 00177 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00178 this -> GetModel(i) -> SetRelativePrecision(relprecision); 00179 }
void BCModelManager::SetSingleDataPoint | ( | BCDataSet * | dataset, | |
unsigned int | index | |||
) |
Sets a single data point as a common data set.
dataset | A data set. | |
index | The index of the data point in the data set specified. |
Definition at line 86 of file BCModelManager.cxx.
00087 { 00088 if (index < 0 || index > dataset -> GetNDataPoints()) 00089 return; 00090 00091 this -> SetSingleDataPoint(dataset -> GetDataPoint(index)); 00092 }
void BCModelManager::SetSingleDataPoint | ( | BCDataPoint * | datapoint | ) |
Sets a single data point as a common data set.
datapoint | A data point |
Definition at line 72 of file BCModelManager.cxx.
00073 { 00074 // create new data set consisting of a single data point 00075 BCDataSet * dataset = new BCDataSet(); 00076 00077 // add the data point 00078 dataset -> AddDataPoint(datapoint); 00079 00080 // set this new data set 00081 this -> SetDataSet(dataset); 00082 }
void BCModelManager::UnetFillErrorBand | ( | ) | [inline] |
Turn off the filling of the error band during the MCMC run for all models added to the model manager before calling this method.
Definition at line 172 of file BCModelManager.h.
00173 { SetFillErrorBand(false); };
void BCModelManager::WriteMarkovChain | ( | bool | flag | ) |
Definition at line 466 of file BCModelManager.cxx.
00467 { 00468 // marginalizes all models registered 00469 for (unsigned int i = 0; i < this -> GetNModels(); i++) 00470 this -> GetModel(i) -> WriteMarkovChain(flag); 00471 }
BCDataSet* BCModelManager::fDataSet [private] |
The data set common to all models.
Definition at line 338 of file BCModelManager.h.
BCModelContainer* BCModelManager::fModelContainer [private] |
The BCModelContainer containing all BCModels.
Definition at line 334 of file BCModelManager.h.