Logo ROOT   6.08/07
Reference Guide
SVEvent.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 : SVEvent *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Event 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_SVEvent
29 #define ROOT_TMVA_SVEvent
30 
31 #include <vector>
32 #include <iostream>
33 
34 #ifndef ROOT_Rtypes
35 #include "Rtypes.h"
36 #endif
37 
38 namespace TMVA
39 {
40  class Event;
41 
42  class SVEvent {
43 
44  public:
45 
46  SVEvent();
47  SVEvent( const Event*, Float_t, Bool_t isSignal = kFALSE );
48  SVEvent( const std::vector<Float_t>*, Float_t alpha, Int_t typeFlag, UInt_t ns );
49  SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Float_t alpha_p, Int_t typeFlag);
50 
51  virtual ~SVEvent();
52 
53  void SetAlpha ( Float_t alpha ) { fAlpha = alpha; }
54  void SetAlpha_p ( Float_t alpha ) { fAlpha_p = alpha; }
55  void SetErrorCache ( Float_t err_cache ) { fErrorCache = err_cache; }
56  void SetIsShrinked ( Int_t isshrinked ) { fIsShrinked = isshrinked; }
57  void SetLine ( Float_t* line ) { fLine = line; }
58  void SetIdx ( Int_t idx ) { fIdx = idx; }
59  void SetNs ( UInt_t ns ) { fNs = ns; }
60  void UpdateErrorCache(Float_t upercache ) { fErrorCache += upercache; }
61 
62  std::vector<Float_t>* GetDataVector() { return &fDataVector; }
63  Float_t GetAlpha() const { return fAlpha; }
64  Float_t GetAlpha_p() const { return fAlpha_p; }
65  Float_t GetDeltaAlpha() const { return fAlpha - fAlpha_p; }
66 
67  Float_t GetErrorCache() const { return fErrorCache; }
68  Int_t GetTypeFlag() const { return fTypeFlag; }
69  Int_t GetNVar() const { return fNVar; }
70  Int_t GetIdx() const { return fIdx;}
71  Float_t* GetLine() const { return fLine;}
72  UInt_t GetNs() const { return fNs;}
73  Float_t GetCweight() const { return fCweight;}
74  Float_t GetTarget() const { return fTarget;}
75 
76  Bool_t IsInI0a() const { return (0.< fAlpha) && (fAlpha<fCweight); }
77  Bool_t IsInI0b() const { return (0.< fAlpha) && (fAlpha_p<fCweight); }
78  Bool_t IsInI0() const { return (IsInI0a() || IsInI0b()); }
79  Bool_t IsInI1() const { return (fAlpha == 0. && fAlpha_p == 0.); }
80  Bool_t IsInI2() const { return (fAlpha == 0. && fAlpha_p == fCweight); }
81  Bool_t IsInI3() const { return (fAlpha == fCweight && fAlpha_p == 0.); }
82 
83  void Print( std::ostream& os ) const;
84  void PrintData();
85 
86  private:
87 
88  std::vector<Float_t> fDataVector;
89  const Float_t fCweight; // svm cost weight
90  Float_t fAlpha; // lagrange multiplier
91  Float_t fAlpha_p; // lagrange multiplier
92  Float_t fErrorCache; // optimization parameter
93  UInt_t fNVar; // number of variables
94  const Int_t fTypeFlag; // is sig or bkg - svm requieres 1 for sig and -1 for bkg
95  Int_t fIdx; // index flag
96  UInt_t fNs; // documentation
97  Int_t fIsShrinked; // shrinking flag, see documentation
98  Float_t* fLine; // pointer to column of kerenl matrix
99  const Float_t fTarget; // regression target
100 
101  ClassDef(SVEvent,0); // Event for SVM
102  };
103 }
104 
105 #endif //ROOT_TMVA_SVEvent
virtual ~SVEvent()
destructor
Definition: SVEvent.cxx:114
void SetNs(UInt_t ns)
Definition: SVEvent.h:59
Bool_t IsInI1() const
Definition: SVEvent.h:79
const Int_t fTypeFlag
Definition: SVEvent.h:94
void SetAlpha(Float_t alpha)
Definition: SVEvent.h:53
const Float_t fCweight
Definition: SVEvent.h:89
UInt_t fNs
Definition: SVEvent.h:96
Int_t GetIdx() const
Definition: SVEvent.h:70
TLine * line
float Float_t
Definition: RtypesCore.h:53
Bool_t IsInI0() const
Definition: SVEvent.h:78
Bool_t IsInI0b() const
Definition: SVEvent.h:77
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
void UpdateErrorCache(Float_t upercache)
Definition: SVEvent.h:60
Float_t GetCweight() const
Definition: SVEvent.h:73
void PrintData()
printout
Definition: SVEvent.cxx:135
const Float_t fTarget
Definition: SVEvent.h:99
UInt_t GetNs() const
Definition: SVEvent.h:72
void SetErrorCache(Float_t err_cache)
Definition: SVEvent.h:55
Float_t * fLine
Definition: SVEvent.h:98
Float_t * GetLine() const
Definition: SVEvent.h:71
#define ClassDef(name, id)
Definition: Rtypes.h:254
UInt_t fNVar
Definition: SVEvent.h:93
Bool_t IsInI3() const
Definition: SVEvent.h:81
Float_t GetAlpha_p() const
Definition: SVEvent.h:64
void Print(std::ostream &os) const
printout
Definition: SVEvent.cxx:125
Float_t fAlpha_p
Definition: SVEvent.h:91
Float_t GetErrorCache() const
Definition: SVEvent.h:67
Int_t GetNVar() const
Definition: SVEvent.h:69
Int_t GetTypeFlag() const
Definition: SVEvent.h:68
unsigned int UInt_t
Definition: RtypesCore.h:42
Float_t GetDeltaAlpha() const
Definition: SVEvent.h:65
Bool_t IsInI0a() const
Definition: SVEvent.h:76
Float_t GetAlpha() const
Definition: SVEvent.h:63
Int_t fIdx
Definition: SVEvent.h:95
void SetIdx(Int_t idx)
Definition: SVEvent.h:58
Float_t GetTarget() const
Definition: SVEvent.h:74
Int_t fIsShrinked
Definition: SVEvent.h:97
Abstract ClassifierFactory template that handles arbitrary types.
std::vector< Float_t > fDataVector
Definition: SVEvent.h:88
Bool_t IsInI2() const
Definition: SVEvent.h:80
void SetLine(Float_t *line)
Definition: SVEvent.h:57
void SetAlpha_p(Float_t alpha)
Definition: SVEvent.h:54
void SetIsShrinked(Int_t isshrinked)
Definition: SVEvent.h:56
std::vector< Float_t > * GetDataVector()
Definition: SVEvent.h:62
Float_t fAlpha
Definition: SVEvent.h:90
Float_t fErrorCache
Definition: SVEvent.h:92