46 TMVA::Ranking::Ranking()
49 fRankingDiscriminatorName( "" ),
50 fLogger( new MsgLogger("",
kINFO) )
60 fRankingDiscriminatorName( rankingDiscriminatorName ),
79 fLogger->SetSource( fContext.Data() );
93 fRanking.push_back( rank );
95 UInt_t sizeofarray=fRanking.size();
96 Rank temp(fRanking[0]);
97 for (
UInt_t i=0; i<sizeofarray; i++) {
98 for (
UInt_t j=sizeofarray-1; j>i; j--) {
99 if (fRanking[j-1] < fRanking[j]) {
100 temp = fRanking[j-1];fRanking[j-1] = fRanking[j]; fRanking[j] = temp;
105 for (
UInt_t i=0; i<fRanking.size(); i++) fRanking[i].SetRank( i+1 );
114 for (std::vector<Rank>::const_iterator ir = fRanking.begin(); ir != fRanking.end(); ir++ )
115 if ((*ir).GetVariable().Length() > maxL) maxL = (*ir).GetVariable().Length();
118 for (
Int_t i=0; i<maxL+15+fRankingDiscriminatorName.Length(); i++) hline +=
"-";
119 Log() <<
kINFO <<
"Ranking result (top variable is best ranked)" <<
Endl;
121 Log() <<
kINFO << std::setiosflags(std::ios::left)
122 << std::setw(5) <<
"Rank : "
123 << std::setw(maxL+0) <<
"Variable "
124 << std::resetiosflags(std::ios::right)
125 <<
" : " << fRankingDiscriminatorName <<
Endl;
127 for (std::vector<Rank>::const_iterator ir = fRanking.begin(); ir != fRanking.end(); ir++ ) {
129 <<
Form(
"%4i : ",(*ir).GetRank() )
130 << std::setw(
TMath::Max(maxL+0,9)) << (*ir).GetVariable().Data()
131 <<
Form(
" : %3.3e", (*ir).GetRankValue() ) << Endl;
142 : fVariable( variable ),
143 fRankValue( rankValue ),
160 if (fRankValue < other.
fRankValue)
return true;
169 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
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 <