Logo ROOT   6.18/05
Reference Guide
MethodRSVM.h
Go to the documentation of this file.
1// @(#)root/tmva/rmva $Id$
2// Author: Omar Zapata,Lorenzo Moneta, Sergei Gleyzer 2015
3
4/**********************************************************************************
5 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6 * Package: TMVA *
7 * Class : RMethodRSVM *
8 * *
9 * Description: *
10 * R´s Package RSVM method based on ROOTR *
11 * *
12 **********************************************************************************/
13
14#ifndef ROOT_TMVA_RMethodRSVM
15#define ROOT_TMVA_RMethodRSVM
16
17//////////////////////////////////////////////////////////////////////////
18// //
19// RMethodRSVM //
20// //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TMVA/RMethodBase.h"
25
26namespace TMVA {
27
28 class Factory; // DSMTEST
29 class Reader; // DSMTEST
30 class DataSetManager; // DSMTEST
31 class Types;
32 class MethodRSVM : public RMethodBase {
33
34 public :
35
36 // constructors
37 MethodRSVM(const TString &jobName,
38 const TString &methodTitle,
39 DataSetInfo &theData,
40 const TString &theOption = "");
41
43 const TString &theWeightFile);
44
45
46 ~MethodRSVM(void);
47 void Train();
48 // options treatment
49 void Init();
50 void DeclareOptions();
51 void ProcessOptions();
52 // create ranking
54 {
55 return NULL; // = 0;
56 }
57
58
59 Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets);
60
61 // performs classifier testing
62 virtual void TestClassification();
63
64
65 Double_t GetMvaValue(Double_t *errLower = 0, Double_t *errUpper = 0);
66
68 // the actual "weights"
69 virtual void AddWeightsXMLTo(void * /*parent*/) const {} // = 0;
70 virtual void ReadWeightsFromXML(void * /*wghtnode*/) {} // = 0;
71 virtual void ReadWeightsFromStream(std::istream &) {} //= 0; // backward compatibility
72 void ReadModelFromFile();
73
74 // signal/background classification response for all current set of data
75 virtual std::vector<Double_t> GetMvaValues(Long64_t firstEvt = 0, Long64_t lastEvt = -1, Bool_t logProgress = false);
76
77 private :
79 friend class Factory; // DSMTEST
80 friend class Reader; // DSMTEST
81 protected:
83 std::vector<Float_t> fProbResultForTrainSig;
84 std::vector<Float_t> fProbResultForTestSig;
85
86 //Booking options
87 Bool_t fScale;//A logical vector indicating the variables to be scaled. If
88 //‘scale’ is of length 1, the value is recycled as many times
89 //as needed. Per default, data are scaled internally (both ‘x’
90 //and ‘y’ variables) to zero mean and unit variance. The center
91 //and scale values are returned and used for later predictions.
92 TString fType;//‘svm’ can be used as a classification machine, as a
93 //regression machine, or for novelty detection. Depending of
94 //whether ‘y’ is a factor or not, the default setting for
95 //‘type’ is ‘C-classification’ or ‘eps-regression’,
96 //respectively, but may be overwritten by setting an explicit value.
97 //Valid options are:
98 // - ‘C-classification’
99 // - ‘nu-classification’
100 // - ‘one-classification’ (for novelty detection)
101 // - ‘eps-regression’
102 // - ‘nu-regression’
103 TString fKernel;//the kernel used in training and predicting. You might
104 //consider changing some of the following parameters, depending on the kernel type.
105 //linear: u'*v
106 //polynomial: (gamma*u'*v + coef0)^degree
107 //radial basis: exp(-gamma*|u-v|^2)
108 //sigmoid: tanh(gamma*u'*v + coef0)
109 Int_t fDegree;//parameter needed for kernel of type ‘polynomial’ (default: 3)
110 Float_t fGamma;//parameter needed for all kernels except ‘linear’ (default: 1/(data dimension))
111 Float_t fCoef0;//parameter needed for kernels of type ‘polynomial’ and ‘sigmoid’ (default: 0)
112 Float_t fCost;//cost of constraints violation (default: 1)-it is the
113 //‘C’-constant of the regularization term in the Lagrange formulation.
114 Float_t fNu;//parameter needed for ‘nu-classification’, ‘nu-regression’, and ‘one-classification’
115 Float_t fCacheSize;//cache memory in MB (default 40)
116 Float_t fTolerance;//tolerance of termination criterion (default: 0.001)
117 Float_t fEpsilon;//epsilon in the insensitive-loss function (default: 0.1)
118 Bool_t fShrinking;//option whether to use the shrinking-heuristics (default: ‘TRUE’)
119 Float_t fCross;//if a integer value k>0 is specified, a k-fold cross
120 //validation on the training data is performed to assess the
121 //quality of the model: the accuracy rate for classification
122 //and the Mean Squared Error for regression
123 Bool_t fProbability;//logical indicating whether the model should allow for probability predictions.
124 Bool_t fFitted;//logical indicating whether the fitted values should be computed and included in the model or not (default: ‘TRUE’)
125
131 // get help message text
132 void GetHelpMessage() const;
133
135 };
136} // namespace TMVA
137#endif
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
long long Long64_t
Definition: RtypesCore.h:69
float Float_t
Definition: RtypesCore.h:53
#define ClassDef(name, id)
Definition: Rtypes.h:326
int type
Definition: TGX11.cxx:120
This is a class to pass functions from ROOT to R.
This is a class to get ROOT's objects from R's objects.
Definition: TRObject.h:71
Class that contains all the data information.
Definition: DataSetInfo.h:60
Class that contains all the data information.
This is the main MVA steering class.
Definition: Factory.h:81
virtual void ReadWeightsFromStream(std::istream &)=0
virtual void ReadWeightsFromXML(void *)
Definition: MethodRSVM.h:70
virtual std::vector< Double_t > GetMvaValues(Long64_t firstEvt=0, Long64_t lastEvt=-1, Bool_t logProgress=false)
get all the MVA values for the events of the current Data type
Definition: MethodRSVM.cxx:273
std::vector< Float_t > fProbResultForTrainSig
Definition: MethodRSVM.h:83
virtual void TestClassification()
initialization
Definition: MethodRSVM.cxx:243
Float_t fTolerance
Definition: MethodRSVM.h:116
void ReadModelFromFile()
Definition: MethodRSVM.cxx:356
ROOT::R::TRFunctionImport asfactor
Definition: MethodRSVM.h:129
static Bool_t IsModuleLoaded
Definition: MethodRSVM.h:126
virtual void ReadWeightsFromStream(std::istream &)
Definition: MethodRSVM.h:71
ROOT::R::TRObject * fModel
Definition: MethodRSVM.h:130
std::vector< Float_t > fProbResultForTestSig
Definition: MethodRSVM.h:84
MethodRSVM(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
Definition: MethodRSVM.cxx:50
Bool_t fProbability
Definition: MethodRSVM.h:123
ROOT::R::TRFunctionImport svm
Definition: MethodRSVM.h:127
Float_t fEpsilon
Definition: MethodRSVM.h:117
DataSetManager * fDataSetManager
Definition: MethodRSVM.h:78
const Ranking * CreateRanking()
Definition: MethodRSVM.h:53
UInt_t fMvaCounter
Definition: MethodRSVM.h:82
Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)
Definition: MethodRSVM.cxx:252
void GetHelpMessage() const
Definition: MethodRSVM.cxx:371
virtual void AddWeightsXMLTo(void *) const
Definition: MethodRSVM.h:69
ROOT::R::TRFunctionImport predict
Definition: MethodRSVM.h:128
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
Definition: MethodRSVM.cxx:118
Float_t fCacheSize
Definition: MethodRSVM.h:115
Ranking for variables in method (implementation)
Definition: Ranking.h:48
The Reader class serves to use the MVAs in a specific analysis context.
Definition: Reader.h:63
EAnalysisType
Definition: Types.h:127
Basic string class.
Definition: TString.h:131
create variable transformations