42 fImportanceHist(nullptr)
63 if(fType==VIType::kShort)
65 fLogger<<kINFO<<
"Variable Importance Results (Short)"<<
Endl;
66 }
else if(fType==VIType::kAll)
68 fLogger<<kINFO<<
"Variable Importance Results (All)"<<
Endl;
70 fLogger<<kINFO<<
"Variable Importance Results (Random)"<<
Endl;
73 fImportanceValues.
Print();
82 fImportanceHist->Draw(
"");
83 fImportanceHist->GetXaxis()->SetTitle(
" Variable Names ");
84 fImportanceHist->GetYaxis()->SetTitle(
" Importance (%) ");
93 fClassifier=std::unique_ptr<Factory>(
new TMVA::Factory(
"VariableImportance",
"!V:!ROC:!ModelPersistence:Silent:Color:!DrawProgressBar:AnalysisType=Classification"));
109 if(fType==VIType::kShort)
111 EvaluateImportanceShort();
112 }
else if(fType==VIType::kAll)
114 EvaluateImportanceAll();
116 UInt_t nbits=fDataLoader->GetDefaultDataSetInfo().GetNVariables();
118 Log()<<kERROR<<
"Running variable importance with less that 10 varibales in Random mode "<<
119 "can to produce inconsisten results"<<
Endl;
120 EvaluateImportanceRandom(pow(
nbits,2));
122 fResults.fType = fType;
125 Log()<<kINFO<<
"Evaluation done."<<
Endl;
161 vihist->LabelsOption(
"v >",
"X");
162 vihist->SetBarWidth(0.97);
165 vihist->GetXaxis()->SetTitle(
" Variable Names ");
166 vihist->GetXaxis()->SetTitleSize(0.045);
167 vihist->GetXaxis()->CenterTitle();
168 vihist->GetXaxis()->SetTitleOffset(1.24);
170 vihist->GetYaxis()->SetTitle(
" Importance (%)");
171 vihist->GetYaxis()->SetTitleSize(0.045);
172 vihist->GetYaxis()->CenterTitle();
173 vihist->GetYaxis()->SetTitleOffset(1.24);
175 vihist->GetYaxis()->SetRangeUser(-7, 50);
176 vihist->SetDirectory(
nullptr);
185 for (
auto &
meth : fMethods) {
193 const UInt_t nbits = fDataLoader->GetDefaultDataSetInfo().GetNVariables();
194 std::vector<TString>
varNames = fDataLoader->GetDefaultDataSetInfo().GetListOfVariables();
209 Log() << kFATAL <<
"Error: need at least one variable.";
227 fClassifier->TrainAllMethods();
228 fClassifier->TestAllMethods();
229 fClassifier->EvaluateAllMethods();
232 SROC = fClassifier->GetROCIntegral(
xbitset.to_string(), methodTitle);
235 fClassifier->DeleteAllMethods();
236 fClassifier->fMethodsMap.clear();
238 for (uint32_t i = 0; i <
NBITS; ++i) {
265 fClassifier->TrainAllMethods();
266 fClassifier->TestAllMethods();
267 fClassifier->EvaluateAllMethods();
270 SSROC = fClassifier->GetROCIntegral(
ybitset.to_string(), methodTitle);
274 fClassifier->DeleteAllMethods();
275 fClassifier->fMethodsMap.clear();
295 for (
auto &
meth : fMethods) {
307 const UInt_t nbits = fDataLoader->GetDefaultDataSetInfo().GetNVariables();
308 std::vector<TString>
varNames = fDataLoader->GetDefaultDataSetInfo().GetListOfVariables();
344 fClassifier->TrainAllMethods();
345 fClassifier->TestAllMethods();
346 fClassifier->EvaluateAllMethods();
349 SROC = fClassifier->GetROCIntegral(
xbitset.to_string(), methodTitle);
352 fClassifier->DeleteAllMethods();
353 fClassifier->fMethodsMap.clear();
355 for (uint32_t i = 0; i < 32; ++i) {
382 fClassifier->TrainAllMethods();
383 fClassifier->TestAllMethods();
384 fClassifier->EvaluateAllMethods();
387 SSROC = fClassifier->GetROCIntegral(
ybitset.to_string(), methodTitle);
391 fClassifier->DeleteAllMethods();
392 fClassifier->fMethodsMap.clear();
415 for (
auto &
meth : fMethods) {
424 const UInt_t nbits = fDataLoader->GetDefaultDataSetInfo().GetNVariables();
425 std::vector<TString>
varNames = fDataLoader->GetDefaultDataSetInfo().GetListOfVariables();
455 seeddl->PrepareTrainingAndTestTree(fDataLoader->GetDefaultDataSetInfo().GetCut(
"Signal"), fDataLoader->GetDefaultDataSetInfo().GetCut(
"Background"), fDataLoader->GetDefaultDataSetInfo().GetSplitOptions());
461 fClassifier->TrainAllMethods();
462 fClassifier->TestAllMethods();
463 fClassifier->EvaluateAllMethods();
466 ROC[
x] = fClassifier->GetROCIntegral(
xbitset.to_string(), methodTitle);
469 fClassifier->DeleteAllMethods();
470 fClassifier->fMethodsMap.clear();
477 for (uint32_t i = 0; i <
NBITS; ++i) {
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
R__EXTERN TStyle * gStyle
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
1-D histogram with a float per channel (see TH1 documentation)
Abstract base class for all high level ml algorithms, you can book ml methods like BDT,...
This is the main MVA steering class.
ostringstream derivative to redirect and format output
static void EnableOutput()
std::shared_ptr< TH1F > fImportanceHist
TCanvas * Draw(const TString name="VariableImportance") const
VariableImportanceResult()
OptionMap fImportanceValues
std::unique_ptr< Factory > fClassifier
void EvaluateImportanceShort()
virtual void Evaluate()
Virtual method to be implemented with your algorithm.
void EvaluateImportanceRandom(UInt_t nseeds)
VariableImportance(DataLoader *loader)
TH1F * GetImportance(const UInt_t nbits, std::vector< Float_t > &importances, std::vector< TString > &varNames)
void EvaluateImportanceAll()
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Random number generator class based on M.
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
void SetTitleXOffset(Float_t offset=1)
create variable transformations
void DataLoaderCopy(TMVA::DataLoader *des, TMVA::DataLoader *src)
MsgLogger & Endl(MsgLogger &ml)
static uint64_t sum(uint64_t i)