Logo ROOT  
Reference Guide
ResultsMulticlass.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss, Jan Therhaag
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : ResultsMulticlass *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Base-class for result-vectors *
12  * *
13  * Authors (alphabetical): *
14  * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15  * Peter Speckmayer <Peter.Speckmayer@cern.ch> - CERN, Switzerland *
16  * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
17  * Jan Therhaag <Jan.Therhaag@cern.ch> - U of Bonn, Germany *
18  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
19  * *
20  * Copyright (c) 2005-2011: *
21  * CERN, Switzerland *
22  * U. of Victoria, Canada *
23  * MPI-K Heidelberg, Germany *
24  * U. of Bonn, Germany *
25  * *
26  * Redistribution and use in source and binary forms, with or without *
27  * modification, are permitted according to the terms listed in LICENSE *
28  * (http://tmva.sourceforge.net/LICENSE) *
29  **********************************************************************************/
30 
31 #ifndef ROOT_TMVA_ResultsMulticlass
32 #define ROOT_TMVA_ResultsMulticlass
33 
34 //////////////////////////////////////////////////////////////////////////
35 // //
36 // ResultsMulticlass //
37 // //
38 // Class which takes the results of a multiclass classification //
39 // //
40 //////////////////////////////////////////////////////////////////////////
41 
42 #include "TH1F.h"
43 #include "TH2F.h"
44 
45 #include "TMVA/Results.h"
46 #include "TMVA/Event.h"
47 #include "IFitterTarget.h"
48 
49 #include <vector>
50 
51 namespace TMVA {
52 
53  class MsgLogger;
54 
55  class ResultsMulticlass : public Results, public IFitterTarget {
56 
57  public:
58 
59  ResultsMulticlass( const DataSetInfo* dsi, TString resultsName );
61 
62  // setters
63  void SetValue( std::vector<Float_t>& value, Int_t ievt );
64  void Resize( Int_t entries ) { fMultiClassValues.resize( entries ); }
65  using TObject::Clear;
66  virtual void Clear(Option_t *) { fMultiClassValues.clear(); }
67 
68  // getters
69  Long64_t GetSize() const { return fMultiClassValues.size(); }
70  virtual const std::vector< Float_t >& operator[] ( Int_t ievt ) const { return fMultiClassValues.at(ievt); }
71  std::vector<std::vector< Float_t> >* GetValueVector() { return &fMultiClassValues; }
72 
74  Float_t GetAchievableEff(UInt_t cls){return fAchievableEff.at(cls);}
75  Float_t GetAchievablePur(UInt_t cls){return fAchievablePur.at(cls);}
76  std::vector<Float_t>& GetAchievableEff(){return fAchievableEff;}
77  std::vector<Float_t>& GetAchievablePur(){return fAchievablePur;}
78 
80 
81  // histogramming
83  void CreateMulticlassHistos( TString prefix, Int_t nbins, Int_t nbins_high);
84 
85  Double_t EstimatorFunction( std::vector<Double_t> & );
86  std::vector<Double_t> GetBestMultiClassCuts(UInt_t targetClass);
87 
88  private:
89 
90  mutable std::vector<std::vector< Float_t> > fMultiClassValues; // mva values (Results)
91  mutable MsgLogger* fLogger; //! message logger
92  MsgLogger& Log() const { return *fLogger; }
94  std::vector<Float_t> fAchievableEff;
95  std::vector<Float_t> fAchievablePur;
96  std::vector<std::vector<Double_t> > fBestCuts;
97 
98  // Temporary storage used during GetBestMultiClassCuts
99  std::vector<Float_t> fClassSumWeights;
100  std::vector<Float_t> fEventWeights;
101  std::vector<UInt_t> fEventClasses;
102 
103  protected:
104 
106 
107  };
108 
109 }
110 
111 #endif
TMVA::ResultsMulticlass::GetAchievablePur
std::vector< Float_t > & GetAchievablePur()
Definition: ResultsMulticlass.h:102
TMVA::ResultsMulticlass::GetSize
Long64_t GetSize() const
Definition: ResultsMulticlass.h:94
TMVA::Types::kMulticlass
@ kMulticlass
Definition: Types.h:153
TH1F.h
TMVA::ResultsMulticlass::Resize
void Resize(Int_t entries)
Definition: ResultsMulticlass.h:89
TMVA::ResultsMulticlass::CreateMulticlassHistos
void CreateMulticlassHistos(TString prefix, Int_t nbins, Int_t nbins_high)
this function fills the mva response histos for multiclass classification
Definition: ResultsMulticlass.cxx:354
TMVA::ResultsMulticlass::EstimatorFunction
Double_t EstimatorFunction(std::vector< Double_t > &)
Definition: ResultsMulticlass.cxx:136
TMVA::ResultsMulticlass
Definition: ResultsMulticlass.h:80
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TMVA::ResultsMulticlass::CreateMulticlassPerformanceHistos
void CreateMulticlassPerformanceHistos(TString prefix)
Create performance graphs for this classifier a multiclass setting.
Definition: ResultsMulticlass.cxx:240
Float_t
float Float_t
Definition: RtypesCore.h:57
TMVA::ResultsMulticlass::fAchievablePur
std::vector< Float_t > fAchievablePur
Definition: ResultsMulticlass.h:120
Int_t
int Int_t
Definition: RtypesCore.h:45
TMVA::ResultsMulticlass::fEventClasses
std::vector< UInt_t > fEventClasses
Definition: ResultsMulticlass.h:126
TMVA::ResultsMulticlass::GetAnalysisType
Types::EAnalysisType GetAnalysisType()
Definition: ResultsMulticlass.h:98
TString
Definition: TString.h:136
TMatrixT
Definition: TMatrixDfwd.h:22
TMVA::ResultsMulticlass::ResultsMulticlass
ResultsMulticlass(const DataSetInfo *dsi, TString resultsName)
constructor
Definition: ResultsMulticlass.cxx:58
TMVA::ResultsMulticlass::fClassToOptimize
UInt_t fClassToOptimize
Definition: ResultsMulticlass.h:118
TMVA::ResultsMulticlass::fBestCuts
std::vector< std::vector< Double_t > > fBestCuts
Definition: ResultsMulticlass.h:121
TMVA::ResultsMulticlass::GetBestMultiClassCuts
std::vector< Double_t > GetBestMultiClassCuts(UInt_t targetClass)
calculate the best working point (optimal cut values) for the multiclass classifier
Definition: ResultsMulticlass.cxx:188
TMVA::ResultsMulticlass::fMultiClassValues
std::vector< std::vector< Float_t > > fMultiClassValues
Definition: ResultsMulticlass.h:115
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TMVA::ResultsMulticlass::SetValue
void SetValue(std::vector< Float_t > &value, Int_t ievt)
Definition: ResultsMulticlass.cxx:79
TMVA::Types::EAnalysisType
EAnalysisType
Definition: Types.h:150
TMVA::ResultsMulticlass::GetValueVector
std::vector< std::vector< Float_t > > * GetValueVector()
Definition: ResultsMulticlass.h:96
TMVA::ResultsMulticlass::GetAchievableEff
std::vector< Float_t > & GetAchievableEff()
Definition: ResultsMulticlass.h:101
TMVA::ResultsMulticlass::fLogger
MsgLogger * fLogger
Definition: ResultsMulticlass.h:116
Event.h
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TH2F.h
unsigned int
TMVA::ResultsMulticlass::Clear
virtual void Clear(Option_t *)
Definition: ResultsMulticlass.h:91
TMVA::ResultsMulticlass::fClassSumWeights
std::vector< Float_t > fClassSumWeights
Definition: ResultsMulticlass.h:124
TMVA::ResultsMulticlass::fAchievableEff
std::vector< Float_t > fAchievableEff
Definition: ResultsMulticlass.h:119
Double_t
double Double_t
Definition: RtypesCore.h:59
IFitterTarget.h
TMVA::MsgLogger
Definition: MsgLogger.h:83
TMVA::ResultsMulticlass::operator[]
virtual const std::vector< Float_t > & operator[](Int_t ievt) const
Definition: ResultsMulticlass.h:95
TMVA::ResultsMulticlass::Log
MsgLogger & Log() const
message logger
Definition: ResultsMulticlass.h:117
TMVA::ResultsMulticlass::~ResultsMulticlass
~ResultsMulticlass()
destructor
Definition: ResultsMulticlass.cxx:72
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TMVA::ResultsMulticlass::fEventWeights
std::vector< Float_t > fEventWeights
Definition: ResultsMulticlass.h:125
TMVA::ResultsMulticlass::GetConfusionMatrix
TMatrixD GetConfusionMatrix(Double_t effB)
Returns a confusion matrix where each class is pitted against each other.
Definition: ResultsMulticlass.cxx:89
Results.h
TObject::Clear
virtual void Clear(Option_t *="")
Definition: TObject.h:100
TMVA
create variable transformations
Definition: GeneticMinimizer.h:22
int