ROOT  6.06/09
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 #ifndef ROOT_TMVA_RMethodBase
25 #include "TMVA/RMethodBase.h"
26 #endif
27 
28 namespace TMVA {
29 
30  class Factory; // DSMTEST
31  class Reader; // DSMTEST
32  class DataSetManager; // DSMTEST
33  class Types;
34  class MethodRSVM : public RMethodBase {
35 
36  public :
37 
38  // constructors
39  MethodRSVM(const TString &jobName,
40  const TString &methodTitle,
41  DataSetInfo &theData,
42  const TString &theOption = "",
43  TDirectory *theTargetDir = NULL);
44 
46  const TString &theWeightFile,
47  TDirectory *theTargetDir = NULL);
48 
49 
50  ~MethodRSVM(void);
51  void Train();
52  // options treatment
53  void Init();
54  void DeclareOptions();
55  void ProcessOptions();
56  // create ranking
58  {
59  return NULL; // = 0;
60  }
61 
62 
63  Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets);
64 
65  // performs classifier testing
66  virtual void TestClassification();
67 
68 
69  Double_t GetMvaValue(Double_t *errLower = 0, Double_t *errUpper = 0);
70 
72  // the actual "weights"
73  virtual void AddWeightsXMLTo(void *parent) const {} // = 0;
74  virtual void ReadWeightsFromXML(void *wghtnode) {} // = 0;
75  virtual void ReadWeightsFromStream(std::istream &) {} //= 0; // backward compatibility
76  void ReadStateFromFile();
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  Float_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 
134  ClassDef(MethodRSVM, 0)
135  };
136 } // namespace TMVA
137 #endif
MethodRSVM(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="", TDirectory *theTargetDir=NULL)
Float_t fEpsilon
Definition: MethodRSVM.h:117
std::vector< Float_t > fProbResultForTrainSig
Definition: MethodRSVM.h:83
float Float_t
Definition: RtypesCore.h:53
EAnalysisType
Definition: Types.h:124
virtual void ReadWeightsFromXML(void *wghtnode)
Definition: MethodRSVM.h:74
ROOT::R::TRObject * fModel
Definition: MethodRSVM.h:130
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
ROOT::R::TRFunctionImport asfactor
Definition: MethodRSVM.h:129
ROOT::R::TRFunctionImport svm
Definition: MethodRSVM.h:127
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void ReadWeightsFromStream(std::istream &)
Definition: MethodRSVM.h:75
virtual void AddWeightsXMLTo(void *parent) const
Definition: MethodRSVM.h:73
ROOT::R::TRFunctionImport predict
Definition: MethodRSVM.h:128
Float_t fProbability
Definition: MethodRSVM.h:123
This is a class to get ROOT's objects from R's objects
Definition: TRObject.h:73
std::vector< Float_t > fProbResultForTestSig
Definition: MethodRSVM.h:84
This is a class to pass functions from ROOT to R.
unsigned int UInt_t
Definition: RtypesCore.h:42
Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)
Definition: MethodRSVM.cxx:247
static Bool_t IsModuleLoaded
Definition: MethodRSVM.h:126
UInt_t fMvaCounter
Definition: MethodRSVM.h:82
double Double_t
Definition: RtypesCore.h:55
Describe directory structure in memory.
Definition: TDirectory.h:41
int type
Definition: TGX11.cxx:120
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
Definition: MethodRSVM.cxx:120
void GetHelpMessage() const
Definition: MethodRSVM.cxx:284
Float_t fCacheSize
Definition: MethodRSVM.h:115
Abstract ClassifierFactory template that handles arbitrary types.
virtual void TestClassification()
initialization
Definition: MethodRSVM.cxx:238
#define NULL
Definition: Rtypes.h:82
const Ranking * CreateRanking()
Definition: MethodRSVM.h:57
void ReadStateFromFile()
Definition: MethodRSVM.cxx:269
virtual void ReadWeightsFromStream(std::istream &)=0
DataSetManager * fDataSetManager
Definition: MethodRSVM.h:78
Float_t fTolerance
Definition: MethodRSVM.h:116