From: Peter S. <Pet...@gm...> - 2013-01-31 08:23:00
|
Hi Zinonas, > > TCut cut_Test = "EventNumber is odd"; > TCut cut_Train = "EventNumber is even"; TCut cutTest = "(Entry$%2==1)"; TCut cutTrain = "(Entry$%2==0)"; > > Should I then have to call > > factory->PrepareTrainingAndTestTree( mycuts, mycutb, "NormMode=None:!V" ); > ? > > is it necessary? > > How can I alternatively disable the default split procedure, since the > splitting is already included in the TCut expressions? Does TMVA features any You have to use the last parameter of the "AddTree/AddSignalTree/AddBackgroundTree" functions: e.g. factory->AddTree (mytree, "Signal", 1.0, cutSignalTrain, "train"); factory->AddTree (mytree, "Background", 1.0, cutBackgroundTrain, "train"); factory->AddTree (mytree, "Signal", 1.0, cutSignalTest, "test"); factory->AddTree (mytree, "Background", 1.0, cutBackgroundTest, "test"); PrepareTrainingAndTestTree performs the splitting and the data preparation. It has to be called. All events which are marked already as training or test data when you provide the trees are taken as such (i.e. all trees which are added with the "train" parameter are taken as training events). All events which have not been marked when the trees are provided are split according to the options given in PrepareTrainingAndTestTree. cheers, Peter > function for that? > > Let me know if my approach makes sense. > > Thank you > Zinonas > > On 01/29/2013 11:29 PM, Helge Voss wrote: > > Hi Zinonas, > > > > if you use AddSignalTree the way you said or AddTree directly is just > > a matter of taste, as > > you can see in the code :) > > > > void TMVA::Factory::AddSignalTree( TTree* signal, Double_t weight, > > const TString& treetype ) > > { > > AddTree( signal, "Signal", weight, TCut(""), treetype ); > > } > > > > Unfortunatly there are many different philosophies around of which > > features are helpful and which > > are more 'confusing' ... I personally (and you apparently too) find it > > more confusing if I can do the same > > thing in different ways.. but well... > > > > Concerning the odd/even events, NO, there's no possible TCut that > > accesses entry numbers in a tree unless > > you ALSO in addition defined an event number as a tree variable. Hence > > you cannot do that. > > > > HOWEVER, you could simply assign event-by-event the events to > > training/test trees using: > > > > void TMVA::Factory::AddSignalTrainingEvent( const > > std::vector<Double_t>& event, Double_t weight ) > > > > and there you can then do whatever you like ! > > > > Now concerning the "splitting" ... imply don't specify any splitting: > > e.g.: > > > > factory->AddSignalTree ( signalTrain, signalWeight , > > TMVA::Types::kTraining); > > factory->AddBackgroundTree( backgroundTrain, backgroundWeight , > > TMVA::Types::kTraining); > > factory->AddSignalTree ( signalTest, signalWeight , > > TMVA::Types::kTesting); > > factory->AddBackgroundTree( backgroundTest, backgroundWeight , > > TMVA::Types::kTesting); > > > > factory->PrepareTrainingAndTestTree( mycuts, mycutb, > "NormMode=None:!V" ); > > (copies out of one of my scripts..) > > > > Cheers, > > > > Helge > > > > > > > > > > 2013/1/29 Zinonas Zinonos <zin...@gm...>: > >> Hello > >> > >> so far, in my short experience with TMVA, I was defining the signal and > >> bkg trees as follows > >> > >> factory->AddSignalTree(treeS, wS) > >> factory->AddBackgroundTree(treeB, wB) > >> > >> and the tool was then responsible to split the events into the 'train' > >> and 'test' part > >> > >> factory->PrepareTrainingAndTestTree( myCutS, myCutB, > >> > "nTrain_Signal=0:nTrain_Background=0:SplitMode=Random:NormMode=EqualNumEvents:!V" > >> ) > >> > >> > >> Now, I would like to explicitly define my 'train' and 'test' for S and > B > >> using the following functions > >> > >> AddSignalTree( treeS, wS, "train") > >> AddBackgroundTree( treeS, wS, "train") > >> > >> AddSignalTree( treeS, wS, "test") > >> AddBackgroundTree( treeS, wS, "test") > >> > >> To do so, I would need some extra help: > >> > >> a) how should I pass the proper TCut expression? In particular, if for > >> the training sample the cut is "odd events", the testing should be > >> composed by the "even" ones. If that's not featured in TMVA, should I > >> directly use the AddTree function > >> http://root.cern.ch/root/htmldoc/src/TMVA__Factory.cxx.html#378 ? > >> > >> b) If in case I must use the PrepareTrainingAndTestTree function, how I > >> completely switch-off disable the event splitting ? > >> > >> > >> Thank you. > >> Zinonas > >> > >> > ------------------------------------------------------------------------------ > >> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > >> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > >> MVPs and experts. ON SALE this month only -- learn more at: > >> http://p.sf.net/sfu/learnnow-d2d > >> _______________________________________________ > >> TMVA-users mailing list > >> TMV...@li... > >> https://lists.sourceforge.net/lists/listinfo/tmva-users > > > ------------------------------------------------------------------------------ > > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > > MVPs and experts. ON SALE this month only -- learn more at: > > http://p.sf.net/sfu/learnnow-d2d > > _______________________________________________ > > TMVA-users mailing list > > TMV...@li... > > https://lists.sourceforge.net/lists/listinfo/tmva-users > |