Logo ROOT   6.08/07
Reference Guide
SVWorkingSet.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andrzej Zemla
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : SVWorkingSet *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Working class for Support Vector Machine *
12  * *
13  * Authors (alphabetical): *
14  * Marcin Wolter <Marcin.Wolter@cern.ch> - IFJ PAN, Krakow, Poland *
15  * Andrzej Zemla <azemla@cern.ch> - IFJ PAN, Krakow, Poland *
16  * (IFJ PAN: Henryk Niewodniczanski Inst. Nucl. Physics, Krakow, Poland) *
17  * *
18  * Copyright (c) 2005: *
19  * CERN, Switzerland *
20  * MPI-K Heidelberg, Germany *
21  * PAN, Krakow, Poland *
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 #ifndef ROOT_TMVA_SVWorkingSet
29 #define ROOT_TMVA_SVWorkingSet
30 
31 #include <vector>
32 
33 #ifndef ROOT_Rtypes
34 #include "Rtypes.h"
35 #endif
36 
37 namespace TMVA {
38 
39  class SVEvent;
40  class SVKernelMatrix;
41  class SVKernelFunction;
42  class MsgLogger;
43 
44  class SVWorkingSet {
45 
46  public:
47 
48  SVWorkingSet();
49  SVWorkingSet( std::vector<TMVA::SVEvent*>*, SVKernelFunction*, Float_t , Bool_t);
50  ~SVWorkingSet();
51 
55  void Train(UInt_t nIter=1000);
56  void PrintStat();
57  std::vector<TMVA::SVEvent*>* GetSupportVectors();
58  Float_t GetBpar() {return 0.5*(fB_low + fB_up);}
59 
60  //for regression
64  void TrainReg();
65 
66  //setting up helper variables for JsMVA
67  void SetIPythonInteractive(bool* ExitFromTraining, UInt_t *fIPyCurrentIter_){
68  fExitFromTraining = ExitFromTraining;
69  fIPyCurrentIter = fIPyCurrentIter_;
70  }
71 
72 
73  private:
74 
75  Bool_t fdoRegression; //TODO temporary, find nicer solution
76  std::vector<TMVA::SVEvent*> *fInputData; // input events
77  std::vector<TMVA::SVEvent*> *fSupVec; // output events - support vectors
78  SVKernelFunction *fKFunction; // kernel function
79  SVKernelMatrix *fKMatrix; // kernel matrix
80 
81  SVEvent *fTEventUp; // last optimized event
82  SVEvent *fTEventLow; // last optimized event
83 
84  Float_t fB_low; // documentation
85  Float_t fB_up; // documentation
86  Float_t fTolerance; // documentation
87 
88  mutable MsgLogger* fLogger; //! message logger
89 
90  // variables for JsMVA
91  UInt_t *fIPyCurrentIter = nullptr;
92  bool * fExitFromTraining = nullptr;
93 
94  void SetIndex( TMVA::SVEvent* );
95  };
96 }
97 
98 #endif //ROOT_TMVA_SVWorkingSet
~SVWorkingSet()
destructor
float Float_t
Definition: RtypesCore.h:53
SVWorkingSet()
constructor
std::vector< TMVA::SVEvent * > * fSupVec
Definition: SVWorkingSet.h:77
void SetIndex(TMVA::SVEvent *)
void Train(UInt_t nIter=1000)
train the SVM
Bool_t TakeStep(SVEvent *, SVEvent *)
bool Bool_t
Definition: RtypesCore.h:59
MsgLogger * fLogger
Definition: SVWorkingSet.h:88
SVKernelFunction * fKFunction
Definition: SVWorkingSet.h:78
Bool_t ExamineExampleReg(SVEvent *)
bool * fExitFromTraining
Definition: SVWorkingSet.h:92
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t ExamineExample(SVEvent *)
Bool_t TakeStepReg(SVEvent *, SVEvent *)
std::vector< TMVA::SVEvent * > * GetSupportVectors()
Abstract ClassifierFactory template that handles arbitrary types.
SVKernelMatrix * fKMatrix
Definition: SVWorkingSet.h:79
Bool_t IsDiffSignificant(Float_t, Float_t, Float_t)
std::vector< TMVA::SVEvent * > * fInputData
Definition: SVWorkingSet.h:76
UInt_t * fIPyCurrentIter
message logger
Definition: SVWorkingSet.h:91
SVEvent * fTEventUp
Definition: SVWorkingSet.h:81
void SetIPythonInteractive(bool *ExitFromTraining, UInt_t *fIPyCurrentIter_)
Definition: SVWorkingSet.h:67
SVEvent * fTEventLow
Definition: SVWorkingSet.h:82