Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
VariablePCATransform.h
Go to the documentation of this file.
1// @(#)root/tmva $Id$
2// Author: Andreas Hoecker, Joerg Stelzer, Helge Voss
3
4/**********************************************************************************
5 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6 * Package: TMVA *
7 * Class : VariablePCATransform *
8 * Web : http://tmva.sourceforge.net *
9 * *
10 * Description: *
11 * Principal value composition of input variables *
12 * *
13 * Authors (alphabetical): *
14 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15 * Peter Speckmayer <Peter.Speckmayer@cern.ch> - CERN, Switzerland *
16 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
17 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
18 * *
19 * Copyright (c) 2005: *
20 * CERN, Switzerland *
21 * U. of Victoria, Canada *
22 * MPI-K Heidelberg, Germany *
23 * *
24 * Redistribution and use in source and binary forms, with or without *
25 * modification, are permitted according to the terms listed in LICENSE *
26 * (http://tmva.sourceforge.net/LICENSE) *
27 **********************************************************************************/
28
29#ifndef ROOT_TMVA_VariablePCATransform
30#define ROOT_TMVA_VariablePCATransform
31
32//////////////////////////////////////////////////////////////////////////
33// //
34// VariablePCATransform //
35// //
36// Linear interpolation class //
37// //
38//////////////////////////////////////////////////////////////////////////
39
40#include "TPrincipal.h"
41
43
44#include <vector>
45
46namespace TMVA {
47
49
50 public:
51
53 virtual ~VariablePCATransform( void );
54
55 void Initialize();
56 Bool_t PrepareTransformation (const std::vector<Event*>&);
57
58 virtual const Event* Transform(const Event* const, Int_t cls ) const;
59 virtual const Event* InverseTransform(const Event* const, Int_t cls ) const;
60
61 void WriteTransformationToStream ( std::ostream& ) const;
62 void ReadTransformationFromStream( std::istream&, const TString& );
63
64 virtual void AttachXMLTo(void* parent);
65 virtual void ReadFromXML( void* trfnode );
66
67 // writer of function code
68 virtual void MakeFunction( std::ostream& fout, const TString& fncName, Int_t part, UInt_t trCounter, Int_t cls );
69
70 private:
71
72 void CalculatePrincipalComponents( const std::vector< Event*>& );
73 void X2P( std::vector<Float_t>&, const std::vector<Float_t>&, Int_t cls ) const;
74 void P2X( std::vector<Float_t>&, const std::vector<Float_t>&, Int_t cls ) const;
75
76 // store relevant parts of PCA locally
77 std::vector<TVectorD*> fMeanValues; // mean values
78 std::vector<TMatrixD*> fEigenVectors; // eigenvectors
79
80 ClassDef(VariablePCATransform,0); // Variable transformation: Principal Value Composition
81 };
82
83} // namespace TMVA
84
85#endif
86
#define ClassDef(name, id)
Definition Rtypes.h:325
Class that contains all the data information.
Definition DataSetInfo.h:62
Linear interpolation class.
void CalculatePrincipalComponents(const std::vector< Event * > &)
calculate the principal components for the signal and the background data it uses the MakePrincipal m...
std::vector< TMatrixD * > fEigenVectors
void P2X(std::vector< Float_t > &, const std::vector< Float_t > &, Int_t cls) const
Perform the back-transformation from the principal components pc, and return x It's the users respons...
virtual const Event * Transform(const Event *const, Int_t cls) const
apply the principal component analysis
virtual const Event * InverseTransform(const Event *const, Int_t cls) const
apply the principal component analysis TODO: implementation of inverse transformation Log() << kFATAL...
virtual ~VariablePCATransform(void)
destructor
Bool_t PrepareTransformation(const std::vector< Event * > &)
calculate the principal components using the ROOT class TPrincipal and the normalization
virtual void MakeFunction(std::ostream &fout, const TString &fncName, Int_t part, UInt_t trCounter, Int_t cls)
creates C++ code fragment of the PCA transform for inclusion in standalone C++ class
void Initialize()
initialization of the transformation.
void ReadTransformationFromStream(std::istream &, const TString &)
Read mean values from input stream.
void X2P(std::vector< Float_t > &, const std::vector< Float_t > &, Int_t cls) const
Calculate the principal components from the original data vector x, and return it in p (function extr...
void WriteTransformationToStream(std::ostream &) const
write mean values to stream
virtual void AttachXMLTo(void *parent)
create XML description of PCA transformation
virtual void ReadFromXML(void *trfnode)
Read the transformation matrices from the xml node.
std::vector< TVectorD * > fMeanValues
Linear interpolation class.
Basic string class.
Definition TString.h:136
create variable transformations