STK++ 1.0

STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D > Class Template Reference

Interface base class for all statistical models. More...

#include <STK_ITStatModel.h>

Inheritance diagram for STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >:

List of all members.

Public Member Functions

virtual ~ITStatModel ()
 virtual destructor
MultiLaw const * p_law () const
 give the probability law of the model
virtual void setLaw (MultiLaw *p_law)
 Set the probability law of the model.

Protected Member Functions

 ITStatModel (Container2D const *p_data)
 Constructor.
virtual void compLogLikelihood ()
 compute the log Likelihood of the statistical model.

Protected Attributes

MultiLawp_law_
 a pointer on the probability law.

Private Types

typedef ITContainer2D< TYPE,
TContainerHo, TContainerVe,
TContainer2D > 
Container2D
 Type of the container containing the data.
typedef Law::ITMultivariate
< TYPE, TContainerHo > 
MultiLaw
 Type of the law.
typedef IRunnerPtr2D< TYPE,
TContainerHo, TContainerVe,
TContainer2D > 
Runner2D
 Type of the Runner.

Detailed Description

template<class TYPE, class TContainerHo, class TContainerVe, class TContainer2D>
class STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >

Interface base class for all statistical models.

A statistical model is defined with various elements

  • A data set with the samples in rows and the variables in column
  • A parameterized probability density

We are making the assumption that the variables are all of the same type and stored in a class deriving from ITContainer2D.

Definition at line 63 of file STK_ITStatModel.h.


Member Typedef Documentation

template<class TYPE, class TContainerHo, class TContainerVe, class TContainer2D>
typedef ITContainer2D<TYPE, TContainerHo, TContainerVe, TContainer2D> STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >::Container2D [private]

Type of the container containing the data.

Reimplemented from STK::IRunnerPtr2D< TYPE, TContainerHo, TContainerVe, TContainer2D >.

Definition at line 67 of file STK_ITStatModel.h.

template<class TYPE, class TContainerHo, class TContainerVe, class TContainer2D>
typedef Law::ITMultivariate<TYPE, TContainerHo> STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >::MultiLaw [private]

Type of the law.

Definition at line 69 of file STK_ITStatModel.h.

template<class TYPE, class TContainerHo, class TContainerVe, class TContainer2D>
typedef IRunnerPtr2D< TYPE, TContainerHo, TContainerVe, TContainer2D> STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >::Runner2D [private]

Type of the Runner.

Definition at line 71 of file STK_ITStatModel.h.


Constructor & Destructor Documentation

template<class TYPE, class TContainerHo, class TContainerVe, class TContainer2D>
STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >::ITStatModel ( Container2D const *  p_data) [inline, protected]

Constructor.

Definition at line 75 of file STK_ITStatModel.h.

               : IStatModelBase()
               , Runner2D(p_data)
               , p_law_(0)
    {
      if (this->p_data_)
      {
        nbSample_ = this->p_data_->sizeVe();
        nbVar_ = this->p_data_->sizeHo();
      }
    }
template<class TYPE, class TContainerHo, class TContainerVe, class TContainer2D>
virtual STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >::~ITStatModel ( ) [inline, virtual]

virtual destructor

Definition at line 89 of file STK_ITStatModel.h.

{ if (p_law_) delete p_law_;}

Member Function Documentation

template<class TYPE, class TContainerHo, class TContainerVe, class TContainer2D>
MultiLaw const* STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >::p_law ( ) const [inline]

give the probability law of the model

Returns:
a constant pointer on the probability law.

Definition at line 94 of file STK_ITStatModel.h.

Referenced by STK::ITStatModel< Real, Point, Vector, Matrix >::setLaw().

{ return p_law_;}
template<class TYPE, class TContainerHo, class TContainerVe, class TContainer2D>
virtual void STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >::setLaw ( MultiLaw p_law) [inline, virtual]

Set the probability law of the model.

Parameters:
p_lawthe probability law of the model

Definition at line 99 of file STK_ITStatModel.h.

{ p_law_ = p_law; }
template<class TYPE, class TContainerHo, class TContainerVe, class TContainer2D>
virtual void STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >::compLogLikelihood ( ) [inline, protected, virtual]

compute the log Likelihood of the statistical model.

Definition at line 106 of file STK_ITStatModel.h.

    {
      // no data
      if (!this->p_data_) return;
      // check there exists a law
      if (!p_law_) throw std::runtime_error("In ITStatModel::compLogLikelihood() "
                                            "p_law_ is not initialized.");
      // get dimensions of the samples and sum over all log-likelihood values
      const Integer first = this->p_data_->firstRow(), last = this->p_data_->lastRow();
      Real sum = 0.0;
      for (Integer i=first; i<= last; i++)
      {
        sum += p_law_->lpdf(this->p_data_->row(i));
      }
      logLikelihood_ = sum;
    }

Member Data Documentation

template<class TYPE, class TContainerHo, class TContainerVe, class TContainer2D>
MultiLaw* STK::ITStatModel< TYPE, TContainerHo, TContainerVe, TContainer2D >::p_law_ [protected]

The documentation for this class was generated from the following file: