Logo ROOT   6.14/05
Reference Guide
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 namespace TMVA {
45 
47 
48  public:
49 
51  virtual ~VariablePCATransform( void );
52 
53  void Initialize();
54  Bool_t PrepareTransformation (const std::vector<Event*>&);
55 
56  virtual const Event* Transform(const Event* const, Int_t cls ) const;
57  virtual const Event* InverseTransform(const Event* const, Int_t cls ) const;
58 
59  void WriteTransformationToStream ( std::ostream& ) const;
60  void ReadTransformationFromStream( std::istream&, const TString& );
61 
62  virtual void AttachXMLTo(void* parent);
63  virtual void ReadFromXML( void* trfnode );
64 
65  // writer of function code
66  virtual void MakeFunction( std::ostream& fout, const TString& fncName, Int_t part, UInt_t trCounter, Int_t cls );
67 
68  private:
69 
70  void CalculatePrincipalComponents( const std::vector< Event*>& );
71  void X2P( std::vector<Float_t>&, const std::vector<Float_t>&, Int_t cls ) const;
72  void P2X( std::vector<Float_t>&, const std::vector<Float_t>&, Int_t cls ) const;
73 
74  // store relevant parts of PCA locally
75  std::vector<TVectorD*> fMeanValues; // mean values
76  std::vector<TMatrixD*> fEigenVectors; // eigenvectors
77 
78  ClassDef(VariablePCATransform,0); // Variable transformation: Principal Value Composition
79  };
80 
81 } // namespace TMVA
82 
83 #endif
84 
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&#39;s the users respons...
void ReadTransformationFromStream(std::istream &, const TString &)
Read mean values from input stream.
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void WriteTransformationToStream(std::ostream &) const
write mean values to stream
virtual void AttachXMLTo(void *parent)
create XML description of PCA transformation
#define ClassDef(name, id)
Definition: Rtypes.h:320
Class that contains all the data information.
Definition: DataSetInfo.h:60
void CalculatePrincipalComponents(const std::vector< Event *> &)
calculate the principal components for the signal and the background data it uses the MakePrincipal m...
Linear interpolation class.
Bool_t PrepareTransformation(const std::vector< Event *> &)
calculate the principal components using the ROOT class TPrincipal and the normalization ...
unsigned int UInt_t
Definition: RtypesCore.h:42
Linear interpolation class.
virtual void ReadFromXML(void *trfnode)
Read the transformation matrices from the xml node.
virtual const Event * Transform(const Event *const, Int_t cls) const
apply the principal component analysis
void Initialize()
initialization of the transformation.
Abstract ClassifierFactory template that handles arbitrary types.
std::vector< TMatrixD * > fEigenVectors
VariablePCATransform(DataSetInfo &dsi)
constructor
virtual ~VariablePCATransform(void)
destructor
std::vector< TVectorD * > fMeanValues
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...
virtual const Event * InverseTransform(const Event *const, Int_t cls) const
apply the principal component analysis TODO: implementation of inverse transformation Log() << kFATAL...
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 ...