ROOT logo
// @(#)root/tmva $Id: VariablePCATransform.h 31458 2009-11-30 13:58:20Z stelzer $
// Author: Andreas Hoecker, Joerg Stelzer, Helge Voss

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Class  : VariablePCATransform                                                  *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *      Principal value composition of input variables                            *
 *                                                                                *
 * Authors (alphabetical):                                                        *
 *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
 *      Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN, Switzerland              *
 *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
 *                                                                                *
 * Copyright (c) 2005:                                                            *
 *      CERN, Switzerland                                                         *
 *      U. of Victoria, Canada                                                    *
 *      MPI-K Heidelberg, Germany                                                 *
 *                                                                                *
 * Redistribution and use in source and binary forms, with or without             *
 * modification, are permitted according to the terms listed in LICENSE           *
 * (http://tmva.sourceforge.net/LICENSE)                                          *
 **********************************************************************************/

#ifndef ROOT_TMVA_VariablePCATransform
#define ROOT_TMVA_VariablePCATransform

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// VariablePCATransform                                                 //
//                                                                      //
// Linear interpolation class                                           //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TPrincipal
#include "TPrincipal.h"
#endif

#ifndef ROOT_TMVA_VariableTransformBase
#include "TMVA/VariableTransformBase.h"
#endif

namespace TMVA {

   class VariablePCATransform : public VariableTransformBase {

   public:
  
      VariablePCATransform( DataSetInfo& dsi );
      virtual ~VariablePCATransform( void );

      void   Initialize();
      Bool_t PrepareTransformation( const std::vector<Event*>& );

      virtual const Event* Transform(const Event* const, Int_t cls ) const;
      virtual const Event* InverseTransform(const Event* const, Int_t cls ) const;

      void WriteTransformationToStream ( std::ostream& ) const;
      void ReadTransformationFromStream( std::istream&, const TString& );

      virtual void AttachXMLTo(void* parent);
      virtual void ReadFromXML( void* trfnode );

      // writer of function code
      virtual void MakeFunction( std::ostream& fout, const TString& fncName, Int_t part, UInt_t trCounter, Int_t cls );

   private:

      void CalculatePrincipalComponents( const std::vector<Event*>& );
      std::vector<Float_t> X2P( const std::vector<Float_t>&, Int_t cls ) const;

      //      mutable Event*     fTransformedEvent;

      // store relevant parts of PCA locally
      std::vector<TVectorD*> fMeanValues;   // mean values
      std::vector<TMatrixD*> fEigenVectors; // eigenvectors

      ClassDef(VariablePCATransform,0) // Variable transformation: Principal Value Composition
   };

} // namespace TMVA

#endif 

 VariablePCATransform.h:1
 VariablePCATransform.h:2
 VariablePCATransform.h:3
 VariablePCATransform.h:4
 VariablePCATransform.h:5
 VariablePCATransform.h:6
 VariablePCATransform.h:7
 VariablePCATransform.h:8
 VariablePCATransform.h:9
 VariablePCATransform.h:10
 VariablePCATransform.h:11
 VariablePCATransform.h:12
 VariablePCATransform.h:13
 VariablePCATransform.h:14
 VariablePCATransform.h:15
 VariablePCATransform.h:16
 VariablePCATransform.h:17
 VariablePCATransform.h:18
 VariablePCATransform.h:19
 VariablePCATransform.h:20
 VariablePCATransform.h:21
 VariablePCATransform.h:22
 VariablePCATransform.h:23
 VariablePCATransform.h:24
 VariablePCATransform.h:25
 VariablePCATransform.h:26
 VariablePCATransform.h:27
 VariablePCATransform.h:28
 VariablePCATransform.h:29
 VariablePCATransform.h:30
 VariablePCATransform.h:31
 VariablePCATransform.h:32
 VariablePCATransform.h:33
 VariablePCATransform.h:34
 VariablePCATransform.h:35
 VariablePCATransform.h:36
 VariablePCATransform.h:37
 VariablePCATransform.h:38
 VariablePCATransform.h:39
 VariablePCATransform.h:40
 VariablePCATransform.h:41
 VariablePCATransform.h:42
 VariablePCATransform.h:43
 VariablePCATransform.h:44
 VariablePCATransform.h:45
 VariablePCATransform.h:46
 VariablePCATransform.h:47
 VariablePCATransform.h:48
 VariablePCATransform.h:49
 VariablePCATransform.h:50
 VariablePCATransform.h:51
 VariablePCATransform.h:52
 VariablePCATransform.h:53
 VariablePCATransform.h:54
 VariablePCATransform.h:55
 VariablePCATransform.h:56
 VariablePCATransform.h:57
 VariablePCATransform.h:58
 VariablePCATransform.h:59
 VariablePCATransform.h:60
 VariablePCATransform.h:61
 VariablePCATransform.h:62
 VariablePCATransform.h:63
 VariablePCATransform.h:64
 VariablePCATransform.h:65
 VariablePCATransform.h:66
 VariablePCATransform.h:67
 VariablePCATransform.h:68
 VariablePCATransform.h:69
 VariablePCATransform.h:70
 VariablePCATransform.h:71
 VariablePCATransform.h:72
 VariablePCATransform.h:73
 VariablePCATransform.h:74
 VariablePCATransform.h:75
 VariablePCATransform.h:76
 VariablePCATransform.h:77
 VariablePCATransform.h:78
 VariablePCATransform.h:79
 VariablePCATransform.h:80
 VariablePCATransform.h:81
 VariablePCATransform.h:82
 VariablePCATransform.h:83
 VariablePCATransform.h:84
 VariablePCATransform.h:85
 VariablePCATransform.h:86
 VariablePCATransform.h:87
 VariablePCATransform.h:88