CMS 3D CMS Logo

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 () const
 combined covariance More...
 
const Matrixcovariance (unsigned int i) const
 covariance matrix of a component 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 () const
 combined mean More...
 
const Vectormean (unsigned int i) const
 mean value of a component 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 () const
 combined weight More...
 
double weight (unsigned int i) const
 weight of a component 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

◆ GenMatrix

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.

◆ Matrix

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

Definition at line 23 of file GaussianSumUtilities.h.

◆ MultiState

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

Definition at line 18 of file GaussianSumUtilities.h.

◆ SingleState

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

Definition at line 17 of file GaussianSumUtilities.h.

◆ SingleStateContainer

Definition at line 25 of file GaussianSumUtilities.h.

◆ SingleStatePtr

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

Definition at line 24 of file GaussianSumUtilities.h.

◆ Vector

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

Definition at line 22 of file GaussianSumUtilities.h.

Member Enumeration Documentation

◆ ModeStatus

template<unsigned int N>
enum GaussianSumUtilities::ModeStatus
private
Enumerator
Valid 
NotValid 
NotComputed 

Definition at line 28 of file GaussianSumUtilities.h.

Constructor & Destructor Documentation

◆ GaussianSumUtilities()

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

Definition at line 31 of file GaussianSumUtilities.h.

31  :
32  theState(state),
34  }

◆ ~GaussianSumUtilities()

template<unsigned int N>
GaussianSumUtilities< N >::~GaussianSumUtilities ( )
inline

Definition at line 35 of file GaussianSumUtilities.h.

35  {
36  }

Member Function Documentation

◆ components()

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

◆ computeMode()

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

calculation of mode with transformation of pdf

◆ computeModeWithoutTransform()

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

calculation of mode

◆ constrainedState()

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

◆ covariance() [1/2]

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

combined covariance

Definition at line 89 of file GaussianSumUtilities.h.

89  {
90  return theState.covariance();
91  }

References GaussianSumUtilities< N >::theState.

◆ covariance() [2/2]

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.

59  {
60  return components()[i]->covariance();
61  }

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

◆ d1LnPdf() [1/2]

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

gradient of ln(pdf)

◆ d1LnPdf() [2/2]

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

◆ d1Pdf() [1/2]

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

gradient

◆ d1Pdf() [2/2]

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

◆ d2LnPdf() [1/2]

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

Hessian of ln(pdf)

◆ d2LnPdf() [2/2]

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.

◆ d2Pdf() [1/2]

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

Hessian.

◆ d2Pdf() [2/2]

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.

◆ findMode()

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

◆ gauss() [1/2]

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

value of gaussian distribution

◆ gauss() [2/2]

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

value of multidimensional gaussian distribution

◆ lnPdf() [1/2]

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

value of ln(pdf)

◆ lnPdf() [2/2]

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

◆ localCovariance()

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!

◆ mean() [1/2]

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

combined mean

Definition at line 85 of file GaussianSumUtilities.h.

85  {
86  return theState.mean();
87  }

References GaussianSumUtilities< N >::theState.

◆ mean() [2/2]

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.

55  {
56  return components()[i]->mean();
57  }

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

◆ mode()

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

◆ modeIsValid()

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

mode status

◆ pdf() [1/2]

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

value of the p.d.f.

◆ pdf() [2/2]

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

◆ pdfComponents()

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

pdf components

◆ setInvalidMode()

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

set mode "state" in case of failure

◆ setMode()

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

set mode "state" from solution of mode finding

◆ size()

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

number of components

Definition at line 39 of file GaussianSumUtilities.h.

39  {
40  return components().size();
41  }

References GaussianSumUtilities< N >::components().

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

◆ state()

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

multi-state

Definition at line 47 of file GaussianSumUtilities.h.

47  {
48  return theState;
49  }

References GaussianSumUtilities< N >::theState.

◆ tensorProduct()

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

Symmetric Tensor Product (not recognized by standard ROOT Math)

◆ weight() [1/2]

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

combined weight

Definition at line 81 of file GaussianSumUtilities.h.

81  {
82  return theState.weight();
83  }

References GaussianSumUtilities< N >::theState.

◆ weight() [2/2]

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.

51  {
52  return components()[i]->weight();
53  }

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

Member Data Documentation

◆ theMode

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

Definition at line 148 of file GaussianSumUtilities.h.

◆ theModeStatus

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

Definition at line 146 of file GaussianSumUtilities.h.

◆ theState

template<unsigned int N>
const MultiState& GaussianSumUtilities< N >::theState
private
mps_fire.i
i
Definition: mps_fire.py:428
GaussianSumUtilities::NotComputed
Definition: GaussianSumUtilities.h:28
GaussianSumUtilities::theModeStatus
ModeStatus theModeStatus
Definition: GaussianSumUtilities.h:146
GaussianSumUtilities::components
const SingleStateContainer & components() const
components
Definition: GaussianSumUtilities.h:43
GaussianSumUtilities::NotValid
Definition: GaussianSumUtilities.h:28
GaussianSumUtilities::theState
const MultiState & theState
Definition: GaussianSumUtilities.h:143
GaussianSumUtilities::Valid
Definition: GaussianSumUtilities.h:28
GaussianSumUtilities::state
const MultiState & state() const
multi-state
Definition: GaussianSumUtilities.h:47