Logo ROOT  
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#include "Rtypes.h"
35
36namespace TMVA
37{
38 class Event;
39
40 class SVEvent {
41
42 public:
43
44 SVEvent();
45 SVEvent( const Event*, Float_t, Bool_t isSignal = kFALSE );
46 SVEvent( const std::vector<Float_t>*, Float_t alpha, Int_t typeFlag, UInt_t ns );
47 SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Float_t alpha_p, Int_t typeFlag);
48
49 virtual ~SVEvent();
50
51 void SetAlpha ( Float_t alpha ) { fAlpha = alpha; }
52 void SetAlpha_p ( Float_t alpha ) { fAlpha_p = alpha; }
53 void SetErrorCache ( Float_t err_cache ) { fErrorCache = err_cache; }
54 void SetIsShrinked ( Int_t isshrinked ) { fIsShrinked = isshrinked; }
55 void SetLine ( Float_t* line ) { fLine = line; }
56 void SetIdx ( Int_t idx ) { fIdx = idx; }
57 void SetNs ( UInt_t ns ) { fNs = ns; }
58 void UpdateErrorCache(Float_t upercache ) { fErrorCache += upercache; }
59
60 std::vector<Float_t>* GetDataVector() { return &fDataVector; }
61 Float_t GetAlpha() const { return fAlpha; }
62 Float_t GetAlpha_p() const { return fAlpha_p; }
63 Float_t GetDeltaAlpha() const { return fAlpha - fAlpha_p; }
64
65 Float_t GetErrorCache() const { return fErrorCache; }
66 Int_t GetTypeFlag() const { return fTypeFlag; }
67 Int_t GetNVar() const { return fNVar; }
68 Int_t GetIdx() const { return fIdx;}
69 Float_t* GetLine() const { return fLine;}
70 UInt_t GetNs() const { return fNs;}
71 Float_t GetCweight() const { return fCweight;}
72 Float_t GetTarget() const { return fTarget;}
73
74 Bool_t IsInI0a() const { return (0.< fAlpha) && (fAlpha<fCweight); }
75 Bool_t IsInI0b() const { return (0.< fAlpha) && (fAlpha_p<fCweight); }
76 Bool_t IsInI0() const { return (IsInI0a() || IsInI0b()); }
77 Bool_t IsInI1() const { return (fAlpha == 0. && fAlpha_p == 0.); }
78 Bool_t IsInI2() const { return (fAlpha == 0. && fAlpha_p == fCweight); }
79 Bool_t IsInI3() const { return (fAlpha == fCweight && fAlpha_p == 0.); }
80
81 void Print( std::ostream& os ) const;
82 void PrintData();
83
84 private:
85
86 std::vector<Float_t> fDataVector;
87 const Float_t fCweight; ///< svm cost weight
88 Float_t fAlpha; ///< Lagrange multiplier
89 Float_t fAlpha_p; ///< Lagrange multiplier
90 Float_t fErrorCache; ///< optimization parameter
91 UInt_t fNVar; ///< number of variables
92 const Int_t fTypeFlag; ///< is sig or bkg - svm requieres 1 for sig and -1 for bkg
93 Int_t fIdx; ///< index flag
94 UInt_t fNs; ///< documentation
95 Int_t fIsShrinked; ///< shrinking flag, see documentation
96 Float_t* fLine; ///< pointer to column of kernel matrix
97 const Float_t fTarget; ///< regression target
98
99 ClassDef(SVEvent,0); // Event for SVM
100 };
101}
102
103#endif //ROOT_TMVA_SVEvent
const Bool_t kFALSE
Definition: RtypesCore.h:101
float Float_t
Definition: RtypesCore.h:57
#define ClassDef(name, id)
Definition: Rtypes.h:335
Event class for Support Vector Machine.
Definition: SVEvent.h:40
Bool_t IsInI0a() const
Definition: SVEvent.h:74
void PrintData()
printout
Definition: SVEvent.cxx:140
void UpdateErrorCache(Float_t upercache)
Definition: SVEvent.h:58
Int_t fIsShrinked
shrinking flag, see documentation
Definition: SVEvent.h:95
void SetIsShrinked(Int_t isshrinked)
Definition: SVEvent.h:54
void SetIdx(Int_t idx)
Definition: SVEvent.h:56
std::vector< Float_t > * GetDataVector()
Definition: SVEvent.h:60
const Float_t fCweight
svm cost weight
Definition: SVEvent.h:87
void SetLine(Float_t *line)
Definition: SVEvent.h:55
Float_t GetTarget() const
Definition: SVEvent.h:72
virtual ~SVEvent()
destructor
Definition: SVEvent.cxx:119
Float_t fAlpha
Lagrange multiplier.
Definition: SVEvent.h:88
Int_t GetIdx() const
Definition: SVEvent.h:68
UInt_t fNs
documentation
Definition: SVEvent.h:94
Bool_t IsInI2() const
Definition: SVEvent.h:78
const Float_t fTarget
regression target
Definition: SVEvent.h:97
Float_t fErrorCache
optimization parameter
Definition: SVEvent.h:90
Float_t GetErrorCache() const
Definition: SVEvent.h:65
Float_t GetCweight() const
Definition: SVEvent.h:71
Float_t * GetLine() const
Definition: SVEvent.h:69
void SetAlpha_p(Float_t alpha)
Definition: SVEvent.h:52
void Print(std::ostream &os) const
printout
Definition: SVEvent.cxx:130
UInt_t fNVar
number of variables
Definition: SVEvent.h:91
Bool_t IsInI3() const
Definition: SVEvent.h:79
Int_t fIdx
index flag
Definition: SVEvent.h:93
Float_t fAlpha_p
Lagrange multiplier.
Definition: SVEvent.h:89
Float_t GetAlpha() const
Definition: SVEvent.h:61
Bool_t IsInI0() const
Definition: SVEvent.h:76
UInt_t GetNs() const
Definition: SVEvent.h:70
std::vector< Float_t > fDataVector
Definition: SVEvent.h:86
Bool_t IsInI0b() const
Definition: SVEvent.h:75
Float_t GetAlpha_p() const
Definition: SVEvent.h:62
void SetAlpha(Float_t alpha)
Definition: SVEvent.h:51
Bool_t IsInI1() const
Definition: SVEvent.h:77
Int_t GetNVar() const
Definition: SVEvent.h:67
const Int_t fTypeFlag
is sig or bkg - svm requieres 1 for sig and -1 for bkg
Definition: SVEvent.h:92
Int_t GetTypeFlag() const
Definition: SVEvent.h:66
void SetErrorCache(Float_t err_cache)
Definition: SVEvent.h:53
Float_t GetDeltaAlpha() const
Definition: SVEvent.h:63
void SetNs(UInt_t ns)
Definition: SVEvent.h:57
Float_t * fLine
pointer to column of kernel matrix
Definition: SVEvent.h:96
TLine * line
static constexpr double ns
create variable transformations