ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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"
34 #include "TMVA/MethodBase.h"
36 #include "TMVA/MsgLogger.h"
37 #include "TMVA/Tools.h"
38 #include "TMVA/Types.h"
39 #include "Riostream.h"
40 
41 REGISTER_METHOD(BayesClassifier)
42 
43 ClassImp(TMVA::MethodBayesClassifier)
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// standard constructor
47 
48 TMVA::MethodBayesClassifier::MethodBayesClassifier( const TString& jobName,
49  const TString& methodTitle,
50  DataSetInfo& theData,
51  const TString& theOption,
52  TDirectory* theTargetDir ) :
53  TMVA::MethodBase( jobName, Types::kBayesClassifier, methodTitle, theData, theOption, theTargetDir )
54 {
55 }
56 
57 ////////////////////////////////////////////////////////////////////////////////
58 /// constructor from weight file
59 
61  const TString& theWeightFile,
62  TDirectory* theTargetDir ) :
63  TMVA::MethodBase( Types::kBayesClassifier, theData, theWeightFile, theTargetDir )
64 {
65 }
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// Variable can handle classification with 2 classes
69 
71 {
72  if( type == Types::kClassification && numberClasses == 2 ) return kTRUE;
73  return kFALSE;
74 }
75 
76 
77 ////////////////////////////////////////////////////////////////////////////////
78 /// default initialisation
79 
81 {
82 }
83 
84 ////////////////////////////////////////////////////////////////////////////////
85 /// define the options (their key words) that can be set in the option string
86 
88 {
89 }
90 
91 ////////////////////////////////////////////////////////////////////////////////
92 /// the option string is decoded, for availabel options see "DeclareOptions"
93 
95 {
96 }
97 
98 ////////////////////////////////////////////////////////////////////////////////
99 /// destructor
100 
102 {
103 }
104 
105 ////////////////////////////////////////////////////////////////////////////////
106 /// some training
107 
109 {
110 }
111 
112 ////////////////////////////////////////////////////////////////////////////////
113 
114 void TMVA::MethodBayesClassifier::AddWeightsXMLTo( void* /*parent*/ ) const {
115  Log() << kFATAL << "Please implement writing of weights as XML" << Endl;
116 }
117 
118 ////////////////////////////////////////////////////////////////////////////////
119 /// read back the training results from a file (stream)
120 
122 {
123 }
124 
125 ////////////////////////////////////////////////////////////////////////////////
126 /// returns MVA value for given event
127 
129 {
130  Double_t myMVA = 0;
131 
132  // cannot determine error
133  NoErrorCalc(err, errUpper);
134 
135  return myMVA;
136 }
137 
138 ////////////////////////////////////////////////////////////////////////////////
139 /// write specific classifier response
140 
141 void TMVA::MethodBayesClassifier::MakeClassSpecific( std::ostream& fout, const TString& className ) const
142 {
143  fout << " // not implemented for class: \"" << className << "\"" << std::endl;
144  fout << "};" << std::endl;
145 }
146 
147 ////////////////////////////////////////////////////////////////////////////////
148 /// get help message text
149 ///
150 /// typical length of text line:
151 /// "|--------------------------------------------------------------|"
152 
154 {
155  Log() << Endl;
156  Log() << gTools().Color("bold") << "--- Short description:" << gTools().Color("reset") << Endl;
157  Log() << Endl;
158  Log() << "<None>" << Endl;
159  Log() << Endl;
160  Log() << gTools().Color("bold") << "--- Performance optimisation:" << gTools().Color("reset") << Endl;
161  Log() << Endl;
162  Log() << "<None>" << Endl;
163  Log() << Endl;
164  Log() << gTools().Color("bold") << "--- Performance tuning via configuration options:" << gTools().Color("reset") << Endl;
165  Log() << Endl;
166  Log() << "<None>" << Endl;
167 }
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:44
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
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