Logo ROOT  
Reference Guide
MethodBayesClassifier.cxx
Go to the documentation of this file.
1// @(#)root/tmva $Id$
2// Author: Marcin ....
3
4/**********************************************************************************
5 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6 * Package: TMVA *
7 * Class : MethodBayesClassifier *
8 * Web : http://tmva.sourceforge.net *
9 * *
10 * Description: *
11 * Implementation (see header file for description) *
12 * *
13 * Authors (alphabetical): *
14 * Abhishek Narain, <narainabhi@gmail.com> - University of Houston *
15 * *
16 * Copyright (c) 2005-2006: *
17 * University of Houston, *
18 * CERN, Switzerland *
19 * U. of Victoria, Canada *
20 * MPI-K Heidelberg, Germany *
21 * LAPP, Annecy, France *
22 * *
23 * Redistribution and use in source and binary forms, with or without *
24 * modification, are permitted according to the terms listed in LICENSE *
25 * (http://tmva.sourceforge.net/LICENSE) *
26 **********************************************************************************/
27
28/*! \class TMVA::MethodBayesClassifier
29\ingroup TMVA
30
31Description of bayesian classifiers.
32
33*/
34
36
38#include "TMVA/IMethod.h"
39#include "TMVA/MethodBase.h"
40#include "TMVA/MsgLogger.h"
41#include "TMVA/Tools.h"
42#include "TMVA/Types.h"
43
44#include <iostream>
45#include "TString.h"
46
47REGISTER_METHOD(BayesClassifier)
48
50
51////////////////////////////////////////////////////////////////////////////////
52/// standard constructor
53
55 const TString& methodTitle,
56 DataSetInfo& theData,
57 const TString& theOption ) :
58 TMVA::MethodBase( jobName, Types::kBayesClassifier, methodTitle, theData, theOption)
59{
60}
61
62////////////////////////////////////////////////////////////////////////////////
63/// constructor from weight file
64
66 const TString& theWeightFile) :
67 TMVA::MethodBase( Types::kBayesClassifier, theData, theWeightFile)
68{
69}
70
71////////////////////////////////////////////////////////////////////////////////
72/// Variable can handle classification with 2 classes
73
75{
76 if( type == Types::kClassification && numberClasses == 2 ) return kTRUE;
77 return kFALSE;
78}
79
80
81////////////////////////////////////////////////////////////////////////////////
82/// default initialisation
83
85{
86}
87
88////////////////////////////////////////////////////////////////////////////////
89/// define the options (their key words) that can be set in the option string
90
92{
93}
94
95////////////////////////////////////////////////////////////////////////////////
96/// the option string is decoded, for available options see "DeclareOptions"
97
99{
100}
101
102////////////////////////////////////////////////////////////////////////////////
103/// destructor
104
106{
107}
108
109////////////////////////////////////////////////////////////////////////////////
110/// some training
111
113{
114}
115
116////////////////////////////////////////////////////////////////////////////////
117
118void TMVA::MethodBayesClassifier::AddWeightsXMLTo( void* /*parent*/ ) const {
119 Log() << kFATAL << "Please implement writing of weights as XML" << Endl;
120}
121
122////////////////////////////////////////////////////////////////////////////////
123/// read back the training results from a file (stream)
124
126{
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// returns MVA value for given event
131
133{
134 Double_t myMVA = 0;
135
136 // cannot determine error
137 NoErrorCalc(err, errUpper);
138
139 return myMVA;
140}
141
142////////////////////////////////////////////////////////////////////////////////
143/// write specific classifier response
144
145void TMVA::MethodBayesClassifier::MakeClassSpecific( std::ostream& fout, const TString& className ) const
146{
147 fout << " // not implemented for class: \"" << className << "\"" << std::endl;
148 fout << "};" << std::endl;
149}
150
151////////////////////////////////////////////////////////////////////////////////
152/// get help message text
153///
154/// typical length of text line:
155/// "|--------------------------------------------------------------|"
156
158{
159 Log() << Endl;
160 Log() << gTools().Color("bold") << "--- Short description:" << gTools().Color("reset") << Endl;
161 Log() << Endl;
162 Log() << "<None>" << Endl;
163 Log() << Endl;
164 Log() << gTools().Color("bold") << "--- Performance optimisation:" << gTools().Color("reset") << Endl;
165 Log() << Endl;
166 Log() << "<None>" << Endl;
167 Log() << Endl;
168 Log() << gTools().Color("bold") << "--- Performance tuning via configuration options:" << gTools().Color("reset") << Endl;
169 Log() << Endl;
170 Log() << "<None>" << Endl;
171}
#define REGISTER_METHOD(CLASS)
for example
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassImp(name)
Definition: Rtypes.h:364
int type
Definition: TGX11.cxx:121
Class that contains all the data information.
Definition: DataSetInfo.h:62
Virtual base Class for all MVA method.
Definition: MethodBase.h:111
Description of bayesian classifiers.
void GetHelpMessage() const
get help message text
void ProcessOptions()
the option string is decoded, for available options see "DeclareOptions"
virtual ~MethodBayesClassifier(void)
destructor
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
returns MVA value for given event
void MakeClassSpecific(std::ostream &, const TString &) const
write specific classifier response
void ReadWeightsFromStream(std::istream &istr)
read back the training results from a file (stream)
void AddWeightsXMLTo(void *parent) const
void DeclareOptions()
define the options (their key words) that can be set in the option string
MethodBayesClassifier(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
standard constructor
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
Variable can handle classification with 2 classes.
void Init(void)
default initialisation
const TString & Color(const TString &)
human readable color strings
Definition: Tools.cxx:840
Singleton class for Global types used by TMVA.
Definition: Types.h:73
EAnalysisType
Definition: Types.h:128
@ kClassification
Definition: Types.h:129
@ kFATAL
Definition: Types.h:63
Basic string class.
Definition: TString.h:136
create variable transformations
Tools & gTools()
MsgLogger & Endl(MsgLogger &ml)
Definition: MsgLogger.h:158
Double_t Log(Double_t x)
Definition: TMath.h:760