Logo ROOT   6.07/09
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 //_______________________________________________________________________
29 //
30 // ... description of bayesian classifiers ...
31 //_______________________________________________________________________
32 
34 
35 #include "TMVA/ClassifierFactory.h"
36 #include "TMVA/IMethod.h"
37 #include "TMVA/MethodBase.h"
38 #include "TMVA/MsgLogger.h"
39 #include "TMVA/Tools.h"
40 #include "TMVA/Types.h"
41 
42 #include "Riostream.h"
43 #include "TString.h"
44 
45 REGISTER_METHOD(BayesClassifier)
46 
47 ClassImp(TMVA::MethodBayesClassifier)
48 
49 ////////////////////////////////////////////////////////////////////////////////
50 /// standard constructor
51 
53  const TString& methodTitle,
54  DataSetInfo& theData,
55  const TString& theOption ) :
56  TMVA::MethodBase( jobName, Types::kBayesClassifier, methodTitle, theData, theOption)
57 {
58 }
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 /// constructor from weight file
62 
64  const TString& theWeightFile) :
65  TMVA::MethodBase( Types::kBayesClassifier, theData, theWeightFile)
66 {
67 }
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Variable can handle classification with 2 classes
71 
73 {
74  if( type == Types::kClassification && numberClasses == 2 ) return kTRUE;
75  return kFALSE;
76 }
77 
78 
79 ////////////////////////////////////////////////////////////////////////////////
80 /// default initialisation
81 
83 {
84 }
85 
86 ////////////////////////////////////////////////////////////////////////////////
87 /// define the options (their key words) that can be set in the option string
88 
90 {
91 }
92 
93 ////////////////////////////////////////////////////////////////////////////////
94 /// the option string is decoded, for availabel options see "DeclareOptions"
95 
97 {
98 }
99 
100 ////////////////////////////////////////////////////////////////////////////////
101 /// destructor
102 
104 {
105 }
106 
107 ////////////////////////////////////////////////////////////////////////////////
108 /// some training
109 
111 {
112 }
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 
116 void TMVA::MethodBayesClassifier::AddWeightsXMLTo( void* /*parent*/ ) const {
117  Log() << kFATAL << "Please implement writing of weights as XML" << Endl;
118 }
119 
120 ////////////////////////////////////////////////////////////////////////////////
121 /// read back the training results from a file (stream)
122 
124 {
125 }
126 
127 ////////////////////////////////////////////////////////////////////////////////
128 /// returns MVA value for given event
129 
131 {
132  Double_t myMVA = 0;
133 
134  // cannot determine error
135  NoErrorCalc(err, errUpper);
136 
137  return myMVA;
138 }
139 
140 ////////////////////////////////////////////////////////////////////////////////
141 /// write specific classifier response
142 
143 void TMVA::MethodBayesClassifier::MakeClassSpecific( std::ostream& fout, const TString& className ) const
144 {
145  fout << " // not implemented for class: \"" << className << "\"" << std::endl;
146  fout << "};" << std::endl;
147 }
148 
149 ////////////////////////////////////////////////////////////////////////////////
150 /// get help message text
151 ///
152 /// typical length of text line:
153 /// "|--------------------------------------------------------------|"
154 
156 {
157  Log() << Endl;
158  Log() << gTools().Color("bold") << "--- Short description:" << gTools().Color("reset") << Endl;
159  Log() << Endl;
160  Log() << "<None>" << Endl;
161  Log() << Endl;
162  Log() << gTools().Color("bold") << "--- Performance optimisation:" << gTools().Color("reset") << Endl;
163  Log() << Endl;
164  Log() << "<None>" << Endl;
165  Log() << Endl;
166  Log() << gTools().Color("bold") << "--- Performance tuning via configuration options:" << gTools().Color("reset") << Endl;
167  Log() << Endl;
168  Log() << "<None>" << Endl;
169 }
MsgLogger & Endl(MsgLogger &ml)
Definition: MsgLogger.h:162
#define REGISTER_METHOD(CLASS)
for example
EAnalysisType
Definition: Types.h:128
Basic string class.
Definition: TString.h:137
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
returns MVA value for given event
virtual ~MethodBayesClassifier(void)
destructor
void ProcessOptions()
the option string is decoded, for availabel options see "DeclareOptions"
Tools & gTools()
Definition: Tools.cxx:79
void Init(void)
default initialisation
void ReadWeightsFromStream(std::istream &istr)
read back the training results from a file (stream)
unsigned int UInt_t
Definition: RtypesCore.h:42
void GetHelpMessage() const
get help message text
MethodBayesClassifier(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
standard constructor
#define ClassImp(name)
Definition: Rtypes.h:279
double Double_t
Definition: RtypesCore.h:55
int type
Definition: TGX11.cxx:120
MsgLogger & Log() const
Definition: Configurable.h:128
const TString & Color(const TString &)
human readable color strings
Definition: Tools.cxx:837
void Train(void)
some training
void MakeClassSpecific(std::ostream &, const TString &) const
write specific classifier response
Abstract ClassifierFactory template that handles arbitrary types.
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
Variable can handle classification with 2 classes.
void DeclareOptions()
define the options (their key words) that can be set in the option string
void AddWeightsXMLTo(void *parent) const
const Bool_t kTRUE
Definition: Rtypes.h:91
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
Definition: MethodBase.cxx:819