ROOT  6.06/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 
33 #include "TMVA/ClassifierFactory.h"
35 #include "TMVA/Tools.h"
36 #include "Riostream.h"
37 
38 REGISTER_METHOD(BayesClassifier)
39 
40 ClassImp(TMVA::MethodBayesClassifier)
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// standard constructor
44 
45 TMVA::MethodBayesClassifier::MethodBayesClassifier( const TString& jobName,
46  const TString& methodTitle,
47  DataSetInfo& theData,
48  const TString& theOption,
49  TDirectory* theTargetDir ) :
50  TMVA::MethodBase( jobName, Types::kBayesClassifier, methodTitle, theData, theOption, theTargetDir )
51 {
52 }
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 /// constructor from weight file
56 
58  const TString& theWeightFile,
59  TDirectory* theTargetDir ) :
60  TMVA::MethodBase( Types::kBayesClassifier, theData, theWeightFile, theTargetDir )
61 {
62 }
63 
64 ////////////////////////////////////////////////////////////////////////////////
65 /// Variable can handle classification with 2 classes
66 
68 {
69  if( type == Types::kClassification && numberClasses == 2 ) return kTRUE;
70  return kFALSE;
71 }
72 
73 
74 ////////////////////////////////////////////////////////////////////////////////
75 /// default initialisation
76 
78 {
79 }
80 
81 ////////////////////////////////////////////////////////////////////////////////
82 /// define the options (their key words) that can be set in the option string
83 
85 {
86 }
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 /// the option string is decoded, for availabel options see "DeclareOptions"
90 
92 {
93 }
94 
95 ////////////////////////////////////////////////////////////////////////////////
96 /// destructor
97 
99 {
100 }
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 /// some training
104 
106 {
107 }
108 
109 ////////////////////////////////////////////////////////////////////////////////
110 
111 void TMVA::MethodBayesClassifier::AddWeightsXMLTo( void* /*parent*/ ) const {
112  Log() << kFATAL << "Please implement writing of weights as XML" << Endl;
113 }
114 
115 ////////////////////////////////////////////////////////////////////////////////
116 /// read back the training results from a file (stream)
117 
119 {
120 }
121 
122 ////////////////////////////////////////////////////////////////////////////////
123 /// returns MVA value for given event
124 
126 {
127  Double_t myMVA = 0;
128 
129  // cannot determine error
130  NoErrorCalc(err, errUpper);
131 
132  return myMVA;
133 }
134 
135 ////////////////////////////////////////////////////////////////////////////////
136 /// write specific classifier response
137 
138 void TMVA::MethodBayesClassifier::MakeClassSpecific( std::ostream& fout, const TString& className ) const
139 {
140  fout << " // not implemented for class: \"" << className << "\"" << std::endl;
141  fout << "};" << std::endl;
142 }
143 
144 ////////////////////////////////////////////////////////////////////////////////
145 /// get help message text
146 ///
147 /// typical length of text line:
148 /// "|--------------------------------------------------------------|"
149 
151 {
152  Log() << Endl;
153  Log() << gTools().Color("bold") << "--- Short description:" << gTools().Color("reset") << Endl;
154  Log() << Endl;
155  Log() << "<None>" << Endl;
156  Log() << Endl;
157  Log() << gTools().Color("bold") << "--- Performance optimisation:" << gTools().Color("reset") << Endl;
158  Log() << Endl;
159  Log() << "<None>" << Endl;
160  Log() << Endl;
161  Log() << gTools().Color("bold") << "--- Performance tuning via configuration options:" << gTools().Color("reset") << Endl;
162  Log() << Endl;
163  Log() << "<None>" << Endl;
164 }
MsgLogger & Endl(MsgLogger &ml)
Definition: MsgLogger.h:162
EAnalysisType
Definition: Types.h:124
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
double Double_t
Definition: RtypesCore.h:55
Describe directory structure in memory.
Definition: TDirectory.h:41
int type
Definition: TGX11.cxx:120
const TString & Color(const TString &)
human readable color strings
Definition: Tools.cxx:837
void Train(void)
some training
#define REGISTER_METHOD(CLASS)
for example
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
ClassImp(TMVA::MethodBayesClassifier) TMVA
standard constructor
MethodBayesClassifier(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="", TDirectory *theTargetDir=0)
const Bool_t kTRUE
Definition: Rtypes.h:91
Definition: math.cpp:60