STK++ 0.9.13
STK_IStatModel.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff, Université Lille 1, Inria
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the
16 Free Software Foundation, Inc.,
17 59 Temple Place,
18 Suite 330,
19 Boston, MA 02111-1307
20 USA
21
22 Contact : S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
23*/
24
25/*
26 * Project: stkpp::Model
27 * created on: 22 juil. 2011
28 * Purpose: define the class IStatModel.
29 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
30 **/
31
36#ifndef STK_ISTATMODEL_H
37#define STK_ISTATMODEL_H
38
39#include <cmath>
40#include <Sdk.h>
41
42#include "STK_IStatModelBase.h"
43#include "STK_Model_Util.h"
45
46namespace STK
47{
48
82template <class Derived>
84{
85 public:
88
90 typedef typename Data::Type Type;
93
94 protected:
96 IStatModel(Data const& data): IStatModelBase(data.sizeRows(), data.sizeCols())
97 , p_dataij_(&data)
98 {}
100 IStatModel(Data const* p_data): IStatModelBase(), p_dataij_(p_data)
101 { if (p_data) this->initialize(p_data->sizeRows(), p_data->sizeCols()) ;}
102
103 public:
107 inline Data const* const p_dataij() const { return p_dataij_;}
111 inline void setData( Data const& data)
112 { p_dataij_ = &data;
113 this->setNbSample(p_dataij_->sizeRows());
114 this->setNbVariable(p_dataij_->sizeCols()) ;
115 }
119 inline void setData( Data const* p_data)
120 { p_dataij_ = p_data;
121 if (p_dataij_)
122 {
123 this->setNbSample(p_dataij_->sizeRows());
124 this->setNbVariable(p_dataij_->sizeCols()) ;
125 }
126 }
127
128 protected:
130 Data const* p_dataij_;
131};
132
133} // namespace STK
134
135#endif /* STK_ISTATMODEL_H */
In this file we define the interface base class IStatModelBase.
In this file we define the constant and utilities methods used in the project Model.
In this file we define the Interface base classes IMultiLaw and JointProbability.
This file include all the other header files of the project Sdk.
Interface base class for all Statistical Models.
void setNbSample(int const &nbSample)
set the number of samples of the model
void setNbVariable(int const &nbVariable)
set the number of variables of the model
void initialize(int nbSample, int nbVariable)
set the dimensions of the parameters of the model
Base class for all Statistical Models [Deprecated], have been replaced by IStatModel.
~IStatModel()
destructor
Data const * p_dataij_
A pointer on the original data set.
Data::Type Type
Type of the data contained in the container.
void setData(Data const *p_data)
Set the data set of the model.
Data const *const p_dataij() const
IStatModel(Data const *p_data)
Constructor with a ptr on the data set.
hidden::Traits< Data >::Row Row
Type of the row of the data container (a sample)
hidden::ModelTraits< Derived >::ParamHandler ParamHandler
void setData(Data const &data)
Set the data set of the model.
IStatModel(Data const &data)
Constructor with data set.
hidden::ModelTraits< Derived >::Data Data
The namespace STK is the main domain space of the Statistical ToolKit project.