Logo ROOT   6.10/09
Reference Guide
SVEvent.cxx
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  * Implementation *
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 /*! \class TMVA::SVEvent
29 \ingroup TMVA
30 Event class for Support Vector Machine
31 */
32 
33 #include "TMVA/SVEvent.h"
34 
35 #include "TMVA/Event.h"
36 
37 #include "Rtypes.h"
38 
39 #include <iostream>
40 
42 
44 : fDataVector(0),
45  fCweight(1.),
46  fAlpha(0),
47  fAlpha_p(0),
48  fErrorCache(0),
49  fNVar(0),
50  fTypeFlag(0),
51  fIdx(0),
52  fNs(0),
53  fIsShrinked(0),
54  fLine(0),
55  fTarget(0)
56 {
57 }
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// constructor
61 
62 TMVA::SVEvent::SVEvent( const Event* event, Float_t C_par, Bool_t isSignal )
63  : fDataVector(event->GetValues()),
64  fCweight(C_par*event->GetWeight()),
65  fAlpha(0),
66  fAlpha_p(0),
67  fErrorCache(0),
68  fNVar ( event->GetNVariables() ),
69  fTypeFlag( isSignal ? -1 : 1 ),
70  fIdx ( isSignal ? -1 : 1 ),
71  fNs(0),
72  fIsShrinked(0),
73  fLine(0),
74  fTarget((event->GetNTargets() > 0 ? event->GetTarget(0) : 0))
75 {
76 }
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// constructor
80 
81 TMVA::SVEvent::SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Int_t typeFlag, UInt_t ns )
82  : fDataVector(*svector),
83  fCweight(-1.),
84  fAlpha(alpha),
85  fAlpha_p(0),
86  fErrorCache(-1.),
87  fNVar(svector->size()),
88  fTypeFlag(typeFlag),
89  fIdx(-1),
90  fNs(ns),
91  fIsShrinked(0),
92  fLine(0),
93  fTarget(0)
94 {
95 }
96 
97 ////////////////////////////////////////////////////////////////////////////////
98 /// constructor
99 
100 TMVA::SVEvent::SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Float_t alpha_p,Int_t typeFlag)
101  : fDataVector(*svector),
102  fCweight(-1.),
103  fAlpha(alpha),
104  fAlpha_p(alpha_p),
105  fErrorCache(-1.),
106  fNVar(svector->size()),
107  fTypeFlag(typeFlag),
108  fIdx(-1),
109  fNs(0),
110  fIsShrinked(0),
111  fLine(0),
112  fTarget(0)
113 {
114 }
115 
116 ////////////////////////////////////////////////////////////////////////////////
117 /// destructor
118 
120 {
121  if (fLine != 0) {
122  delete fLine;
123  fLine = 0;
124  }
125 }
126 
127 ////////////////////////////////////////////////////////////////////////////////
128 /// printout
129 
130 void TMVA::SVEvent::Print( std::ostream& os ) const
131 {
132  os << "type::" << fTypeFlag <<" target::"<< fTarget << " alpha::" << fAlpha <<" alpha_p::"<< fAlpha_p<< " values::" ;
133  for (UInt_t j =0; j < fDataVector.size();j++) os<<fDataVector.at(j)<<" ";
134  os << std::endl;
135 }
136 
137 ////////////////////////////////////////////////////////////////////////////////
138 /// printout
139 
141 {
142  for (UInt_t i = 0; i < fNVar; i++) std::cout<<fDataVector.at(i)<<" ";
143  std::cout<<std::endl;
144 }
virtual ~SVEvent()
destructor
Definition: SVEvent.cxx:119
const Int_t fTypeFlag
Definition: SVEvent.h:92
const Float_t fCweight
Definition: SVEvent.h:87
UInt_t fNs
Definition: SVEvent.h:94
float Float_t
Definition: RtypesCore.h:53
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void PrintData()
printout
Definition: SVEvent.cxx:140
const Float_t fTarget
Definition: SVEvent.h:97
Float_t * fLine
Definition: SVEvent.h:96
UInt_t fNVar
Definition: SVEvent.h:91
void Print(std::ostream &os) const
printout
Definition: SVEvent.cxx:130
Float_t fAlpha_p
Definition: SVEvent.h:89
unsigned int UInt_t
Definition: RtypesCore.h:42
Event class for Support Vector Machine.
Definition: SVEvent.h:40
Int_t fIdx
Definition: SVEvent.h:93
#define ClassImp(name)
Definition: Rtypes.h:336
Int_t fIsShrinked
Definition: SVEvent.h:95
Abstract ClassifierFactory template that handles arbitrary types.
std::vector< Float_t > fDataVector
Definition: SVEvent.h:86
Float_t fAlpha
Definition: SVEvent.h:88
Float_t fErrorCache
Definition: SVEvent.h:90