83 #define TMVA_MethodPDERS__countByHand__Debug__
84 #undef TMVA_MethodPDERS__countByHand__Debug__
98 TMVA::MethodPDERS::MethodPDERS( const
TString& jobName,
100 DataSetInfo& theData,
103 MethodBase( jobName, Types::kPDERS, methodTitle, theData, theOption, theTargetDir ),
105 fVRangeMode(kAdaptive),
106 fKernelEstimator(
kBox),
119 fInitializedVolumeEle(0),
136 fVRangeMode(kAdaptive),
137 fKernelEstimator(
kBox),
150 fInitializedVolumeEle(0),
180 fVRangeMode = kAdaptive;
181 fKernelEstimator =
kBox;
186 fMaxVIterations = 150;
187 fInitialScale = 0.99;
191 fkNNMin =
Int_t(fNEventsMin);
192 fkNNMax =
Int_t(fNEventsMax);
194 fInitializedVolumeEle =
kFALSE;
198 SetSignalReferenceCut( 0.0 );
206 if (fDelta)
delete fDelta;
207 if (fShift)
delete fShift;
209 if (
NULL != fBinaryTree)
delete fBinaryTree;
247 DeclareOptionRef(fVolumeRange=
"Adaptive",
"VolumeRangeMode",
"Method to determine volume size");
248 AddPreDefVal(
TString(
"Unscaled"));
249 AddPreDefVal(
TString(
"MinMax"));
251 AddPreDefVal(
TString(
"Adaptive"));
254 DeclareOptionRef(fKernelString=
"Box",
"KernelEstimator",
"Kernel estimation function");
256 AddPreDefVal(
TString(
"Sphere"));
257 AddPreDefVal(
TString(
"Teepee"));
258 AddPreDefVal(
TString(
"Gauss"));
259 AddPreDefVal(
TString(
"Sinc3"));
260 AddPreDefVal(
TString(
"Sinc5"));
261 AddPreDefVal(
TString(
"Sinc7"));
262 AddPreDefVal(
TString(
"Sinc9"));
263 AddPreDefVal(
TString(
"Sinc11"));
264 AddPreDefVal(
TString(
"Lanczos2"));
265 AddPreDefVal(
TString(
"Lanczos3"));
266 AddPreDefVal(
TString(
"Lanczos5"));
267 AddPreDefVal(
TString(
"Lanczos8"));
270 DeclareOptionRef(fDeltaFrac ,
"DeltaFrac",
"nEventsMin/Max for minmax and rms volume range");
271 DeclareOptionRef(fNEventsMin ,
"NEventsMin",
"nEventsMin for adaptive volume range");
272 DeclareOptionRef(fNEventsMax ,
"NEventsMax",
"nEventsMax for adaptive volume range");
273 DeclareOptionRef(fMaxVIterations,
"MaxVIterations",
"MaxVIterations for adaptive volume range");
274 DeclareOptionRef(fInitialScale ,
"InitialScale",
"InitialScale for adaptive volume range");
275 DeclareOptionRef(fGaussSigma ,
"GaussSigma",
"Width (wrt volume size) of Gaussian kernel estimator");
276 DeclareOptionRef(fNormTree ,
"NormTree",
"Normalize binary search tree");
284 if (IgnoreEventsWithNegWeightsInTraining()) {
285 Log() <<
kFATAL <<
"Mechanism to ignore events with negative weights in training not yet available for method: "
286 << GetMethodTypeName()
287 <<
" --> please remove \"IgnoreNegWeightsInTraining\" option from booking string."
291 fGaussSigmaNorm = fGaussSigma;
295 if (fVolumeRange ==
"MinMax" ) fVRangeMode = kMinMax;
296 else if (fVolumeRange ==
"RMS" ) fVRangeMode = kRMS;
297 else if (fVolumeRange ==
"Adaptive" ) fVRangeMode = kAdaptive;
298 else if (fVolumeRange ==
"Unscaled" ) fVRangeMode = kUnscaled;
299 else if (fVolumeRange ==
"kNN" ) fVRangeMode = kkNN;
301 Log() <<
kFATAL <<
"VolumeRangeMode parameter '" << fVolumeRange <<
"' unknown" <<
Endl;
304 if (fKernelString ==
"Box" ) fKernelEstimator =
kBox;
305 else if (fKernelString ==
"Sphere" ) fKernelEstimator =
kSphere;
306 else if (fKernelString ==
"Teepee" ) fKernelEstimator = kTeepee;
307 else if (fKernelString ==
"Gauss" ) fKernelEstimator = kGauss;
308 else if (fKernelString ==
"Sinc3" ) fKernelEstimator = kSinc3;
309 else if (fKernelString ==
"Sinc5" ) fKernelEstimator = kSinc5;
310 else if (fKernelString ==
"Sinc7" ) fKernelEstimator = kSinc7;
311 else if (fKernelString ==
"Sinc9" ) fKernelEstimator = kSinc9;
312 else if (fKernelString ==
"Sinc11" ) fKernelEstimator = kSinc11;
313 else if (fKernelString ==
"Lanczos2" ) fKernelEstimator = kLanczos2;
314 else if (fKernelString ==
"Lanczos3" ) fKernelEstimator = kLanczos3;
315 else if (fKernelString ==
"Lanczos5" ) fKernelEstimator = kLanczos5;
316 else if (fKernelString ==
"Lanczos8" ) fKernelEstimator = kLanczos8;
317 else if (fKernelString ==
"Trim" ) fKernelEstimator = kTrim;
319 Log() <<
kFATAL <<
"KernelEstimator parameter '" << fKernelString <<
"' unknown" <<
Endl;
324 Log() <<
kVERBOSE <<
"interpreted option string: vRangeMethod: '"
325 << (
const char*)((fVRangeMode == kMinMax) ?
"MinMax" :
326 (fVRangeMode == kUnscaled) ?
"Unscaled" :
327 (fVRangeMode == kRMS ) ?
"RMS" :
"Adaptive") <<
"'" <<
Endl;
328 if (fVRangeMode == kMinMax || fVRangeMode == kRMS)
331 Log() <<
kVERBOSE <<
"nEventsMin/Max, maxVIterations, initialScale: "
332 << fNEventsMin <<
" " << fNEventsMax
333 <<
" " << fMaxVIterations <<
" " << fInitialScale <<
Endl;
345 if (IsNormalised())
Log() <<
kFATAL <<
"\"Normalise\" option cannot be used with PDERS; "
346 <<
"please remove the option from the configuration string, or "
347 <<
"use \"!Normalise\""
355 fInitializedVolumeEle =
kTRUE;
364 if (fInitializedVolumeEle ==
kFALSE) {
365 fInitializedVolumeEle =
kTRUE;
375 NoErrorCalc(err, errUpper);
377 return this->CRScalc( *GetEvent() );
384 if (fRegressionReturnVal == 0) fRegressionReturnVal =
new std::vector<Float_t>;
385 fRegressionReturnVal->clear();
388 if (fInitializedVolumeEle ==
kFALSE) {
389 fInitializedVolumeEle =
kTRUE;
399 const Event* ev = GetEvent();
400 this->RRScalc( *ev, fRegressionReturnVal );
404 for (std::vector<Float_t>::iterator it = fRegressionReturnVal->begin(); it != fRegressionReturnVal->end(); it++ ) {
409 const Event* evT2 = GetTransformationHandler().InverseTransform( evT );
410 fRegressionReturnVal->clear();
413 fRegressionReturnVal->push_back(evT2->
GetTarget(ivar));
419 return (*fRegressionReturnVal);
427 if (fVRangeMode == kAdaptive || fVRangeMode == kRMS || fVRangeMode == kkNN ) {
429 fBinaryTree->CalcStatistics();
431 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
432 if (!DoRegression()){
435 fAverageRMS.push_back( (rmsS + rmsB)*0.5 );
437 Float_t rms = fBinaryTree->RMS( ivar );
438 fAverageRMS.push_back( rms );
449 if (
NULL != fBinaryTree)
delete fBinaryTree;
452 fBinaryTree->SetNormalize(
kTRUE );
455 fBinaryTree->Fill( GetEventCollection(type) );
458 fBinaryTree->NormalizeTree();
461 if (!DoRegression()) {
466 Log() <<
kVERBOSE <<
"Signal and background scales: " << fScaleS <<
" " << fScaleB <<
Endl;
480 fkNNMin =
Int_t(fNEventsMin);
481 fkNNMax =
Int_t(fNEventsMax);
483 if (fDelta)
delete fDelta;
484 if (fShift)
delete fShift;
485 fDelta =
new std::vector<Float_t>( GetNvar() );
486 fShift =
new std::vector<Float_t>( GetNvar() );
488 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
489 switch (fVRangeMode) {
495 if (fAverageRMS.size() != GetNvar())
496 Log() <<
kFATAL <<
"<SetVolumeElement> RMS not computed: " << fAverageRMS.size() <<
Endl;
497 (*fDelta)[ivar] = fAverageRMS[ivar]*fDeltaFrac;
498 Log() <<
kVERBOSE <<
"delta of var[" << (*fInputVars)[ivar]
499 <<
"\t]: " << fAverageRMS[ivar]
500 <<
"\t | comp with |max - min|: " << (GetXmax( ivar ) - GetXmin( ivar ))
504 (*fDelta)[ivar] = (GetXmax( ivar ) - GetXmin( ivar ))*fDeltaFrac;
507 (*fDelta)[ivar] = fDeltaFrac;
510 Log() <<
kFATAL <<
"<SetVolumeElement> unknown range-set mode: "
511 << fVRangeMode <<
Endl;
513 (*fShift)[ivar] = 0.5;
523 return ThisPDERS()->GetVolumeContentForRoot( scale );
534 Double_t count = GetBinaryTree()->SearchVolume( &v );
541 std::vector<const BinarySearchTreeNode*>& events,
552 #ifdef TMVA_MethodPDERS__countByHand__Debug__
555 count = fBinaryTree->SearchVolume( volume );
557 Int_t iS = 0, iB = 0;
559 for (
UInt_t ievt_=0; ievt_<
Data()->GetNTrainingEvents(); ievt_++) {
560 const Event * ev = GetTrainingEvent(ievt_);
562 for (
Int_t ivar=0; ivar<nvar; ivar++) {
564 inV = (x > (*volume->Lower)[ivar] && x <= (*volume->Upper)[ivar]);
578 if (fVRangeMode == kRMS || fVRangeMode == kMinMax || fVRangeMode == kUnscaled) {
580 std::vector<Double_t> *lb =
new std::vector<Double_t>( GetNvar() );
581 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) (*lb)[ivar] = e.
GetValue(ivar);
582 std::vector<Double_t> *ub =
new std::vector<Double_t>( *lb );
583 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
584 (*lb)[ivar] -= (*fDelta)[ivar]*(1.0 - (*fShift)[ivar]);
585 (*ub)[ivar] += (*fDelta)[ivar]*(*fShift)[ivar];
590 fBinaryTree->SearchVolume( svolume, &events );
592 else if (fVRangeMode == kAdaptive) {
602 fHelpVolume = volume;
605 RootFinder rootFinder( &IGetVolumeContentForRoot, 0.01, 50, 200, 10 );
606 Double_t scale = rootFinder.
Root( (fNEventsMin + fNEventsMax)/2.0 );
610 fBinaryTree->SearchVolume( volume, &events );
618 count = fBinaryTree->SearchVolume( volume );
623 while (nEventsO < fNEventsMin) {
625 count = fBinaryTree->SearchVolume( volume );
629 if (i_ > 50)
Log() <<
kWARNING <<
"warning in event: " << e
630 <<
": adaptive volume pre-adjustment reached "
631 <<
">50 iterations in while loop (" << i_ <<
")" <<
Endl;
634 Float_t nEventsE = 0.5*(fNEventsMin + fNEventsMax);
636 Float_t scaleN = fInitialScale;
639 Float_t nEventsBest = nEventsN;
641 for (
Int_t ic=1; ic<fMaxVIterations; ic++) {
642 if (nEventsN < fNEventsMin || nEventsN > fNEventsMax) {
647 nEventsN = fBinaryTree->SearchVolume( v );
650 if (nEventsN > 1 && nEventsN - nEventsO != 0)
651 if (scaleN - scaleO != 0)
652 scale += (scaleN - scaleO)/(nEventsN - nEventsO)*(nEventsE - nEventsN);
663 (nEventsN >= fNEventsMin || nEventsBest < nEventsN)) {
664 nEventsBest = nEventsN;
675 nEventsN = nEventsBest;
677 if (nEventsN < fNEventsMin-1 || nEventsN > fNEventsMax+1)
679 <<
": adaptive volume adjustment reached "
680 <<
"max. #iterations (" << fMaxVIterations <<
")"
681 <<
"[ nEvents: " << nEventsN <<
" " << fNEventsMin <<
" " << fNEventsMax <<
"]"
685 fBinaryTree->SearchVolume( volume, &events );
690 }
else if (fVRangeMode == kkNN) {
695 Int_t kNNcount = fBinaryTree->SearchVolumeWithMaxLimit( &v, &events, fkNNMax+1 );
700 while ( !(kNNcount >= fkNNMin && kNNcount <= fkNNMax) ) {
701 if (kNNcount < fkNNMin) {
705 else if (kNNcount > fkNNMax) {
713 kNNcount = fBinaryTree->SearchVolumeWithMaxLimit( &v, &events, fkNNMax+1 );
717 if (t_times == fMaxVIterations) {
719 <<
": kNN volume adjustment reached "
720 <<
"max. #iterations (" << fMaxVIterations <<
")"
721 <<
"[ kNN: " << fkNNMin <<
" " << fkNNMax <<
Endl;
728 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
729 dim_normalization [ivar] = 1.0 / ((*v.
fUpper)[ivar] - (*v.
fLower)[ivar]);
732 std::vector<const BinarySearchTreeNode*> tempVector;
734 if (kNNcount >= fkNNMin) {
735 std::vector<Double_t> *distances =
new std::vector<Double_t>( kNNcount );
739 (*distances)[j] = GetNormalizedDistance ( e, *events[j], dim_normalization );
742 std::vector<Double_t>::iterator wsk = distances->begin();
743 for (
Int_t j=0;j<fkNNMin-1;j++) wsk++;
744 std::nth_element( distances->begin(), wsk, distances->end() );
749 Double_t dist = GetNormalizedDistance( e, *events[j], dim_normalization );
751 if (dist <= (*distances)[fkNNMin-1])
752 tempVector.push_back( events[j] );
754 fMax_distance = (*distances)[fkNNMin-1];
757 delete[] dim_normalization;
763 Log() <<
kFATAL <<
"<GetSample> unknown RangeMode: " << fVRangeMode <<
Endl;
772 std::vector<const BinarySearchTreeNode*> events;
777 std::vector<Double_t> *lb =
new std::vector<Double_t>( GetNvar() );
778 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) (*lb)[ivar] = e.
GetValue(ivar);
780 std::vector<Double_t> *ub =
new std::vector<Double_t>( *lb );
781 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
782 (*lb)[ivar] -= (*fDelta)[ivar]*(1.0 - (*fShift)[ivar]);
783 (*ub)[ivar] += (*fDelta)[ivar]*(*fShift)[ivar];
788 GetSample( e, events, volume );
789 Double_t count = CKernelEstimate( e, events, *volume );
801 std::vector<const BinarySearchTreeNode*> events;
806 std::vector<Double_t> *lb =
new std::vector<Double_t>( GetNvar() );
807 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) (*lb)[ivar] = e.
GetValue(ivar);
809 std::vector<Double_t> *ub =
new std::vector<Double_t>( *lb );
810 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
811 (*lb)[ivar] -= (*fDelta)[ivar]*(1.0 - (*fShift)[ivar]);
812 (*ub)[ivar] += (*fDelta)[ivar]*(*fShift)[ivar];
816 GetSample( e, events, volume );
817 RKernelEstimate( e, events, *volume, count );
827 std::vector<const BinarySearchTreeNode*>& events,
Volume&
v )
830 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++)
831 dim_normalization [ivar] = 2 / ((*v.
fUpper)[ivar] - (*v.
fLower)[ivar]);
837 for (std::vector<const BinarySearchTreeNode*>::iterator iev = events.begin(); iev != events.end(); iev++) {
840 Double_t normalized_distance = GetNormalizedDistance (event, *(*iev), dim_normalization);
844 if (normalized_distance > 1 && fKernelEstimator !=
kBox)
continue;
846 if ( (*iev)->GetClass()==fSignalClass )
847 pdfSumS += ApplyKernelFunction (normalized_distance) * (*iev)->GetWeight();
849 pdfSumB += ApplyKernelFunction (normalized_distance) * (*iev)->GetWeight();
851 pdfSumS = KernelNormalization( pdfSumS < 0. ? 0. : pdfSumS );
852 pdfSumB = KernelNormalization( pdfSumB < 0. ? 0. : pdfSumB );
854 delete[] dim_normalization;
856 if (pdfSumS < 1e-20 && pdfSumB < 1e-20)
return 0.5;
857 if (pdfSumB < 1e-20)
return 1.0;
858 if (pdfSumS < 1e-20)
return 0.0;
860 Float_t r = pdfSumB*fScaleB/(pdfSumS*fScaleS);
861 return 1.0/(r + 1.0);
868 std::vector<const BinarySearchTreeNode*>& events,
Volume&
v,
869 std::vector<Float_t>* pdfSum )
872 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++)
873 dim_normalization [ivar] = 2 / ((*v.
fUpper)[ivar] - (*v.
fLower)[ivar]);
880 for (
Int_t ivar = 0; ivar < fNRegOut ; ivar++)
881 pdfSum->push_back( 0 );
884 for (std::vector<const BinarySearchTreeNode*>::iterator iev = events.begin(); iev != events.end(); iev++) {
887 Double_t normalized_distance = GetNormalizedDistance (event, *(*iev), dim_normalization);
891 if (normalized_distance > 1 && fKernelEstimator !=
kBox)
continue;
893 for (
Int_t ivar = 0; ivar < fNRegOut ; ivar++) {
894 pdfSum->at(ivar) += ApplyKernelFunction (normalized_distance) * (*iev)->GetWeight() * (*iev)->GetTargets()[ivar];
895 pdfDiv += ApplyKernelFunction (normalized_distance) * (*iev)->GetWeight();
899 delete[] dim_normalization;
904 for (
Int_t ivar = 0; ivar < fNRegOut ; ivar++)
905 pdfSum->at(ivar) /= pdfDiv;
916 switch (fKernelEstimator) {
922 return (1 - normalized_distance);
932 Double_t side_crossings = 2 + ((int) fKernelEstimator) - ((int) kSinc3);
933 return NormSinc (side_crossings * normalized_distance);
937 return LanczosFilter (2, normalized_distance);
940 return LanczosFilter (3, normalized_distance);
943 return LanczosFilter (5, normalized_distance);
946 return LanczosFilter (8, normalized_distance);
949 Double_t x = normalized_distance / fMax_distance;
955 Log() <<
kFATAL <<
"Kernel estimation function unsupported. Enumerator is " << fKernelEstimator <<
Endl;
972 if (ret != 0.0)
return ret*pdf;
975 switch (fKernelEstimator) {
1001 Log() <<
kFATAL <<
"Kernel estimation function unsupported. Enumerator is " << fKernelEstimator <<
Endl;
1019 for (
UInt_t ivar=0; ivar<GetNvar(); ivar++) {
1033 if (x < 10e-10 && x > -10e-10) {
1042 ret =
TMath::Power (sinc, static_cast<Int_t>(GetNvar()));
1054 if (x < 10e-10 && x > -10e-10) {
1063 if (GetNvar() % 2) ret =
TMath::Power (lanczos, static_cast<Int_t>(GetNvar()));
1076 Float_t d = countS + c*countB; d *= d;
1078 if (d < 1e-10)
return 1;
1081 Float_t err = f*countB*countB*sumW2S + f*countS*countS*sumW2B;
1083 if (err < 1e-10)
return 1;
1095 fBinaryTree->AddXMLTo(wght);
1097 Log() <<
kFATAL <<
"Signal and background binary search tree not available" <<
Endl;
1105 if (
NULL != fBinaryTree)
delete fBinaryTree;
1109 Log() <<
kFATAL <<
"Could not create BinarySearchTree from XML" <<
Endl;
1111 Log() <<
kFATAL <<
"Could not create BinarySearchTree from XML" <<
Endl;
1112 fBinaryTree->SetPeriode( GetNvar() );
1113 fBinaryTree->CalcStatistics();
1114 fBinaryTree->CountNodes();
1121 Log() <<
kINFO <<
"signal and background scales: " << fScaleS <<
" " << fScaleB <<
Endl;
1124 fInitializedVolumeEle =
kTRUE;
1132 if (
NULL != fBinaryTree)
delete fBinaryTree;
1136 istr >> *fBinaryTree;
1138 fBinaryTree->SetPeriode( GetNvar() );
1140 fBinaryTree->CalcStatistics();
1142 fBinaryTree->CountNodes();
1148 Log() <<
kINFO <<
"signal and background scales: " << fScaleS <<
" " << fScaleB <<
Endl;
1154 fInitializedVolumeEle =
kTRUE;
1176 return GetMethodPDERSThreadLocal();
1183 GetMethodPDERSThreadLocal() =
this;
1191 fout <<
" // not implemented for class: \"" << className <<
"\"" << std::endl;
1192 fout <<
"};" << std::endl;
1206 Log() <<
"PDERS is a generalization of the projective likelihood classifier " <<
Endl;
1207 Log() <<
"to N dimensions, where N is the number of input variables used." <<
Endl;
1208 Log() <<
"In its adaptive form it is mostly equivalent to k-Nearest-Neighbor" <<
Endl;
1209 Log() <<
"(k-NN) methods. If the multidimensional PDF for signal and background" <<
Endl;
1210 Log() <<
"were known, this classifier would exploit the full information" <<
Endl;
1211 Log() <<
"contained in the input variables, and would hence be optimal. In " <<
Endl;
1212 Log() <<
"practice however, huge training samples are necessary to sufficiently " <<
Endl;
1213 Log() <<
"populate the multidimensional phase space. " <<
Endl;
1215 Log() <<
"The simplest implementation of PDERS counts the number of signal" <<
Endl;
1216 Log() <<
"and background events in the vicinity of a test event, and returns" <<
Endl;
1217 Log() <<
"a weight according to the majority species of the neighboring events." <<
Endl;
1218 Log() <<
"A more involved version of PDERS (selected by the option \"KernelEstimator\")" <<
Endl;
1219 Log() <<
"uses Kernel estimation methods to approximate the shape of the PDF." <<
Endl;
1223 Log() <<
"PDERS can be very powerful in case of strongly non-linear problems, " <<
Endl;
1224 Log() <<
"e.g., distinct islands of signal and background regions. Because of " <<
Endl;
1225 Log() <<
"the exponential growth of the phase space, it is important to restrict" <<
Endl;
1226 Log() <<
"the number of input variables (dimension) to the strictly necessary." <<
Endl;
1228 Log() <<
"Note that PDERS is a slowly responding classifier. Moreover, the necessity" <<
Endl;
1229 Log() <<
"to store the entire binary tree in memory, to avoid accessing virtual " <<
Endl;
1230 Log() <<
"memory, limits the number of training events that can effectively be " <<
Endl;
1231 Log() <<
"used to model the multidimensional PDF." <<
Endl;
1235 Log() <<
"If the PDERS response is found too slow when using the adaptive volume " <<
Endl;
1236 Log() <<
"size (option \"VolumeRangeMode=Adaptive\"), it might be found beneficial" <<
Endl;
1237 Log() <<
"to reduce the number of events required in the volume, and/or to enlarge" <<
Endl;
1238 Log() <<
"the allowed range (\"NeventsMin/Max\"). PDERS is relatively insensitive" <<
Endl;
1239 Log() <<
"to the width (\"GaussSigma\") of the Gaussian kernel (if used)." <<
Endl;
std::vector< Double_t > * fLower
void UpdateThis()
update static this pointer
double dist(Rotation3D const &r1, Rotation3D const &r2)
virtual ~MethodPDERS(void)
destructor
MsgLogger & Endl(MsgLogger &ml)
void MakeClassSpecific(std::ostream &, const TString &) const
write specific classifier response
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.
const Bool_t MethodPDERS_UseFindRoot
UInt_t GetNTargets() const
accessor to the number of targets
Double_t NormSinc(Double_t x)
NormSinc.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
void CreateBinarySearchTree(Types::ETreeType type)
create binary search trees for signal and background
std::vector< Double_t > * fUpper
Double_t CKernelEstimate(const Event &, std::vector< const BinarySearchTreeNode * > &, Volume &)
normalization factors so we can work with radius 1 hyperspheres
void ScaleInterval(Double_t f)
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...
Double_t Gamma(Double_t z)
Computation of gamma(z) for all z.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
void Init(void)
default initialisation routine called by all constructors
static Double_t IGetVolumeContentForRoot(Double_t)
Interface to RootFinder.
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
std::vector< std::vector< double > > Data
void GetHelpMessage() const
get help message text
Double_t Root(Double_t refValue)
Root finding using Brents algorithm; taken from CERNLIB function RZERO.
void CalcAverages()
compute also average RMS values required for adaptive Gaussian
Double_t CRScalc(const Event &)
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
void DeclareOptions()
define the options (their key words) that can be set in the option string know options: VolumeRangeMo...
void SetVolumeElement(void)
defines volume dimensions
void WriteWeightsToStream(TFile &rf) const
write training sample (TTree) to file
ClassImp(TMVA::MethodPDERS) TMVA
standard constructor for the PDERS method
void SetTarget(UInt_t itgt, Float_t value)
set the target value (dimension itgt) to value
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.
void ReadWeightsFromXML(void *wghtnode)
static MethodPDERS * ThisPDERS(void)
static pointer to this object
void Train(void)
this is a dummy training: the preparation work to do is the construction of the binary tree as a poin...
Describe directory structure in memory.
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.
Float_t GetTarget(UInt_t itgt) const
const std::vector< Float_t > & GetRegressionValues()
#define REGISTER_METHOD(CLASS)
for example
Abstract ClassifierFactory template that handles arbitrary types.
void AddWeightsXMLTo(void *parent) const
write weights to xml file
void ProcessOptions()
process the options specified by the user
const std::vector< Float_t > & GetEventV() const
void GetSample(const Event &e, std::vector< const BinarySearchTreeNode * > &events, Volume *volume)
Double_t GetVolumeContentForRoot(Double_t)
count number of events in rescaled volume
MethodPDERS(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption, TDirectory *theTargetDir=0)
Double_t Sqrt(Double_t x)
Double_t ApplyKernelFunction(Double_t normalized_distance)
from the normalized euclidean distance calculate the distance for a certain kernel ...
Double_t LanczosFilter(Int_t level, Double_t x)
Lanczos Filter.
void RRScalc(const Event &, std::vector< Float_t > *count)
Float_t GetError(Float_t countS, Float_t countB, Float_t sumW2S, Float_t sumW2B) const
statistical error estimate for RS estimator
Double_t KernelNormalization(Double_t pdf)
Calculating the normalization factor only once (might need a reset at some point. ...