Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files 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 /*! \class TMVA::MethodBayesClassifier
29 \ingroup TMVA
30 
31 Description of bayesian classifiers.
32 
33 */
34 
36 
37 #include "TMVA/ClassifierFactory.h"
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 "Riostream.h"
45 #include "TString.h"
46 
47 REGISTER_METHOD(BayesClassifier)
48 
49 ClassImp(TMVA::MethodBayesClassifier);
50 
51 ////////////////////////////////////////////////////////////////////////////////
52 /// standard constructor
53 
54  TMVA::MethodBayesClassifier::MethodBayesClassifier( const TString& jobName,
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 
65 TMVA::MethodBayesClassifier::MethodBayesClassifier( DataSetInfo& theData,
66  const TString& theWeightFile) :
67  TMVA::MethodBase( Types::kBayesClassifier, theData, theWeightFile)
68 {
69 }
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// Variable can handle classification with 2 classes
73 
74 Bool_t TMVA::MethodBayesClassifier::HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t /*numberTargets*/ )
75 {
76  if( type == Types::kClassification && numberClasses == 2 ) return kTRUE;
77  return kFALSE;
78 }
79 
80 
81 ////////////////////////////////////////////////////////////////////////////////
82 /// default initialisation
83 
84 void TMVA::MethodBayesClassifier::Init( void )
85 {
86 }
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 /// define the options (their key words) that can be set in the option string
90 
91 void TMVA::MethodBayesClassifier::DeclareOptions()
92 {
93 }
94 
95 ////////////////////////////////////////////////////////////////////////////////
96 /// the option string is decoded, for available options see "DeclareOptions"
97 
98 void TMVA::MethodBayesClassifier::ProcessOptions()
99 {
100 }
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 /// destructor
104 
105 TMVA::MethodBayesClassifier::~MethodBayesClassifier( void )
106 {
107 }
108 
109 ////////////////////////////////////////////////////////////////////////////////
110 /// some training
111 
112 void TMVA::MethodBayesClassifier::Train( void )
113 {
114 }
115 
116 ////////////////////////////////////////////////////////////////////////////////
117 
118 void 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 
125 void TMVA::MethodBayesClassifier::ReadWeightsFromStream( std::istream & )
126 {
127 }
128 
129 ////////////////////////////////////////////////////////////////////////////////
130 /// returns MVA value for given event
131 
132 Double_t TMVA::MethodBayesClassifier::GetMvaValue( Double_t* err, Double_t* errUpper )
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 
145 void 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 
157 void TMVA::MethodBayesClassifier::GetHelpMessage() const
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 }