00001 // @(#)root/tmva $Id: ResultsMulticlass.h 36966 2010-11-26 09:50:13Z evt $ 00002 // Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss 00003 00004 /********************************************************************************** 00005 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis * 00006 * Package: TMVA * 00007 * Class : ResultsMulticlass * 00008 * Web : http://tmva.sourceforge.net * 00009 * * 00010 * Description: * 00011 * Base-class for result-vectors * 00012 * * 00013 * Authors (alphabetical): * 00014 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland * 00015 * Peter Speckmayer <Peter.Speckmayer@cern.ch> - CERN, Switzerland * 00016 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland * 00017 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany * 00018 * * 00019 * Copyright (c) 2006: * 00020 * CERN, Switzerland * 00021 * U. of Victoria, Canada * 00022 * MPI-K Heidelberg, Germany * 00023 * * 00024 * Redistribution and use in source and binary forms, with or without * 00025 * modification, are permitted according to the terms listed in LICENSE * 00026 * (http://tmva.sourceforge.net/LICENSE) * 00027 **********************************************************************************/ 00028 00029 #ifndef ROOT_TMVA_ResultsMulticlass 00030 #define ROOT_TMVA_ResultsMulticlass 00031 00032 ////////////////////////////////////////////////////////////////////////// 00033 // // 00034 // ResultsMulticlass // 00035 // // 00036 // Class which takes the results of a multiclass classification // 00037 // // 00038 ////////////////////////////////////////////////////////////////////////// 00039 00040 #include <vector> 00041 00042 #ifndef ROOT_TH1F 00043 #include "TH1F.h" 00044 #endif 00045 #ifndef ROOT_TH2F 00046 #include "TH2F.h" 00047 #endif 00048 00049 #ifndef ROOT_TMVA_Results 00050 #include "TMVA/Results.h" 00051 #endif 00052 #ifndef ROOT_TMVA_Event 00053 #include "TMVA/Event.h" 00054 #endif 00055 #ifndef ROOT_IFitterTarget 00056 #include "IFitterTarget.h" 00057 #endif 00058 00059 namespace TMVA { 00060 00061 class MsgLogger; 00062 00063 class ResultsMulticlass : public Results, public IFitterTarget { 00064 00065 public: 00066 00067 ResultsMulticlass( const DataSetInfo* dsi ); 00068 ~ResultsMulticlass(); 00069 00070 // setters 00071 void SetValue( std::vector<Float_t>& value, Int_t ievt ); 00072 void Resize( Int_t entries ) { fMultiClassValues.resize( entries ); } 00073 void Clear() { fMultiClassValues.clear(); } 00074 00075 // getters 00076 Long64_t GetSize() const { return fMultiClassValues.size(); } 00077 virtual const std::vector< Float_t >& operator[] ( Int_t ievt ) const { return fMultiClassValues.at(ievt); } 00078 std::vector<std::vector< Float_t> >* GetValueVector() { return &fMultiClassValues; } 00079 00080 Types::EAnalysisType GetAnalysisType() { return Types::kMulticlass; } 00081 Float_t GetAchievableEff(UInt_t cls){return fAchievableEff.at(cls);} 00082 Float_t GetAchievablePur(UInt_t cls){return fAchievablePur.at(cls);} 00083 std::vector<Float_t>& GetAchievableEff(){return fAchievableEff;} 00084 std::vector<Float_t>& GetAchievablePur(){return fAchievablePur;} 00085 // histogramming 00086 void CreateMulticlassHistos( TString prefix, Int_t nbins, Int_t nbins_high); 00087 00088 Double_t EstimatorFunction( std::vector<Double_t> & ); 00089 std::vector<Double_t> GetBestMultiClassCuts(UInt_t targetClass); 00090 00091 private: 00092 00093 mutable std::vector<std::vector< Float_t> > fMultiClassValues; //! mva values (Results) 00094 mutable MsgLogger* fLogger; //! message logger 00095 MsgLogger& Log() const { return *fLogger; } 00096 UInt_t fClassToOptimize; 00097 std::vector<Float_t> fAchievableEff; 00098 std::vector<Float_t> fAchievablePur; 00099 std::vector<std::vector<Double_t> > fBestCuts; 00100 }; 00101 00102 } 00103 00104 #endif