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 * *
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 * (see tmva/doc/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() override;
56 Bool_t PrepareTransformation (const std::vector<Event*>&) override;
57
58 const Event* Transform(const Event* const, Int_t cls ) const override;
59 const Event* InverseTransform(const Event* const, Int_t cls ) const override;
60
61 void WriteTransformationToStream ( std::ostream& ) const override;
62 void ReadTransformationFromStream( std::istream&, const TString& ) override;
63
64 void AttachXMLTo(void* parent) override;
65 void ReadFromXML( void* trfnode ) override;
66
67 // writer of function code
68 void MakeFunction( std::ostream& fout, const TString& fncName, Int_t part, UInt_t trCounter, Int_t cls ) override;
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 ClassDefOverride(VariablePCATransform,0); // Variable transformation: Principal Value Composition
81 };
82
83} // namespace TMVA
84
85#endif
86
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Class that contains all the data information.
Definition DataSetInfo.h:62
Linear interpolation class.
void MakeFunction(std::ostream &fout, const TString &fncName, Int_t part, UInt_t trCounter, Int_t cls) override
creates C++ code fragment of the PCA transform for inclusion in standalone C++ 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
eigenvectors
void WriteTransformationToStream(std::ostream &) const override
write mean values to stream
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...
Bool_t PrepareTransformation(const std::vector< Event * > &) override
calculate the principal components using the ROOT class TPrincipal and the normalization
virtual ~VariablePCATransform(void)
destructor
const Event * InverseTransform(const Event *const, Int_t cls) const override
apply the principal component analysis TODO: implementation of inverse transformation Log() << kFATAL...
void Initialize() override
initialization of the transformation.
const Event * Transform(const Event *const, Int_t cls) const override
apply the principal component analysis
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 ReadTransformationFromStream(std::istream &, const TString &) override
Read mean values from input stream.
VariablePCATransform(DataSetInfo &dsi)
constructor
std::vector< TVectorD * > fMeanValues
mean values
void ReadFromXML(void *trfnode) override
Read the transformation matrices from the xml node.
void AttachXMLTo(void *parent) override
create XML description of PCA transformation
Linear interpolation class.
Basic string class.
Definition TString.h:139
create variable transformations