43 fImportanceHist(nullptr)
64 if(fType==VIType::kShort)
66 fLogger<<kINFO<<
"Variable Importance Results (Short)"<<
Endl;
67 }
else if(fType==VIType::kAll)
69 fLogger<<kINFO<<
"Variable Importance Results (All)"<<
Endl;
71 fLogger<<kINFO<<
"Variable Importance Results (Random)"<<
Endl;
74 fImportanceValues.
Print();
83 fImportanceHist->Draw(
"");
84 fImportanceHist->GetXaxis()->SetTitle(
" Variable Names ");
85 fImportanceHist->GetYaxis()->SetTitle(
" Importance (%) ");
94 fClassifier=std::unique_ptr<Factory>(
new TMVA::Factory(
"VariableImportance",
"!V:!ROC:!ModelPersistence:Silent:Color:!DrawProgressBar:AnalysisType=Classification"));
110 if(fType==VIType::kShort)
112 EvaluateImportanceShort();
113 }
else if(fType==VIType::kAll)
115 EvaluateImportanceAll();
117 UInt_t nbits=fDataLoader->GetDefaultDataSetInfo().GetNVariables();
119 Log()<<kERROR<<
"Running variable importance with less that 10 varibales in Random mode "<<
120 "can to produce inconsisten results"<<
Endl;
121 EvaluateImportanceRandom(pow(
nbits,2));
123 fResults.fType = fType;
126 Log()<<kINFO<<
"Evaluation done."<<
Endl;
162 vihist->LabelsOption(
"v >",
"X");
163 vihist->SetBarWidth(0.97);
166 vihist->GetXaxis()->SetTitle(
" Variable Names ");
167 vihist->GetXaxis()->SetTitleSize(0.045);
168 vihist->GetXaxis()->CenterTitle();
169 vihist->GetXaxis()->SetTitleOffset(1.24);
171 vihist->GetYaxis()->SetTitle(
" Importance (%)");
172 vihist->GetYaxis()->SetTitleSize(0.045);
173 vihist->GetYaxis()->CenterTitle();
174 vihist->GetYaxis()->SetTitleOffset(1.24);
176 vihist->GetYaxis()->SetRangeUser(-7, 50);
177 vihist->SetDirectory(
nullptr);
186 for (
auto &
meth : fMethods) {
194 const UInt_t nbits = fDataLoader->GetDefaultDataSetInfo().GetNVariables();
195 std::vector<TString>
varNames = fDataLoader->GetDefaultDataSetInfo().GetListOfVariables();
210 Log() << kFATAL <<
"Error: need at least one variable.";
228 fClassifier->TrainAllMethods();
229 fClassifier->TestAllMethods();
230 fClassifier->EvaluateAllMethods();
233 SROC = fClassifier->GetROCIntegral(
xbitset.to_string(), methodTitle);
236 fClassifier->DeleteAllMethods();
237 fClassifier->fMethodsMap.clear();
239 for (uint32_t i = 0; i <
NBITS; ++i) {
266 fClassifier->TrainAllMethods();
267 fClassifier->TestAllMethods();
268 fClassifier->EvaluateAllMethods();
271 SSROC = fClassifier->GetROCIntegral(
ybitset.to_string(), methodTitle);
275 fClassifier->DeleteAllMethods();
276 fClassifier->fMethodsMap.clear();
296 for (
auto &
meth : fMethods) {
308 const UInt_t nbits = fDataLoader->GetDefaultDataSetInfo().GetNVariables();
309 std::vector<TString>
varNames = fDataLoader->GetDefaultDataSetInfo().GetListOfVariables();
345 fClassifier->TrainAllMethods();
346 fClassifier->TestAllMethods();
347 fClassifier->EvaluateAllMethods();
350 SROC = fClassifier->GetROCIntegral(
xbitset.to_string(), methodTitle);
353 fClassifier->DeleteAllMethods();
354 fClassifier->fMethodsMap.clear();
356 for (uint32_t i = 0; i < 32; ++i) {
383 fClassifier->TrainAllMethods();
384 fClassifier->TestAllMethods();
385 fClassifier->EvaluateAllMethods();
388 SSROC = fClassifier->GetROCIntegral(
ybitset.to_string(), methodTitle);
392 fClassifier->DeleteAllMethods();
393 fClassifier->fMethodsMap.clear();
416 for (
auto &
meth : fMethods) {
425 const UInt_t nbits = fDataLoader->GetDefaultDataSetInfo().GetNVariables();
426 std::vector<TString>
varNames = fDataLoader->GetDefaultDataSetInfo().GetListOfVariables();
456 seeddl->PrepareTrainingAndTestTree(fDataLoader->GetDefaultDataSetInfo().GetCut(
"Signal"), fDataLoader->GetDefaultDataSetInfo().GetCut(
"Background"), fDataLoader->GetDefaultDataSetInfo().GetSplitOptions());
462 fClassifier->TrainAllMethods();
463 fClassifier->TestAllMethods();
464 fClassifier->EvaluateAllMethods();
467 ROC[
x] = fClassifier->GetROCIntegral(
xbitset.to_string(), methodTitle);
470 fClassifier->DeleteAllMethods();
471 fClassifier->fMethodsMap.clear();
478 for (uint32_t i = 0; i <
NBITS; ++i) {
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
float Float_t
Float 4 bytes (float)
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
void Evaluate() override
Virtual method to be implemented with your algorithm.
std::unique_ptr< Factory > fClassifier
void EvaluateImportanceShort()
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)