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
51namespace 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
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
double Double_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:80
float Float_t
Definition: RtypesCore.h:57
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
Class that contains all the data information.
Definition: DataSetInfo.h:62
Interface for a fitter 'target'.
Definition: IFitterTarget.h:44
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
Class which takes the results of a multiclass classification.
void Resize(Int_t entries)
std::vector< Float_t > fEventWeights
TMatrixD GetConfusionMatrix(Double_t effB)
Returns a confusion matrix where each class is pitted against each other.
std::vector< UInt_t > fEventClasses
std::vector< Float_t > & GetAchievableEff()
Float_t GetAchievablePur(UInt_t cls)
std::vector< Float_t > & GetAchievablePur()
MsgLogger & Log() const
message logger
std::vector< Double_t > GetBestMultiClassCuts(UInt_t targetClass)
calculate the best working point (optimal cut values) for the multiclass classifier
Double_t EstimatorFunction(std::vector< Double_t > &)
std::vector< Float_t > fAchievableEff
std::vector< std::vector< Double_t > > fBestCuts
ResultsMulticlass(const DataSetInfo *dsi, TString resultsName)
constructor
void CreateMulticlassHistos(TString prefix, Int_t nbins, Int_t nbins_high)
this function fills the mva response histos for multiclass classification
virtual const std::vector< Float_t > & operator[](Int_t ievt) const
Float_t GetAchievableEff(UInt_t cls)
Long64_t GetSize() const
std::vector< Float_t > fAchievablePur
std::vector< std::vector< Float_t > > * GetValueVector()
virtual void Clear(Option_t *)
std::vector< std::vector< Float_t > > fMultiClassValues
std::vector< Float_t > fClassSumWeights
void CreateMulticlassPerformanceHistos(TString prefix)
Create performance graphs for this classifier a multiclass setting.
Types::EAnalysisType GetAnalysisType()
void SetValue(std::vector< Float_t > &value, Int_t ievt)
Class that is the base-class for a vector of result.
Definition: Results.h:57
EAnalysisType
Definition: Types.h:128
@ kMulticlass
Definition: Types.h:131
virtual void Clear(Option_t *="")
Definition: TObject.h:115
Basic string class.
Definition: TString.h:136
create variable transformations