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;
93 fClassifier=std::unique_ptr<Factory>(
new TMVA::Factory(
"VariableImportance",
"!V:!ROC:!ModelPersistence:Silent:Color:!DrawProgressBar:AnalysisType=Classification"));
109 if(
fType==VIType::kShort)
112 }
else if(
fType==VIType::kAll)
118 Log()<<kERROR<<
"Running variable importance with less that 10 varibales in Random mode "<<
119 "can to produce inconsisten results"<<
Endl;
125 Log()<<kINFO<<
"Evaluation done."<<
Endl;
142 TH1F *vihist =
new TH1F(
"vihist",
"", nbits, 0, nbits);
144 gStyle->SetOptStat(000000);
147 for (
UInt_t i = 0;
i < nbits;
i++) normalization += importances[
i];
151 gStyle->SetTitleXOffset(0.4);
152 gStyle->SetTitleXOffset(1.2);
156 roc = 100.0 * importances[
i - 1] / normalization;
194 std::vector<TString> varNames =
fDataLoader->GetDefaultDataSetInfo().GetListOfVariables();
199 std::vector<Float_t> importances(nbits);
207 std::bitset<NBITS> xbitset(
x);
209 Log() << kFATAL <<
"Error: need at least one variable.";
224 fClassifier->BookMethod(seeddl, methodName, methodTitle, methodOptions);
232 SROC =
fClassifier->GetROCIntegral(xbitset.to_string(), methodTitle);
238 for (uint32_t
i = 0;
i <
NBITS; ++
i) {
241 std::bitset<NBITS> ybitset(
y);
247 importances[ny] = SROC - 0.5;
262 fClassifier->BookMethod(subseeddl, methodName, methodTitle, methodOptions);
270 SSROC =
fClassifier->GetROCIntegral(ybitset.to_string(), methodTitle);
271 importances[ny] += SROC - SSROC;
279 for (
UInt_t i = 0;
i < nbits;
i++) normalization += importances[
i];
283 fResults.fImportanceValues[varNames[
i]]=(100.0 * importances[
i] / normalization);
308 std::vector<TString> varNames =
fDataLoader->GetDefaultDataSetInfo().GetListOfVariables();
313 std::vector<Float_t> importances(nbits);
323 x = rangen->Integer(range);
325 std::bitset<NBITS> xbitset(
x);
341 fClassifier->BookMethod(seeddl, methodName, methodTitle, methodOptions);
349 SROC =
fClassifier->GetROCIntegral(xbitset.to_string(), methodTitle);
355 for (uint32_t
i = 0;
i < 32; ++
i) {
358 std::bitset<NBITS> ybitset(
y);
364 importances[ny] = SROC - 0.5;
379 fClassifier->BookMethod(subseeddl, methodName, methodTitle, methodOptions);
387 SSROC =
fClassifier->GetROCIntegral(ybitset.to_string(), methodTitle);
388 importances[ny] += SROC - SSROC;
398 for (
UInt_t i = 0;
i < nbits;
i++) normalization += importances[
i];
402 fResults.fImportanceValues[varNames[
i]]=(100.0 * importances[
i] / normalization);
425 std::vector<TString> varNames =
fDataLoader->GetDefaultDataSetInfo().GetListOfVariables();
430 std::vector<Float_t> importances(nbits);
433 std::vector<Float_t> ROC(range);
439 for (
x = 1;
x < range;
x++) {
441 std::bitset<NBITS> xbitset(
x);
458 fClassifier->BookMethod(seeddl, methodName, methodTitle, methodOptions);
466 ROC[
x] =
fClassifier->GetROCIntegral(xbitset.to_string(), methodTitle);
474 for (
x = 0;
x <range ;
x++)
477 for (uint32_t
i = 0;
i <
NBITS; ++
i) {
480 std::bitset<NBITS> ybitset(
y);
484 importances[ny] = SROC - 0.5;
490 importances[ny] += SROC - SSROC;
496 for (
UInt_t i = 0;
i < nbits;
i++) normalization += importances[
i];
500 fResults.fImportanceValues[varNames[
i]]=(100.0 * importances[
i] / normalization);
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
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title.
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
void CenterTitle(Bool_t center=kTRUE)
Center axis title.
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
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)
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual void LabelsOption(Option_t *option="h", Option_t *axis="X")
Sort bins with labels or set option(s) to draw axis with labels.
virtual void SetBarWidth(Float_t width=0.5)
Set the width of bars as fraction of the bin width for drawing mode "B".
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
void PrepareTrainingAndTestTree(const TCut &cut, const TString &splitOpt)
prepare the training and test trees -> same cuts for signal and background
void AddVariable(const TString &expression, const TString &title, const TString &unit, char type='F', Double_t min=0, Double_t max=0)
user inserts discriminating variable in data set info
std::vector< OptionMap > fMethods
! Booked method information
std::shared_ptr< DataLoader > fDataLoader
! data
Envelope(const TString &name, DataLoader *dataloader=nullptr, TFile *file=nullptr, const TString options="")
Constructor for the initialization of Envelopes, differents Envelopes may needs differents constructo...
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)
VariableImportanceResult fResults
VariableImportance(DataLoader *loader)
TH1F * GetImportance(const UInt_t nbits, std::vector< Float_t > &importances, std::vector< TString > &varNames)
void EvaluateImportanceAll()
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Random number generator class based on M.
create variable transformations
void DataLoaderCopy(TMVA::DataLoader *des, TMVA::DataLoader *src)
MsgLogger & Endl(MsgLogger &ml)
static uint64_t sum(uint64_t i)