Logo ROOT   6.12/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 #include "Rtypes.h"
34 
35 namespace TMVA {
36 
37  class SVEvent;
38  class SVKernelMatrix;
39  class SVKernelFunction;
40  class MsgLogger;
41 
42  class SVWorkingSet {
43 
44  public:
45 
46  SVWorkingSet();
47  SVWorkingSet( std::vector<TMVA::SVEvent*>*, SVKernelFunction*, Float_t , Bool_t);
48  ~SVWorkingSet();
49 
53  void Train(UInt_t nIter=1000);
54  void PrintStat();
55  std::vector<TMVA::SVEvent*>* GetSupportVectors();
56  Float_t GetBpar() {return 0.5*(fB_low + fB_up);}
57 
58  //for regression
62  void TrainReg();
63 
64  //setting up helper variables for JsMVA
65  void SetIPythonInteractive(bool* ExitFromTraining, UInt_t *fIPyCurrentIter_){
66  fExitFromTraining = ExitFromTraining;
67  fIPyCurrentIter = fIPyCurrentIter_;
68  }
69 
70 
71  private:
72 
73  Bool_t fdoRegression; //TODO temporary, find nicer solution
74  std::vector<TMVA::SVEvent*> *fInputData; // input events
75  std::vector<TMVA::SVEvent*> *fSupVec; // output events - support vectors
76  SVKernelFunction *fKFunction; // kernel function
77  SVKernelMatrix *fKMatrix; // kernel matrix
78 
79  SVEvent *fTEventUp; // last optimized event
80  SVEvent *fTEventLow; // last optimized event
81 
82  Float_t fB_low; // documentation
83  Float_t fB_up; // documentation
84  Float_t fTolerance; // documentation
85 
86  mutable MsgLogger* fLogger; //! message logger
87 
88  // variables for JsMVA
89  UInt_t *fIPyCurrentIter = nullptr;
90  bool * fExitFromTraining = nullptr;
91 
92  void SetIndex( TMVA::SVEvent* );
93  };
94 }
95 
96 #endif //ROOT_TMVA_SVWorkingSet
Kernel for Support Vector Machine.
~SVWorkingSet()
destructor
float Float_t
Definition: RtypesCore.h:53
SVWorkingSet()
constructor
std::vector< TMVA::SVEvent * > * fSupVec
Definition: SVWorkingSet.h:75
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
Kernel matrix for Support Vector Machine.
MsgLogger * fLogger
Definition: SVWorkingSet.h:86
SVKernelFunction * fKFunction
Definition: SVWorkingSet.h:76
Bool_t ExamineExampleReg(SVEvent *)
bool * fExitFromTraining
Definition: SVWorkingSet.h:90
unsigned int UInt_t
Definition: RtypesCore.h:42
Event class for Support Vector Machine.
Definition: SVEvent.h:40
Bool_t ExamineExample(SVEvent *)
Bool_t TakeStepReg(SVEvent *, SVEvent *)
std::vector< TMVA::SVEvent * > * GetSupportVectors()
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
Working class for Support Vector Machine.
Definition: SVWorkingSet.h:42
Abstract ClassifierFactory template that handles arbitrary types.
SVKernelMatrix * fKMatrix
Definition: SVWorkingSet.h:77
Bool_t IsDiffSignificant(Float_t, Float_t, Float_t)
std::vector< TMVA::SVEvent * > * fInputData
Definition: SVWorkingSet.h:74
UInt_t * fIPyCurrentIter
message logger
Definition: SVWorkingSet.h:89
SVEvent * fTEventUp
Definition: SVWorkingSet.h:79
void SetIPythonInteractive(bool *ExitFromTraining, UInt_t *fIPyCurrentIter_)
Definition: SVWorkingSet.h:65
SVEvent * fTEventLow
Definition: SVWorkingSet.h:80