107 fVRangeMode(kAdaptive),
108 fKernelEstimator(
kBox),
121 fInitializedVolumeEle(0),
136 const TString& theWeightFile) :
139 fVRangeMode(kAdaptive),
140 fKernelEstimator(
kBox),
153 fInitializedVolumeEle(0),
185 fVRangeMode = kAdaptive;
186 fKernelEstimator =
kBox;
191 fMaxVIterations = 150;
192 fInitialScale = 0.99;
196 fkNNMin =
Int_t(fNEventsMin);
197 fkNNMax =
Int_t(fNEventsMax);
199 fInitializedVolumeEle =
kFALSE;
203 SetSignalReferenceCut( 0.0 );
211 if (fDelta)
delete fDelta;
212 if (fShift)
delete fShift;
214 if (NULL != fBinaryTree)
delete fBinaryTree;
255 DeclareOptionRef(fVolumeRange=
"Adaptive",
"VolumeRangeMode",
"Method to determine volume size");
256 AddPreDefVal(
TString(
"Unscaled"));
257 AddPreDefVal(
TString(
"MinMax"));
259 AddPreDefVal(
TString(
"Adaptive"));
262 DeclareOptionRef(fKernelString=
"Box",
"KernelEstimator",
"Kernel estimation function");
264 AddPreDefVal(
TString(
"Sphere"));
265 AddPreDefVal(
TString(
"Teepee"));
266 AddPreDefVal(
TString(
"Gauss"));
267 AddPreDefVal(
TString(
"Sinc3"));
268 AddPreDefVal(
TString(
"Sinc5"));
269 AddPreDefVal(
TString(
"Sinc7"));
270 AddPreDefVal(
TString(
"Sinc9"));
271 AddPreDefVal(
TString(
"Sinc11"));
272 AddPreDefVal(
TString(
"Lanczos2"));
273 AddPreDefVal(
TString(
"Lanczos3"));
274 AddPreDefVal(
TString(
"Lanczos5"));
275 AddPreDefVal(
TString(
"Lanczos8"));
278 DeclareOptionRef(fDeltaFrac ,
"DeltaFrac",
"nEventsMin/Max for minmax and rms volume range");
279 DeclareOptionRef(fNEventsMin ,
"NEventsMin",
"nEventsMin for adaptive volume range");
280 DeclareOptionRef(fNEventsMax ,
"NEventsMax",
"nEventsMax for adaptive volume range");
281 DeclareOptionRef(fMaxVIterations,
"MaxVIterations",
"MaxVIterations for adaptive volume range");
282 DeclareOptionRef(fInitialScale ,
"InitialScale",
"InitialScale for adaptive volume range");
283 DeclareOptionRef(fGaussSigma ,
"GaussSigma",
"Width (wrt volume size) of Gaussian kernel estimator");
284 DeclareOptionRef(fNormTree ,
"NormTree",
"Normalize binary search tree");
292 if (IgnoreEventsWithNegWeightsInTraining()) {
293 Log() << kFATAL <<
"Mechanism to ignore events with negative weights in training not yet available for method: "
294 << GetMethodTypeName()
295 <<
" --> please remove \"IgnoreNegWeightsInTraining\" option from booking string."
299 fGaussSigmaNorm = fGaussSigma;
303 if (fVolumeRange ==
"MinMax" ) fVRangeMode = kMinMax;
304 else if (fVolumeRange ==
"RMS" ) fVRangeMode = kRMS;
305 else if (fVolumeRange ==
"Adaptive" ) fVRangeMode = kAdaptive;
306 else if (fVolumeRange ==
"Unscaled" ) fVRangeMode = kUnscaled;
307 else if (fVolumeRange ==
"kNN" ) fVRangeMode = kkNN;
309 Log() << kFATAL <<
"VolumeRangeMode parameter '" << fVolumeRange <<
"' unknown" <<
Endl;
312 if (fKernelString ==
"Box" ) fKernelEstimator =
kBox;
313 else if (fKernelString ==
"Sphere" ) fKernelEstimator = kSphere;
314 else if (fKernelString ==
"Teepee" ) fKernelEstimator = kTeepee;
315 else if (fKernelString ==
"Gauss" ) fKernelEstimator =
kGauss;
316 else if (fKernelString ==
"Sinc3" ) fKernelEstimator = kSinc3;
317 else if (fKernelString ==
"Sinc5" ) fKernelEstimator = kSinc5;
318 else if (fKernelString ==
"Sinc7" ) fKernelEstimator = kSinc7;
319 else if (fKernelString ==
"Sinc9" ) fKernelEstimator = kSinc9;
320 else if (fKernelString ==
"Sinc11" ) fKernelEstimator = kSinc11;
321 else if (fKernelString ==
"Lanczos2" ) fKernelEstimator = kLanczos2;
322 else if (fKernelString ==
"Lanczos3" ) fKernelEstimator = kLanczos3;
323 else if (fKernelString ==
"Lanczos5" ) fKernelEstimator = kLanczos5;
324 else if (fKernelString ==
"Lanczos8" ) fKernelEstimator = kLanczos8;
325 else if (fKernelString ==
"Trim" ) fKernelEstimator = kTrim;
327 Log() << kFATAL <<
"KernelEstimator parameter '" << fKernelString <<
"' unknown" <<
Endl;
332 Log() << kVERBOSE <<
"interpreted option string: vRangeMethod: '"
333 << (
const char*)((fVRangeMode == kMinMax) ?
"MinMax" :
334 (fVRangeMode == kUnscaled) ?
"Unscaled" :
335 (fVRangeMode == kRMS ) ?
"RMS" :
"Adaptive") <<
"'" <<
Endl;
336 if (fVRangeMode == kMinMax || fVRangeMode == kRMS)
337 Log() << kVERBOSE <<
"deltaFrac: " << fDeltaFrac <<
Endl;
339 Log() << kVERBOSE <<
"nEventsMin/Max, maxVIterations, initialScale: "
340 << fNEventsMin <<
" " << fNEventsMax
341 <<
" " << fMaxVIterations <<
" " << fInitialScale <<
Endl;
342 Log() << kVERBOSE <<
"KernelEstimator = " << fKernelString <<
Endl;
353 if (IsNormalised())
Log() << kFATAL <<
"\"Normalise\" option cannot be used with PDERS; "
354 <<
"please remove the option from the configuration string, or "
355 <<
"use \"!Normalise\""
363 fInitializedVolumeEle =
kTRUE;
373 if (fInitializedVolumeEle ==
kFALSE) {
374 fInitializedVolumeEle =
kTRUE;
377 assert( fBinaryTree );
384 NoErrorCalc(err, errUpper);
386 return this->CRScalc( *GetEvent() );
393 if (fRegressionReturnVal == 0) fRegressionReturnVal =
new std::vector<Float_t>;
394 fRegressionReturnVal->clear();
397 if (fInitializedVolumeEle ==
kFALSE) {
398 fInitializedVolumeEle =
kTRUE;
401 assert( fBinaryTree );
408 const Event* ev = GetEvent();
409 this->RRScalc( *ev, fRegressionReturnVal );
413 for (std::vector<Float_t>::iterator it = fRegressionReturnVal->begin(); it != fRegressionReturnVal->end(); ++it ) {
418 const Event* evT2 = GetTransformationHandler().InverseTransform( evT );
419 fRegressionReturnVal->clear();
422 fRegressionReturnVal->push_back(evT2->
GetTarget(ivar));
428 return (*fRegressionReturnVal);
436 if (fVRangeMode == kAdaptive || fVRangeMode == kRMS || fVRangeMode == kkNN ) {
438 fBinaryTree->CalcStatistics();
440 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
441 if (!DoRegression()){
444 fAverageRMS.push_back( (rmsS + rmsB)*0.5 );
446 Float_t rms = fBinaryTree->RMS( ivar );
447 fAverageRMS.push_back( rms );
458 if (NULL != fBinaryTree)
delete fBinaryTree;
461 fBinaryTree->SetNormalize(
kTRUE );
464 fBinaryTree->Fill( GetEventCollection(
type) );
467 fBinaryTree->NormalizeTree();
470 if (!DoRegression()) {
475 Log() << kVERBOSE <<
"Signal and background scales: " << fScaleS <<
" " << fScaleB <<
Endl;
484 Log() << kFATAL <<
"GetNvar() == 0" <<
Endl;
489 fkNNMin =
Int_t(fNEventsMin);
490 fkNNMax =
Int_t(fNEventsMax);
492 if (fDelta)
delete fDelta;
493 if (fShift)
delete fShift;
494 fDelta =
new std::vector<Float_t>( GetNvar() );
495 fShift =
new std::vector<Float_t>( GetNvar() );
497 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
498 switch (fVRangeMode) {
504 if (fAverageRMS.size() != GetNvar())
505 Log() << kFATAL <<
"<SetVolumeElement> RMS not computed: " << fAverageRMS.size() <<
Endl;
506 (*fDelta)[ivar] = fAverageRMS[ivar]*fDeltaFrac;
507 Log() << kVERBOSE <<
"delta of var[" << (*fInputVars)[ivar]
508 <<
"\t]: " << fAverageRMS[ivar]
509 <<
"\t | comp with |max - min|: " << (GetXmax( ivar ) - GetXmin( ivar ))
513 (*fDelta)[ivar] = (GetXmax( ivar ) - GetXmin( ivar ))*fDeltaFrac;
516 (*fDelta)[ivar] = fDeltaFrac;
519 Log() << kFATAL <<
"<SetVolumeElement> unknown range-set mode: "
520 << fVRangeMode <<
Endl;
522 (*fShift)[ivar] = 0.5;
532 return ThisPDERS()->GetVolumeContentForRoot( scale );
541 v.ScaleInterval( scale );
543 Double_t count = GetBinaryTree()->SearchVolume( &
v );
550 std::vector<const BinarySearchTreeNode*>& events,
561#ifdef TMVA_MethodPDERS__countByHand__Debug__
564 count = fBinaryTree->SearchVolume( volume );
566 Int_t iS = 0, iB = 0;
568 for (
UInt_t ievt_=0; ievt_<Data()->GetNTrainingEvents(); ievt_++) {
569 const Event * ev = GetTrainingEvent(ievt_);
571 for (
Int_t ivar=0; ivar<nvar; ivar++) {
573 inV = (
x > (*volume->Lower)[ivar] &&
x <= (*volume->Upper)[ivar]);
580 Log() << kVERBOSE <<
"debug: my test: " << in <<
Endl;
581 Log() << kVERBOSE <<
"debug: binTree: " << count <<
Endl <<
Endl;
587 if (fVRangeMode == kRMS || fVRangeMode == kMinMax || fVRangeMode == kUnscaled) {
589 std::vector<Double_t> *lb =
new std::vector<Double_t>( GetNvar() );
590 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) (*lb)[ivar] =
e.GetValue(ivar);
591 std::vector<Double_t> *ub =
new std::vector<Double_t>( *lb );
592 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
593 (*lb)[ivar] -= (*fDelta)[ivar]*(1.0 - (*fShift)[ivar]);
594 (*ub)[ivar] += (*fDelta)[ivar]*(*fShift)[ivar];
599 fBinaryTree->SearchVolume( svolume, &events );
601 else if (fVRangeMode == kAdaptive) {
607 if (MethodPDERS_UseFindRoot) {
611 fHelpVolume = volume;
614 RootFinder rootFinder(
this, 0.01, 50, 200, 10 );
615 Double_t scale = rootFinder.
Root( (fNEventsMin + fNEventsMax)/2.0 );
619 fBinaryTree->SearchVolume( volume, &events );
627 count = fBinaryTree->SearchVolume( volume );
632 while (nEventsO < fNEventsMin) {
634 count = fBinaryTree->SearchVolume( volume );
638 if (i_ > 50)
Log() << kWARNING <<
"warning in event: " <<
e
639 <<
": adaptive volume pre-adjustment reached "
640 <<
">50 iterations in while loop (" << i_ <<
")" <<
Endl;
643 Float_t nEventsE = 0.5*(fNEventsMin + fNEventsMax);
645 Float_t scaleN = fInitialScale;
648 Float_t nEventsBest = nEventsN;
650 for (
Int_t ic=1; ic<fMaxVIterations; ic++) {
651 if (nEventsN < fNEventsMin || nEventsN > fNEventsMax) {
655 v->ScaleInterval( scale );
656 nEventsN = fBinaryTree->SearchVolume(
v );
659 if (nEventsN > 1 && nEventsN - nEventsO != 0)
660 if (scaleN - scaleO != 0)
661 scale += (scaleN - scaleO)/(nEventsN - nEventsO)*(nEventsE - nEventsN);
672 (nEventsN >= fNEventsMin || nEventsBest < nEventsN)) {
673 nEventsBest = nEventsN;
684 nEventsN = nEventsBest;
686 if (nEventsN < fNEventsMin-1 || nEventsN > fNEventsMax+1)
687 Log() << kWARNING <<
"warning in event " <<
e
688 <<
": adaptive volume adjustment reached "
689 <<
"max. #iterations (" << fMaxVIterations <<
")"
690 <<
"[ nEvents: " << nEventsN <<
" " << fNEventsMin <<
" " << fNEventsMax <<
"]"
694 fBinaryTree->SearchVolume( volume, &events );
699 }
else if (fVRangeMode == kkNN) {
704 Int_t kNNcount = fBinaryTree->SearchVolumeWithMaxLimit( &
v, &events, fkNNMax+1 );
709 while ( !(kNNcount >= fkNNMin && kNNcount <= fkNNMax) ) {
710 if (kNNcount < fkNNMin) {
714 else if (kNNcount > fkNNMax) {
722 kNNcount = fBinaryTree->SearchVolumeWithMaxLimit( &
v, &events, fkNNMax+1 );
726 if (t_times == fMaxVIterations) {
727 Log() << kWARNING <<
"warning in event" <<
e
728 <<
": kNN volume adjustment reached "
729 <<
"max. #iterations (" << fMaxVIterations <<
")"
730 <<
"[ kNN: " << fkNNMin <<
" " << fkNNMax <<
Endl;
737 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
738 dim_normalization [ivar] = 1.0 / ((*
v.fUpper)[ivar] - (*
v.fLower)[ivar]);
741 std::vector<const BinarySearchTreeNode*> tempVector;
743 if (kNNcount >= fkNNMin) {
744 std::vector<Double_t> *distances =
new std::vector<Double_t>( kNNcount );
748 (*distances)[j] = GetNormalizedDistance (
e, *events[j], dim_normalization );
751 std::vector<Double_t>::iterator wsk = distances->begin();
752 for (
Int_t j=0;j<fkNNMin-1;++j) ++wsk;
753 std::nth_element( distances->begin(), wsk, distances->end() );
758 Double_t dist = GetNormalizedDistance(
e, *events[j], dim_normalization );
760 if (
dist <= (*distances)[fkNNMin-1])
761 tempVector.push_back( events[j] );
763 fMax_distance = (*distances)[fkNNMin-1];
766 delete[] dim_normalization;
772 Log() << kFATAL <<
"<GetSample> unknown RangeMode: " << fVRangeMode <<
Endl;
781 std::vector<const BinarySearchTreeNode*> events;
786 std::vector<Double_t> *lb =
new std::vector<Double_t>( GetNvar() );
787 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) (*lb)[ivar] =
e.GetValue(ivar);
789 std::vector<Double_t> *ub =
new std::vector<Double_t>( *lb );
790 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
791 (*lb)[ivar] -= (*fDelta)[ivar]*(1.0 - (*fShift)[ivar]);
792 (*ub)[ivar] += (*fDelta)[ivar]*(*fShift)[ivar];
797 GetSample(
e, events, volume );
798 Double_t count = CKernelEstimate(
e, events, *volume );
810 std::vector<const BinarySearchTreeNode*> events;
815 std::vector<Double_t> *lb =
new std::vector<Double_t>( GetNvar() );
816 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) (*lb)[ivar] =
e.GetValue(ivar);
818 std::vector<Double_t> *ub =
new std::vector<Double_t>( *lb );
819 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
820 (*lb)[ivar] -= (*fDelta)[ivar]*(1.0 - (*fShift)[ivar]);
821 (*ub)[ivar] += (*fDelta)[ivar]*(*fShift)[ivar];
825 GetSample(
e, events, volume );
826 RKernelEstimate(
e, events, *volume, count );
836 std::vector<const BinarySearchTreeNode*>& events,
Volume&
v )
839 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++)
840 dim_normalization [ivar] = 2 / ((*
v.fUpper)[ivar] - (*
v.fLower)[ivar]);
846 for (std::vector<const BinarySearchTreeNode*>::iterator iev = events.begin(); iev != events.end(); ++iev) {
849 Double_t normalized_distance = GetNormalizedDistance (event, *(*iev), dim_normalization);
853 if (normalized_distance > 1 && fKernelEstimator !=
kBox)
continue;
855 if ( (*iev)->GetClass()==fSignalClass )
856 pdfSumS += ApplyKernelFunction (normalized_distance) * (*iev)->GetWeight();
858 pdfSumB += ApplyKernelFunction (normalized_distance) * (*iev)->GetWeight();
860 pdfSumS = KernelNormalization( pdfSumS < 0. ? 0. : pdfSumS );
861 pdfSumB = KernelNormalization( pdfSumB < 0. ? 0. : pdfSumB );
863 delete[] dim_normalization;
865 if (pdfSumS < 1
e-20 && pdfSumB < 1
e-20)
return 0.5;
866 if (pdfSumB < 1
e-20)
return 1.0;
867 if (pdfSumS < 1
e-20)
return 0.0;
869 Float_t r = pdfSumB*fScaleB/(pdfSumS*fScaleS);
870 return 1.0/(
r + 1.0);
877 std::vector<const BinarySearchTreeNode*>& events,
Volume&
v,
878 std::vector<Float_t>* pdfSum )
881 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++)
882 dim_normalization [ivar] = 2 / ((*
v.fUpper)[ivar] - (*
v.fLower)[ivar]);
889 for (
Int_t ivar = 0; ivar < fNRegOut ; ivar++)
890 pdfSum->push_back( 0 );
893 for (std::vector<const BinarySearchTreeNode*>::iterator iev = events.begin(); iev != events.end(); ++iev) {
896 Double_t normalized_distance = GetNormalizedDistance (event, *(*iev), dim_normalization);
900 if (normalized_distance > 1 && fKernelEstimator !=
kBox)
continue;
902 for (
Int_t ivar = 0; ivar < fNRegOut ; ivar++) {
903 pdfSum->at(ivar) += ApplyKernelFunction (normalized_distance) * (*iev)->GetWeight() * (*iev)->GetTargets()[ivar];
904 pdfDiv += ApplyKernelFunction (normalized_distance) * (*iev)->GetWeight();
908 delete[] dim_normalization;
913 for (
Int_t ivar = 0; ivar < fNRegOut ; ivar++)
914 pdfSum->at(ivar) /= pdfDiv;
925 switch (fKernelEstimator) {
931 return (1 - normalized_distance);
941 Double_t side_crossings = 2 + ((
int) fKernelEstimator) - ((
int) kSinc3);
942 return NormSinc (side_crossings * normalized_distance);
946 return LanczosFilter (2, normalized_distance);
949 return LanczosFilter (3, normalized_distance);
952 return LanczosFilter (5, normalized_distance);
955 return LanczosFilter (8, normalized_distance);
958 Double_t x = normalized_distance / fMax_distance;
964 Log() << kFATAL <<
"Kernel estimation function unsupported. Enumerator is " << fKernelEstimator <<
Endl;
981 if (ret != 0.0)
return ret*pdf;
984 switch (fKernelEstimator) {
1010 Log() << kFATAL <<
"Kernel estimation function unsupported. Enumerator is " << fKernelEstimator <<
Endl;
1028 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1042 if (x < 10e-10 && x > -10
e-10) {
1063 if (x < 10e-10 && x > -10
e-10) {
1087 if (
d < 1
e-10)
return 1;
1090 Float_t err =
f*countB*countB*sumW2S +
f*countS*countS*sumW2B;
1092 if (err < 1
e-10)
return 1;
1104 fBinaryTree->AddXMLTo(wght);
1106 Log() << kFATAL <<
"Signal and background binary search tree not available" <<
Endl;
1114 if (NULL != fBinaryTree)
delete fBinaryTree;
1118 Log() << kFATAL <<
"Could not create BinarySearchTree from XML" <<
Endl;
1120 Log() << kFATAL <<
"Could not create BinarySearchTree from XML" <<
Endl;
1121 fBinaryTree->SetPeriode( GetNvar() );
1122 fBinaryTree->CalcStatistics();
1123 fBinaryTree->CountNodes();
1130 Log() << kINFO <<
"signal and background scales: " << fScaleS <<
" " << fScaleB <<
Endl;
1133 fInitializedVolumeEle =
kTRUE;
1141 if (NULL != fBinaryTree)
delete fBinaryTree;
1145 istr >> *fBinaryTree;
1147 fBinaryTree->SetPeriode( GetNvar() );
1149 fBinaryTree->CalcStatistics();
1151 fBinaryTree->CountNodes();
1157 Log() << kINFO <<
"signal and background scales: " << fScaleS <<
" " << fScaleB <<
Endl;
1163 fInitializedVolumeEle =
kTRUE;
1185 return GetMethodPDERSThreadLocal();
1192 GetMethodPDERSThreadLocal() =
this;
1200 fout <<
" // not implemented for class: \"" << className <<
"\"" << std::endl;
1201 fout <<
"};" << std::endl;
1215 Log() <<
"PDERS is a generalization of the projective likelihood classifier " <<
Endl;
1216 Log() <<
"to N dimensions, where N is the number of input variables used." <<
Endl;
1217 Log() <<
"In its adaptive form it is mostly equivalent to k-Nearest-Neighbor" <<
Endl;
1218 Log() <<
"(k-NN) methods. If the multidimensional PDF for signal and background" <<
Endl;
1219 Log() <<
"were known, this classifier would exploit the full information" <<
Endl;
1220 Log() <<
"contained in the input variables, and would hence be optimal. In " <<
Endl;
1221 Log() <<
"practice however, huge training samples are necessary to sufficiently " <<
Endl;
1222 Log() <<
"populate the multidimensional phase space. " <<
Endl;
1224 Log() <<
"The simplest implementation of PDERS counts the number of signal" <<
Endl;
1225 Log() <<
"and background events in the vicinity of a test event, and returns" <<
Endl;
1226 Log() <<
"a weight according to the majority species of the neighboring events." <<
Endl;
1227 Log() <<
"A more involved version of PDERS (selected by the option \"KernelEstimator\")" <<
Endl;
1228 Log() <<
"uses Kernel estimation methods to approximate the shape of the PDF." <<
Endl;
1232 Log() <<
"PDERS can be very powerful in case of strongly non-linear problems, " <<
Endl;
1233 Log() <<
"e.g., distinct islands of signal and background regions. Because of " <<
Endl;
1234 Log() <<
"the exponential growth of the phase space, it is important to restrict" <<
Endl;
1235 Log() <<
"the number of input variables (dimension) to the strictly necessary." <<
Endl;
1237 Log() <<
"Note that PDERS is a slowly responding classifier. Moreover, the necessity" <<
Endl;
1238 Log() <<
"to store the entire binary tree in memory, to avoid accessing virtual " <<
Endl;
1239 Log() <<
"memory, limits the number of training events that can effectively be " <<
Endl;
1240 Log() <<
"used to model the multidimensional PDF." <<
Endl;
1244 Log() <<
"If the PDERS response is found too slow when using the adaptive volume " <<
Endl;
1245 Log() <<
"size (option \"VolumeRangeMode=Adaptive\"), it might be found beneficial" <<
Endl;
1246 Log() <<
"to reduce the number of events required in the volume, and/or to enlarge" <<
Endl;
1247 Log() <<
"the allowed range (\"NeventsMin/Max\"). PDERS is relatively insensitive" <<
Endl;
1248 Log() <<
"to the width (\"GaussSigma\") of the Gaussian kernel (if used)." <<
Endl;
#define REGISTER_METHOD(CLASS)
for example
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Node for the BinarySearch or Decision Trees.
const std::vector< Float_t > & GetEventV() const
A simple Binary search tree including a volume search method.
static BinarySearchTree * CreateFromXML(void *node, UInt_t tmva_Version_Code=TMVA_VERSION_CODE)
re-create a new tree (decision tree or search tree) from XML
Class that contains all the data information.
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
void SetTarget(UInt_t itgt, Float_t value)
set the target value (dimension itgt) to value
UInt_t GetNTargets() const
accessor to the number of targets
Float_t GetTarget(UInt_t itgt) const
Virtual base Class for all MVA method.
This is a generalization of the above Likelihood methods to dimensions, where is the number of inpu...
void WriteWeightsToStream(TFile &rf) const
write training sample (TTree) to file
void CreateBinarySearchTree(Types::ETreeType type)
create binary search trees for signal and background
BinarySearchTree * fBinaryTree
virtual ~MethodPDERS(void)
destructor
MethodPDERS(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption)
standard constructor for the PDERS method
void GetSample(const Event &e, std::vector< const BinarySearchTreeNode * > &events, Volume *volume)
Float_t GetError(Float_t countS, Float_t countB, Float_t sumW2S, Float_t sumW2B) const
statistical error estimate for RS estimator
static MethodPDERS * ThisPDERS(void)
static pointer to this object
Double_t KernelNormalization(Double_t pdf)
Calculating the normalization factor only once (might need a reset at some point.
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
init the size of a volume element using a defined fraction of the volume containing the entire events
void ReadWeightsFromXML(void *wghtnode)
void ProcessOptions()
process the options specified by the user
void RRScalc(const Event &, std::vector< Float_t > *count)
void GetHelpMessage() const
get help message text
void UpdateThis()
update static this pointer
void Train(void)
this is a dummy training: the preparation work to do is the construction of the binary tree as a poin...
void MakeClassSpecific(std::ostream &, const TString &) const
write specific classifier response
Double_t CRScalc(const Event &)
void DeclareOptions()
define the options (their key words) that can be set in the option string.
void CalcAverages()
compute also average RMS values required for adaptive Gaussian
void RKernelEstimate(const Event &, std::vector< const BinarySearchTreeNode * > &, Volume &, std::vector< Float_t > *pdfSum)
normalization factors so we can work with radius 1 hyperspheres
void ReadWeightsFromStream(std::istream &istr)
read weight info from file
const std::vector< Float_t > & GetRegressionValues()
Double_t NormSinc(Double_t x)
NormSinc.
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
PDERS can handle classification with 2 classes and regression with one or more regression-targets.
void AddWeightsXMLTo(void *parent) const
write weights to xml file
void SetVolumeElement(void)
defines volume dimensions
void Init(void)
default initialisation routine called by all constructors
Double_t LanczosFilter(Int_t level, Double_t x)
Lanczos Filter.
Double_t CKernelEstimate(const Event &, std::vector< const BinarySearchTreeNode * > &, Volume &)
normalization factors so we can work with radius 1 hyperspheres
Double_t ApplyKernelFunction(Double_t normalized_distance)
from the normalized euclidean distance calculate the distance for a certain kernel
Double_t GetNormalizedDistance(const TMVA::Event &base_event, const BinarySearchTreeNode &sample_event, Double_t *dim_normalization)
We use Euclidian metric here. Might not be best or most efficient.
static Double_t IGetVolumeContentForRoot(Double_t)
Interface to RootFinder.
Double_t GetVolumeContentForRoot(Double_t)
count number of events in rescaled volume
Root finding using Brents algorithm (translated from CERNLIB function RZERO)
Double_t Root(Double_t refValue)
Root finding using Brents algorithm; taken from CERNLIB function RZERO.
Singleton class for Global types used by TMVA.
Volume for BinarySearchTree.
void ScaleInterval(Double_t f)
"scale" the volume by symmetrically blowing up the interval in each dimension
double dist(Rotation3D const &r1, Rotation3D const &r2)
create variable transformations
MsgLogger & Endl(MsgLogger &ml)
Double_t Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE)
Calculate a gaussian function with mean and sigma.
Double_t Sqrt(Double_t x)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Double_t Gamma(Double_t z)
Computation of gamma(z) for all z.