I am using TMVA with FitMethod=GA
to optimize five input parameters. I want to define both a minimum and maximum range for each parameter. When I specify only the maximum range, the training runs smoothly. However, when I set a minimum range, the training results in cuts on the parameter being set to zero. To cross-check, I explicitly set CutRangeMin[0]=0
, but the training still does not proceed as expected. I am attaching my code and output when using CutRangeMin[0]
. I am currently stuck on this issue and would appreciate any suggestions.
void optimizer_EB() {
TMVA::Tools::Instance();
TFile* outputFile = TFile::Open("tmva_EB.root", "RECREATE");
TMVA::Factory* factory = new TMVA::Factory("TMVAClassification", outputFile,
"!V:!Silent:Color:DrawProgressBar");
TMVA::DataLoader* dataloader = new TMVA::DataLoader("dataset");
TFile* inputFile = TFile::Open("bdt_scores_EB.root");
TTree* signalTree = (TTree*)inputFile->Get("test_signal");
TTree* backgroundTree = (TTree*)inputFile->Get("test_background");
dataloader->AddVariable("pho_EB_TrkIso", 'F');
dataloader->AddVariable("pho_EB_ECalIso", 'F');
dataloader->AddVariable("pho_EB_HCalIso", 'F');
dataloader->AddVariable("pho_EB_HoverE", 'F');
dataloader->AddVariable("BDT_score", 'F');
dataloader->AddSignalTree(signalTree, 1.0);
dataloader->AddBackgroundTree(backgroundTree, 1.0);
dataloader->SetSignalWeightExpression("1");
dataloader->SetBackgroundWeightExpression("1");
TCut signalCut = "";
TCut backgroundCut = "";
dataloader->PrepareTrainingAndTestTree(signalCut, backgroundCut, "nTrain_Signal=100000:nTrain_Background=100000:nTest_Signal=100000:nTest_Background=100000");
dataloader->SetBackgroundWeightExpression("1");
dataloader->SetSignalWeightExpression("1");
TString methodName = "Cut_GA";
TString methodOptions = "!H:!V:FitMethod=GA:EffMethod=EffSel:VerbosityLevel=Debug";
methodOptions += ":VarProp[0]=FMin:VarProp[1]=FMin:VarProp[2]=FMin:VarProp[3]=FMin:VarProp[4]=FMin";
methodOptions += ":CutRangeMin[0]=0:CutRangeMax[0]=5";
methodOptions += ":CutRangeMin[1]=0:CutRangeMax[1]=10";
methodOptions += ":CutRangeMin[2]=0:CutRangeMax[2]=9.989";
methodOptions += ":CutRangeMin[3]=0:CutRangeMax[3]=0.1";
methodOptions += ":CutRangeMin[4]=0:CutRangeMax[4]=0.9989";
TMVA::gConfig().GetVariablePlotting().fNbinsXOfROCCurve = 500;
factory->BookMethod(dataloader, TMVA::Types::kCuts, methodName, methodOptions);
factory->TrainAllMethods();
factory->TestAllMethods();
factory->EvaluateAllMethods();
outputFile->Close();
std::cout << "==> Wrote root file: " << outputFile->GetName() << std::endl;
std::cout << "==> TMVAClassification is done!" << std::endl;
delete factory;
delete dataloader;
}
and this is the output
Cut_GA : Cut values for requested signal efficiency: 0.8
: Corresponding background efficiency : -0.1
: Transformation applied to input variables : None
: --------------------------------------------------
: Cut[ 0]: -1e+30 < pho_EB_TrkIso <= 0
: Cut[ 1]: -1e+30 < pho_EB_ECalIso <= 0
: Cut[ 2]: -1e+30 < pho_EB_HCalIso <= 0
: Cut[ 3]: -1e+30 < pho_EB_HoverE <= 0
: Cut[ 4]: -1e+30 < BDT_score <= 0
: --------------------------------------------------
: --------------------------------------------------
Cut_GA : Cut values for requested signal efficiency: 0.9
: Corresponding background efficiency : -0.1
: Transformation applied to input variables : None
: --------------------------------------------------
: Cut[ 0]: -1e+30 < pho_EB_TrkIso <= 0
: Cut[ 1]: -1e+30 < pho_EB_ECalIso <= 0
: Cut[ 2]: -1e+30 < pho_EB_HCalIso <= 0
: Cut[ 3]: -1e+30 < pho_EB_HoverE <= 0
: Cut[ 4]: -1e+30 < BDT_score <= 0`