53 const std::vector<
Interval*>& ranges,
55 : TMVA::
FitterBase( target, name, ranges, theOption ),
71 "If > 0: new points are generated according to Gauss around best value and with \"Sigma\" in units of interval length" );
88 Log() << kHEADER <<
"<MCFitter> Sampling, please be patient ..." <<
Endl;
91 if ((
Int_t)pars.size() != GetNpars())
92 Log() << kFATAL <<
"<Run> Mismatch in number of parameters: "
93 << GetNpars() <<
" != " << pars.size() <<
Endl;
97 if (fIPyMaxIter) *fIPyMaxIter = fSamples;
99 std::vector<Double_t> parameters;
100 std::vector<Double_t> bestParameters;
105 std::vector<TMVA::GeneticRange*> rndRanges;
108 std::vector< TMVA::Interval* >::const_iterator rIt;
110 for (rIt = fRanges.begin(); rIt<fRanges.end(); rIt++) {
112 val = rndRanges.back()->Random();
113 parameters.push_back( val );
114 bestParameters.push_back( val );
117 std::vector<Double_t>::iterator parIt;
118 std::vector<Double_t>::iterator parBestIt;
124 for (
Int_t sample = 0; sample < fSamples; sample++) {
125 if (fIPyCurrentIter) *fIPyCurrentIter = sample;
126 if (fExitFromTraining && *fExitFromTraining)
break;
129 parIt = parameters.begin();
131 parBestIt = bestParameters.begin();
132 for (std::vector<TMVA::GeneticRange*>::iterator rndIt = rndRanges.begin(); rndIt<rndRanges.end(); rndIt++) {
133 (*parIt) = (*rndIt)->Random(
kTRUE, (*parBestIt), fSigma );
139 for (std::vector<TMVA::GeneticRange*>::iterator rndIt = rndRanges.begin(); rndIt<rndRanges.end(); rndIt++) {
140 (*parIt) = (*rndIt)->Random();
146 estimator = EstimatorFunction( parameters );
149 if (estimator < bestFit || sample==0) {
151 bestParameters.swap( parameters );
157 pars.swap( bestParameters );
std::string GetName(const std::string &scope_name)
Random number generator class based on M.
MsgLogger & Endl(MsgLogger &ml)
Base class for TMVA fitters.
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
Double_t Run()
estimator function interface for fitting
void SetParameters(Int_t cycles)
set MC fitter configuration parameters
TString GetElapsedTime(Bool_t Scientific=kTRUE)
returns pretty string with elapsed time
The TMVA::Interval Class.
Fitter using Monte Carlo sampling of parameters.
void DeclareOptions()
Declare MCFitter options.
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
void DrawProgressBar(Int_t, const TString &comment="")
draws progress bar in color or B&W caution:
Interface for a fitter 'target'.
Range definition for genetic algorithm.
Timing information for training and evaluation of MVA methods.