49 TMVA::MCFitter::MCFitter( IFitterTarget& target,
51 const
std::vector<Interval*>& ranges,
53 :
TMVA::FitterBase( target, name, ranges, theOption ),
69 "If > 0: new points are generated according to Gauss around best value and with \"Sigma\" in units of interval length" );
86 Log() <<
kINFO <<
"<MCFitter> Sampling, please be patient ..." <<
Endl;
89 if ((
Int_t)pars.size() != GetNpars())
90 Log() <<
kFATAL <<
"<Run> Mismatch in number of parameters: "
91 << GetNpars() <<
" != " << pars.size() <<
Endl;
96 std::vector<Double_t> parameters;
97 std::vector<Double_t> bestParameters;
102 std::vector<TMVA::GeneticRange*> rndRanges;
105 std::vector< TMVA::Interval* >::const_iterator rIt;
107 for (rIt = fRanges.begin(); rIt<fRanges.end(); rIt++) {
109 val = rndRanges.back()->Random();
110 parameters.push_back( val );
111 bestParameters.push_back( val );
114 std::vector<Double_t>::iterator parIt;
115 std::vector<Double_t>::iterator parBestIt;
121 for (
Int_t sample = 0; sample < fSamples; sample++) {
124 parIt = parameters.begin();
126 parBestIt = bestParameters.begin();
127 for (std::vector<TMVA::GeneticRange*>::iterator rndIt = rndRanges.begin(); rndIt<rndRanges.end(); rndIt++) {
128 (*parIt) = (*rndIt)->Random(
kTRUE, (*parBestIt), fSigma );
134 for (std::vector<TMVA::GeneticRange*>::iterator rndIt = rndRanges.begin(); rndIt<rndRanges.end(); rndIt++) {
135 (*parIt) = (*rndIt)->Random();
141 estimator = EstimatorFunction( parameters );
144 if (estimator < bestFit || sample==0) {
146 bestParameters.swap( parameters );
152 pars.swap( bestParameters );
Random number generator class based on M.
MsgLogger & Endl(MsgLogger &ml)
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
ClassImp(TMVA::MCFitter) TMVA
constructor
TString GetElapsedTime(Bool_t Scientific=kTRUE)
void DeclareOptions()
Declare MCFitter options.
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
Abstract ClassifierFactory template that handles arbitrary types.
void DrawProgressBar(Int_t, const TString &comment="")
draws progress bar in color or B&W caution: