Logo ROOT   6.10/09
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 <vector>
43 
44 #include "TH1F.h"
45 #include "TH2F.h"
46 
47 #include "TMVA/Results.h"
48 #include "TMVA/Event.h"
49 #include "IFitterTarget.h"
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 
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
virtual void Clear(Option_t *="")
Definition: TObject.h:91
std::vector< std::vector< Float_t > > * GetValueVector()
long long Long64_t
Definition: RtypesCore.h:69
Long64_t GetSize() const
float Float_t
Definition: RtypesCore.h:53
std::vector< Float_t > fAchievablePur
const char Option_t
Definition: RtypesCore.h:62
std::vector< Float_t > & GetAchievableEff()
virtual const std::vector< Float_t > & operator[](Int_t ievt) const
EAnalysisType
Definition: Types.h:125
Basic string class.
Definition: TString.h:129
int Int_t
Definition: RtypesCore.h:41
int nbins[3]
TMatrixD GetConfusionMatrix(Double_t effB)
Returns a confusion matrix where each class is pitted against each other.
std::vector< std::vector< Double_t > > fBestCuts
Types::EAnalysisType GetAnalysisType()
#define ClassDef(name, id)
Definition: Rtypes.h:297
Class that contains all the data information.
Definition: DataSetInfo.h:60
MsgLogger & Log() const
message logger
std::vector< Float_t > fEventWeights
ResultsMulticlass(const DataSetInfo *dsi, TString resultsName)
constructor
std::vector< Float_t > fClassSumWeights
std::vector< std::vector< Float_t > > fMultiClassValues
void SetValue(std::vector< Float_t > &value, Int_t ievt)
Float_t GetAchievablePur(UInt_t cls)
unsigned int UInt_t
Definition: RtypesCore.h:42
Double_t EstimatorFunction(std::vector< Double_t > &)
void CreateMulticlassPerformanceHistos(TString prefix)
Create performance graphs for this classifier a multiclass setting.
void CreateMulticlassHistos(TString prefix, Int_t nbins, Int_t nbins_high)
this function fills the mva response histos for multiclass classification
std::vector< Float_t > fAchievableEff
double Double_t
Definition: RtypesCore.h:55
std::vector< Double_t > GetBestMultiClassCuts(UInt_t targetClass)
calculate the best working point (optimal cut values) for the multiclass classifier ...
Class which takes the results of a multiclass classification.
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
Float_t GetAchievableEff(UInt_t cls)
std::vector< Float_t > & GetAchievablePur()
Abstract ClassifierFactory template that handles arbitrary types.
Class that is the base-class for a vector of result.
Definition: Results.h:57
std::vector< UInt_t > fEventClasses
virtual void Clear(Option_t *)
Interface for a fitter &#39;target&#39;.
Definition: IFitterTarget.h:44
void Resize(Int_t entries)