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 * 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
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
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
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
81TMVA::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
100TMVA::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
130void 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}
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
float Float_t
Definition RtypesCore.h:57
#define ClassImp(name)
Definition Rtypes.h:377
Event class for Support Vector Machine.
Definition SVEvent.h:40
void PrintData()
printout
Definition SVEvent.cxx:140
virtual ~SVEvent()
destructor
Definition SVEvent.cxx:119
void Print(std::ostream &os) const
printout
Definition SVEvent.cxx:130