Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 * *
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 * (see tmva/doc/LICENSE) *
26 **********************************************************************************/
27
28/*! \class TMVA::SVEvent
29\ingroup TMVA
30Event 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
41
43: fDataVector(0),
44 fCweight(1.),
45 fAlpha(0),
46 fAlpha_p(0),
47 fErrorCache(0),
48 fNVar(0),
49 fTypeFlag(0),
50 fIdx(0),
51 fNs(0),
52 fIsShrinked(0),
53 fLine(0),
54 fTarget(0)
55{
56}
57
58////////////////////////////////////////////////////////////////////////////////
59/// constructor
60
62 : fDataVector(event->GetValues()),
63 fCweight(C_par*event->GetWeight()),
64 fAlpha(0),
65 fAlpha_p(0),
66 fErrorCache(0),
67 fNVar ( event->GetNVariables() ),
68 fTypeFlag( isSignal ? -1 : 1 ),
69 fIdx ( isSignal ? -1 : 1 ),
70 fNs(0),
71 fIsShrinked(0),
72 fLine(0),
73 fTarget((event->GetNTargets() > 0 ? event->GetTarget(0) : 0))
74{
75}
76
77////////////////////////////////////////////////////////////////////////////////
78/// constructor
79
80TMVA::SVEvent::SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Int_t typeFlag, UInt_t ns )
81 : fDataVector(*svector),
82 fCweight(-1.),
83 fAlpha(alpha),
84 fAlpha_p(0),
85 fErrorCache(-1.),
86 fNVar(svector->size()),
87 fTypeFlag(typeFlag),
88 fIdx(-1),
89 fNs(ns),
90 fIsShrinked(0),
91 fLine(0),
92 fTarget(0)
93{
94}
95
96////////////////////////////////////////////////////////////////////////////////
97/// constructor
98
99TMVA::SVEvent::SVEvent( const std::vector<Float_t>* svector, Float_t alpha, Float_t alpha_p,Int_t typeFlag)
100 : fDataVector(*svector),
101 fCweight(-1.),
102 fAlpha(alpha),
103 fAlpha_p(alpha_p),
104 fErrorCache(-1.),
105 fNVar(svector->size()),
106 fTypeFlag(typeFlag),
107 fIdx(-1),
108 fNs(0),
109 fIsShrinked(0),
110 fLine(0),
111 fTarget(0)
112{
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// destructor
117
119{
120 if (fLine != 0) {
121 delete [] fLine;
122 fLine = 0;
123 }
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// printout
128
129void TMVA::SVEvent::Print( std::ostream& os ) const
130{
131 os << "type::" << fTypeFlag <<" target::"<< fTarget << " alpha::" << fAlpha <<" alpha_p::"<< fAlpha_p<< " values::" ;
132 for (UInt_t j =0; j < fDataVector.size();j++) os<<fDataVector.at(j)<<" ";
133 os << std::endl;
134}
135
136////////////////////////////////////////////////////////////////////////////////
137/// printout
138
140{
141 for (UInt_t i = 0; i < fNVar; i++) std::cout<<fDataVector.at(i)<<" ";
142 std::cout<<std::endl;
143}
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
void PrintData()
printout
Definition SVEvent.cxx:139
virtual ~SVEvent()
destructor
Definition SVEvent.cxx:118
void Print(std::ostream &os) const
printout
Definition SVEvent.cxx:129