CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
GaussianSumUtilities< N > Class Template Reference

#include <GaussianSumUtilities.h>

Public Types

typedef ROOT::Math::SMatrix
< double, N, N,
ROOT::Math::MatRepStd< double,
N > > 
GenMatrix
 
typedef SingleState::Matrix Matrix
 
typedef MultiGaussianState< NMultiState
 
typedef SingleGaussianState< NSingleState
 
typedef
MultiState::SingleStateContainer 
SingleStateContainer
 
typedef MultiState::SingleStatePtr SingleStatePtr
 
typedef SingleState::Vector Vector
 

Public Member Functions

const SingleStateContainercomponents () const
 components More...
 
const Matrixcovariance (unsigned int i) const
 covariance matrix of a component More...
 
const Matrixcovariance () const
 combined covariance More...
 
Vector d1LnPdf (const Vector &) const
 gradient of ln(pdf) More...
 
Vector d1Pdf (const Vector &) const
 gradient More...
 
Matrix d2LnPdf (const Vector &) const
 Hessian of ln(pdf) More...
 
Matrix d2Pdf (const Vector &) const
 Hessian. More...
 
 GaussianSumUtilities (const MultiState &state)
 
double lnPdf (const Vector &) const
 value of ln(pdf) More...
 
const Vectormean (unsigned int i) const
 mean value of a component More...
 
const Vectormean () const
 combined mean More...
 
const SingleGaussianState< N > & mode () const
 
bool modeIsValid () const
 mode status More...
 
double pdf (const Vector &) const
 value of the p.d.f. More...
 
unsigned int size () const
 number of components More...
 
const MultiStatestate () const
 multi-state More...
 
double weight (unsigned int i) const
 weight of a component More...
 
double weight () const
 combined weight More...
 
 ~GaussianSumUtilities ()
 

Protected Member Functions

Vector computeModeWithoutTransform () const
 calculation of mode More...
 

Private Types

enum  ModeStatus { Valid, NotValid, NotComputed }
 

Private Member Functions

void computeMode () const
 calculation of mode with transformation of pdf More...
 
MultiGaussianState1D constrainedState (const Vector &d, const Vector &x0) const
 state constrained to a line x = s*d+x0 More...
 
Vector d1LnPdf (const Vector &, const std::vector< double > &) const
 gradient of ln(pdf) using the pdf components at the evaluation point More...
 
Vector d1Pdf (const Vector &, const std::vector< double > &) const
 gradient using the pdf components at the evaluation point More...
 
Matrix d2LnPdf (const Vector &, const std::vector< double > &) const
 Hessian of ln(pdf) using the pdf components at the evaluation point. More...
 
Matrix d2Pdf (const Vector &, const std::vector< double > &) const
 Hessian using the pdf components at the evaluation point. More...
 
bool findMode (Vector &mode, double &pdfAtMode, const Vector &xStart) const
 mode from starting value in ln(pdf); returns true on success More...
 
double gauss (const double &, const double &, const double &) const
 value of gaussian distribution More...
 
double gauss (const Vector &, const Vector &, const Matrix &) const
 value of multidimensional gaussian distribution More...
 
double lnPdf (const Vector &, const std::vector< double > &) const
 value of ln(pdf) using the pdf components at the evaluation point More...
 
Matrix localCovariance (const Vector &x) const
 
double pdf (const Vector &, const std::vector< double > &) const
 value of the p.d.f. using the pdf components at the evaluation point More...
 
std::vector< double > pdfComponents (const Vector &) const
 pdf components More...
 
void setInvalidMode () const
 set mode "state" in case of failure More...
 
void setMode (const Vector &mode) const
 set mode "state" from solution of mode finding More...
 
Matrix tensorProduct (const Vector &) const
 Symmetric Tensor Product (not recognized by standard ROOT Math) More...
 

Private Attributes

SingleGaussianState< NtheMode
 
ModeStatus theModeStatus
 
const MultiStatetheState
 

Detailed Description

template<unsigned int N>
class GaussianSumUtilities< N >

Utility class for the analysis of multi-dimensional Gaussian mixtures. The input state is assumed to exist for the lifetime of this object.

Definition at line 15 of file GaussianSumUtilities.h.

Member Typedef Documentation

template<unsigned int N>
typedef ROOT::Math::SMatrix<double,N,N,ROOT::Math::MatRepStd<double,N> > GaussianSumUtilities< N >::GenMatrix

Definition at line 20 of file GaussianSumUtilities.h.

template<unsigned int N>
typedef SingleState::Matrix GaussianSumUtilities< N >::Matrix

Definition at line 23 of file GaussianSumUtilities.h.

template<unsigned int N>
typedef MultiGaussianState<N> GaussianSumUtilities< N >::MultiState

Definition at line 18 of file GaussianSumUtilities.h.

template<unsigned int N>
typedef SingleGaussianState<N> GaussianSumUtilities< N >::SingleState

Definition at line 17 of file GaussianSumUtilities.h.

Definition at line 25 of file GaussianSumUtilities.h.

template<unsigned int N>
typedef MultiState::SingleStatePtr GaussianSumUtilities< N >::SingleStatePtr

Definition at line 24 of file GaussianSumUtilities.h.

template<unsigned int N>
typedef SingleState::Vector GaussianSumUtilities< N >::Vector

Definition at line 22 of file GaussianSumUtilities.h.

Member Enumeration Documentation

template<unsigned int N>
enum GaussianSumUtilities::ModeStatus
private

Constructor & Destructor Documentation

template<unsigned int N>
GaussianSumUtilities< N >::GaussianSumUtilities ( const MultiState state)
inline

Definition at line 31 of file GaussianSumUtilities.h.

31  :
32  theState(state),
34  }
const MultiState & state() const
multi-state
const MultiState & theState
template<unsigned int N>
GaussianSumUtilities< N >::~GaussianSumUtilities ( )
inline

Definition at line 35 of file GaussianSumUtilities.h.

35  {
36  }

Member Function Documentation

template<unsigned int N>
const SingleStateContainer& GaussianSumUtilities< N >::components ( ) const
inline

components

Definition at line 43 of file GaussianSumUtilities.h.

References MultiGaussianState< N >::components(), and GaussianSumUtilities< N >::theState.

Referenced by GaussianSumUtilities< N >::covariance(), GaussianSumUtilities< N >::mean(), GaussianSumUtilities< N >::size(), and GaussianSumUtilities< N >::weight().

43  {
44  return theState.components();
45  }
const SingleStateContainer & components() const
access to components (single Gaussian states)
const MultiState & theState
template<unsigned int N>
void GaussianSumUtilities< N >::computeMode ( ) const
private

calculation of mode with transformation of pdf

template<unsigned int N>
Vector GaussianSumUtilities< N >::computeModeWithoutTransform ( ) const
protected

calculation of mode

template<unsigned int N>
MultiGaussianState1D GaussianSumUtilities< N >::constrainedState ( const Vector d,
const Vector x0 
) const
private

state constrained to a line x = s*d+x0

template<unsigned int N>
const Matrix& GaussianSumUtilities< N >::covariance ( unsigned int  i) const
inline

covariance matrix of a component

Definition at line 59 of file GaussianSumUtilities.h.

References GaussianSumUtilities< N >::components(), and i.

59  {
60  return components()[i]->covariance();
61  }
int i
Definition: DBlmapReader.cc:9
const SingleStateContainer & components() const
components
template<unsigned int N>
const Matrix& GaussianSumUtilities< N >::covariance ( void  ) const
inline

combined covariance

Definition at line 89 of file GaussianSumUtilities.h.

References MultiGaussianState< N >::covariance(), and GaussianSumUtilities< N >::theState.

89  {
90  return theState.covariance();
91  }
const Matrix & covariance() const
combined covariance matrix
const MultiState & theState
template<unsigned int N>
Vector GaussianSumUtilities< N >::d1LnPdf ( const Vector ) const

gradient of ln(pdf)

template<unsigned int N>
Vector GaussianSumUtilities< N >::d1LnPdf ( const Vector ,
const std::vector< double > &   
) const
private

gradient of ln(pdf) using the pdf components at the evaluation point

template<unsigned int N>
Vector GaussianSumUtilities< N >::d1Pdf ( const Vector ) const

gradient

template<unsigned int N>
Vector GaussianSumUtilities< N >::d1Pdf ( const Vector ,
const std::vector< double > &   
) const
private

gradient using the pdf components at the evaluation point

template<unsigned int N>
Matrix GaussianSumUtilities< N >::d2LnPdf ( const Vector ) const

Hessian of ln(pdf)

template<unsigned int N>
Matrix GaussianSumUtilities< N >::d2LnPdf ( const Vector ,
const std::vector< double > &   
) const
private

Hessian of ln(pdf) using the pdf components at the evaluation point.

template<unsigned int N>
Matrix GaussianSumUtilities< N >::d2Pdf ( const Vector ) const

Hessian.

template<unsigned int N>
Matrix GaussianSumUtilities< N >::d2Pdf ( const Vector ,
const std::vector< double > &   
) const
private

Hessian using the pdf components at the evaluation point.

template<unsigned int N>
bool GaussianSumUtilities< N >::findMode ( Vector mode,
double &  pdfAtMode,
const Vector xStart 
) const
private

mode from starting value in ln(pdf); returns true on success

template<unsigned int N>
double GaussianSumUtilities< N >::gauss ( const double &  ,
const double &  ,
const double &   
) const
private

value of gaussian distribution

template<unsigned int N>
double GaussianSumUtilities< N >::gauss ( const Vector ,
const Vector ,
const Matrix  
) const
private

value of multidimensional gaussian distribution

template<unsigned int N>
double GaussianSumUtilities< N >::lnPdf ( const Vector ) const

value of ln(pdf)

template<unsigned int N>
double GaussianSumUtilities< N >::lnPdf ( const Vector ,
const std::vector< double > &   
) const
private

value of ln(pdf) using the pdf components at the evaluation point

template<unsigned int N>
Matrix GaussianSumUtilities< N >::localCovariance ( const Vector x) const
private

Local variance from Hessian matrix. Only valid if x corresponds to a (local) maximum!

template<unsigned int N>
const Vector& GaussianSumUtilities< N >::mean ( unsigned int  i) const
inline

mean value of a component

Definition at line 55 of file GaussianSumUtilities.h.

References GaussianSumUtilities< N >::components(), and i.

55  {
56  return components()[i]->mean();
57  }
int i
Definition: DBlmapReader.cc:9
const SingleStateContainer & components() const
components
template<unsigned int N>
const Vector& GaussianSumUtilities< N >::mean ( ) const
inline

combined mean

Definition at line 85 of file GaussianSumUtilities.h.

References MultiGaussianState< N >::mean(), and GaussianSumUtilities< N >::theState.

85  {
86  return theState.mean();
87  }
const Vector & mean() const
combined mean
const MultiState & theState
template<unsigned int N>
const SingleGaussianState<N>& GaussianSumUtilities< N >::mode ( ) const

Mode "state": mean = mode, covariance = local covariance at mode, weight chosen to have pdf(mode) equal to the one of the mixture

template<unsigned int N>
bool GaussianSumUtilities< N >::modeIsValid ( ) const

mode status

template<unsigned int N>
double GaussianSumUtilities< N >::pdf ( const Vector ) const

value of the p.d.f.

template<unsigned int N>
double GaussianSumUtilities< N >::pdf ( const Vector ,
const std::vector< double > &   
) const
private

value of the p.d.f. using the pdf components at the evaluation point

template<unsigned int N>
std::vector<double> GaussianSumUtilities< N >::pdfComponents ( const Vector ) const
private

pdf components

template<unsigned int N>
void GaussianSumUtilities< N >::setInvalidMode ( ) const
private

set mode "state" in case of failure

template<unsigned int N>
void GaussianSumUtilities< N >::setMode ( const Vector mode) const
private

set mode "state" from solution of mode finding

template<unsigned int N>
unsigned int GaussianSumUtilities< N >::size ( void  ) const
inline

number of components

Definition at line 39 of file GaussianSumUtilities.h.

References GaussianSumUtilities< N >::components().

Referenced by ntuple._Collection::__iter__(), and ntuple._Collection::__len__().

39  {
40  return components().size();
41  }
const SingleStateContainer & components() const
components
template<unsigned int N>
const MultiState& GaussianSumUtilities< N >::state ( ) const
inline

multi-state

Definition at line 47 of file GaussianSumUtilities.h.

References GaussianSumUtilities< N >::theState.

47  {
48  return theState;
49  }
const MultiState & theState
template<unsigned int N>
Matrix GaussianSumUtilities< N >::tensorProduct ( const Vector ) const
private

Symmetric Tensor Product (not recognized by standard ROOT Math)

template<unsigned int N>
double GaussianSumUtilities< N >::weight ( unsigned int  i) const
inline

weight of a component

Definition at line 51 of file GaussianSumUtilities.h.

References GaussianSumUtilities< N >::components(), and i.

Referenced by cuy.ValElement::__init__(), cuy.additionElement::__init__(), cuy.superimposeElement::__init__(), and cuy.graphElement::__init__().

51  {
52  return components()[i]->weight();
53  }
int i
Definition: DBlmapReader.cc:9
const SingleStateContainer & components() const
components
template<unsigned int N>
double GaussianSumUtilities< N >::weight ( void  ) const
inline

Member Data Documentation

template<unsigned int N>
SingleGaussianState<N> GaussianSumUtilities< N >::theMode
mutableprivate

Definition at line 148 of file GaussianSumUtilities.h.

template<unsigned int N>
ModeStatus GaussianSumUtilities< N >::theModeStatus
mutableprivate

Definition at line 146 of file GaussianSumUtilities.h.

template<unsigned int N>
const MultiState& GaussianSumUtilities< N >::theState
private