44 TMVA::Ranking::Ranking()
47 fRankingDiscriminatorName( "" ),
48 fLogger( new MsgLogger("",
kINFO) )
58 fRankingDiscriminatorName( rankingDiscriminatorName ),
77 fLogger->SetSource( fContext.Data() );
91 fRanking.push_back( rank );
93 UInt_t sizeofarray=fRanking.size();
94 Rank temp(fRanking[0]);
95 for (
UInt_t i=0; i<sizeofarray; i++) {
96 for (
UInt_t j=sizeofarray-1; j>i; j--) {
97 if (fRanking[j-1] < fRanking[j]) {
98 temp = fRanking[j-1];fRanking[j-1] = fRanking[j]; fRanking[j] = temp;
103 for (
UInt_t i=0; i<fRanking.size(); i++) fRanking[i].SetRank( i+1 );
112 for (std::vector<Rank>::const_iterator ir = fRanking.begin(); ir != fRanking.end(); ir++ )
113 if ((*ir).GetVariable().Length() > maxL) maxL = (*ir).GetVariable().Length();
116 for (
Int_t i=0; i<maxL+15+fRankingDiscriminatorName.Length(); i++) hline +=
"-";
117 Log() <<
kINFO <<
"Ranking result (top variable is best ranked)" <<
Endl;
119 Log() <<
kINFO << std::setiosflags(std::ios::left)
120 << std::setw(5) <<
"Rank : "
121 << std::setw(maxL+0) <<
"Variable "
122 << std::resetiosflags(std::ios::right)
123 <<
" : " << fRankingDiscriminatorName <<
Endl;
125 for (std::vector<Rank>::const_iterator ir = fRanking.begin(); ir != fRanking.end(); ir++ ) {
127 <<
Form(
"%4i : ",(*ir).GetRank() )
128 << std::setw(
TMath::Max(maxL+0,9)) << (*ir).GetVariable().Data()
129 <<
Form(
" : %3.3e", (*ir).GetRankValue() ) << Endl;
140 : fVariable( variable ),
141 fRankValue( rankValue ),
158 if (fRankValue < other.
fRankValue)
return true;
167 if (fRankValue > other.
fRankValue)
return true;
MsgLogger & Endl(MsgLogger &ml)
virtual ~Rank()
destructor
void SetContext(const TString &context)
std::vector< std::vector< double > > Data
Bool_t operator>(const Rank &other) const
comparison operator >
ClassImp(TMVA::Ranking) TMVA
default constructor
Rank(const TString &variable, Double_t rankValue)
constructor
char * Form(const char *fmt,...)
virtual ~Ranking()
destructor
Abstract ClassifierFactory template that handles arbitrary types.
virtual void AddRank(const Rank &rank)
Add a new rank take ownership of it.
Short_t Max(Short_t a, Short_t b)
virtual void Print() const
get maximum length of variable names
Bool_t operator<(const Rank &other) const
comparison operator <