STK++ 0.9.13
STK::GammaMixtureManager< DataHandler > Class Template Reference

A mixture manager is a factory class for injection dependency in the STK++ derived class of the MixtureComposer class. More...

#include <STK_GammaMixtureManager.h>

Inheritance diagram for STK::GammaMixtureManager< DataHandler >:
Inheritance graph

Public Types

typedef hidden::MixtureManagerTraits< GammaMixtureManager >::Type Type
 
typedef hidden::MixtureManagerTraits< GammaMixtureManager >::MissingIndexes MissingIndexes
 
typedef hidden::MixtureManagerTraits< GammaMixtureManager >::MissingValues MissingValues
 
typedef hidden::MixtureManagerTraits< GammaMixtureManager >::Data Data
 
typedef hidden::MixtureManagerTraits< GammaMixtureManager >::DataBridgeType DataBridgeType
 
typedef IMixtureManager< GammaMixtureManagerBase
 
typedef GammaBridge< Clust::Gamma_ajk_bjk_, DataMixtureBridge_ajk_bjk
 
typedef GammaBridge< Clust::Gamma_ajk_bk_, DataMixtureBridge_ajk_bk
 
typedef GammaBridge< Clust::Gamma_ajk_bj_, DataMixtureBridge_ajk_bj
 
typedef GammaBridge< Clust::Gamma_ajk_b_, DataMixtureBridge_ajk_b
 
typedef GammaBridge< Clust::Gamma_ak_bjk_, DataMixtureBridge_ak_bjk
 
typedef GammaBridge< Clust::Gamma_ak_bk_, DataMixtureBridge_ak_bk
 
typedef GammaBridge< Clust::Gamma_ak_bj_, DataMixtureBridge_ak_bj
 
typedef GammaBridge< Clust::Gamma_ak_b_, DataMixtureBridge_ak_b
 
typedef GammaBridge< Clust::Gamma_aj_bjk_, DataMixtureBridge_aj_bjk
 
typedef GammaBridge< Clust::Gamma_aj_bk_, DataMixtureBridge_aj_bk
 
typedef GammaBridge< Clust::Gamma_a_bjk_, DataMixtureBridge_a_bjk
 
typedef GammaBridge< Clust::Gamma_a_bk_, DataMixtureBridge_a_bk
 
- Public Types inherited from STK::IMixtureManager< GammaMixtureManager< DataHandler > >
typedef hidden::MixtureManagerTraits< GammaMixtureManager< DataHandler > >::DataHandler DataHandler
 
typedef hidden::MixtureManagerTraits< GammaMixtureManager< DataHandler > >::Type Type
 
typedef hidden::MixtureManagerTraits< GammaMixtureManager< DataHandler > >::MissingIndexes MissingIndexes
 
typedef hidden::MixtureManagerTraits< GammaMixtureManager< DataHandler > >::MissingValues MissingValues
 
typedef hidden::MixtureManagerTraits< GammaMixtureManager< DataHandler > >::Data Data
 
typedef hidden::MixtureManagerTraits< GammaMixtureManager< DataHandler > >::DataBridgeType DataBridgeType
 

Public Member Functions

 GammaMixtureManager (DataHandler const &handler)
 Default constructor, need an instance of a DataHandler.
 
 ~GammaMixtureManager ()
 destructor
 
void getMissingValuesImpl (IMixture *p_mixture, MissingValues &missing) const
 get the missing values from an IMixture.
 
void getParametersImpl (IMixture *p_mixture, ArrayXX &param) const
 get the parameters from an IMixture.
 
void setParametersImpl (IMixture *p_mixture, ArrayXX const &param) const
 set the parameters from an IMixture.
 
IMixturecreateMixtureImpl (String const &modelName, String const &idData, int nbCluster)
 create a concrete mixture and initialize it.
 
void registerDataBridge (IDataBridge *p_data)
 register a data bridge to the IMixtureManager.
 
IDataBridgegetDataBridge (String const &idData) const
 Utility lookup function allowing to find a DataBridge from its idData.
 
Clust::Mixture getIdModel (String const &idData) const
 Utility function allowing to find the idModel from the idData.
 
DataHandler const *const p_handler () const
 
- Public Member Functions inherited from STK::IMixtureManager< GammaMixtureManager< DataHandler > >
 IMixtureManager (DataHandler const *const p_handler)
 Default constructor, need an instance of a DataHandler.
 
 ~IMixtureManager ()
 destructor
 
DataHandler const *const p_handler () const
 
Clust::Mixture getIdModel (String const &idData) const
 Utility function allowing to find the idModel from the idData.
 
String getIdModelName (String const &idData) const
 Utility function allowing to find the idModel name from the idData.
 
IMixturecreateMixture (String const &idData, int nbCluster)
 create a mixture and initialize it.
 
void registerDataBridge (IDataBridge *p_data)
 register a data bridge to the IMixtureManager.
 
void releaseDataBridge (String const &idData)
 release a data bridge from v_data_.
 
Data constgetData (String const &idData) const
 get the wrapper for any kind of data set using its Id
 
void getMissingValues (IMixture *p_mixture, MissingValues &missing) const
 get the missing values
 
void getParameters (IMixture *p_mixture, ArrayXX &data) const
 get the parameters from an IMixture.
 
void setParameters (IMixture *p_mixture, ArrayXX const &data) const
 set the parameters from an IMixture.
 
- Public Member Functions inherited from STK::IRecursiveTemplate< Derived >
Derived & asDerived ()
 static cast : return a reference of this with a cast to the derived class.
 
Derived constasDerived () const
 static cast : return a const reference of this with a cast to the derived class.
 
Derived * asPtrDerived ()
 static cast : return a ptr on a Derived of this with a cast to the derived class.
 
Derived constasPtrDerived () const
 static cast : return a ptr on a constant Derived of this with a cast to the derived class.
 
Derived * clone () const
 create a leaf using the copy constructor of the Derived class.
 
Derived * clone (bool isRef) const
 create a leaf using the copy constructor of the Derived class and a flag determining if the clone is a reference or not.
 

Private Member Functions

IMixturecreateMixtureImpl (Clust::Mixture idModel, String const &idData, int nbCluster)
 create a concrete mixture and initialize it.
 

Additional Inherited Members

- Protected Member Functions inherited from STK::IMixtureManager< GammaMixtureManager< DataHandler > >
IDataBridgegetDataBridge (String const &idData) const
 Utility lookup function allowing to find a DataBridge from its idData.
 
- Protected Member Functions inherited from STK::IRecursiveTemplate< Derived >
 IRecursiveTemplate ()
 constructor.
 
 ~IRecursiveTemplate ()
 destructor.
 

Detailed Description

template<class DataHandler>
class STK::GammaMixtureManager< DataHandler >

A mixture manager is a factory class for injection dependency in the STK++ derived class of the MixtureComposer class.

It allows to handle all the creation and initialization stuff needed by the (bridged) mixture models of the stkpp library.

Template Parameters
DataHandleris any concrete class from the interface DataHandlerBase

Definition at line 94 of file STK_GammaMixtureManager.h.

Member Typedef Documentation

◆ Base

◆ Data

◆ DataBridgeType

◆ MissingIndexes

◆ MissingValues

◆ MixtureBridge_a_bjk

◆ MixtureBridge_a_bk

◆ MixtureBridge_aj_bjk

◆ MixtureBridge_aj_bk

◆ MixtureBridge_ajk_b

◆ MixtureBridge_ajk_bj

◆ MixtureBridge_ajk_bjk

◆ MixtureBridge_ajk_bk

◆ MixtureBridge_ak_b

◆ MixtureBridge_ak_bj

◆ MixtureBridge_ak_bjk

◆ MixtureBridge_ak_bk

◆ Type

Constructor & Destructor Documentation

◆ GammaMixtureManager()

template<class DataHandler >
STK::GammaMixtureManager< DataHandler >::GammaMixtureManager ( DataHandler const handler)
inline

Default constructor, need an instance of a DataHandler.


Definition at line 124 of file STK_GammaMixtureManager.h.

124: Base(&handler) {}
IMixtureManager< GammaMixtureManager > Base

◆ ~GammaMixtureManager()

destructor

Definition at line 126 of file STK_GammaMixtureManager.h.

126{}

Member Function Documentation

◆ createMixtureImpl() [1/2]

template<class DataHandler >
IMixture * STK::GammaMixtureManager< DataHandler >::createMixtureImpl ( Clust::Mixture  idModel,
String const idData,
int  nbCluster 
)
inlineprivate

create a concrete mixture and initialize it.

Parameters
idModelId name of the model
idDataId name of the data
nbClusternumber of cluster of the model

Definition at line 299 of file STK_GammaMixtureManager.h.

300 {
301 switch (idModel)
302 {
303 // gamma models
306 break;
309 break;
312 break;
315 break;
318 break;
321 break;
324 break;
327 break;
330 break;
335 break;
338 default:
339 return 0; // 0 if idModel is not implemented
340 break;
341 }
342 return 0; // 0 if idModel is not a STK++ model
343 }
#define STK_CREATE_MIXTURE(Data, Bridge)
GammaBridge< Clust::Gamma_a_bk_, Data > MixtureBridge_a_bk
GammaBridge< Clust::Gamma_ajk_bk_, Data > MixtureBridge_ajk_bk
GammaBridge< Clust::Gamma_ak_bk_, Data > MixtureBridge_ak_bk
GammaBridge< Clust::Gamma_ajk_bj_, Data > MixtureBridge_ajk_bj
GammaBridge< Clust::Gamma_aj_bjk_, Data > MixtureBridge_aj_bjk
GammaBridge< Clust::Gamma_ak_b_, Data > MixtureBridge_ak_b
GammaBridge< Clust::Gamma_a_bjk_, Data > MixtureBridge_a_bjk
GammaBridge< Clust::Gamma_ajk_bjk_, Data > MixtureBridge_ajk_bjk
GammaBridge< Clust::Gamma_ak_bj_, Data > MixtureBridge_ak_bj
GammaBridge< Clust::Gamma_ak_bjk_, Data > MixtureBridge_ak_bjk
hidden::MixtureManagerTraits< GammaMixtureManager >::DataBridgeType DataBridgeType
GammaBridge< Clust::Gamma_aj_bk_, Data > MixtureBridge_aj_bk
GammaBridge< Clust::Gamma_ajk_b_, Data > MixtureBridge_ajk_b

References STK::Clust::Gamma_a_bjk_, STK::Clust::Gamma_a_bk_, STK::Clust::Gamma_aj_bjk_, STK::Clust::Gamma_aj_bk_, STK::Clust::Gamma_ajk_b_, STK::Clust::Gamma_ajk_bj_, STK::Clust::Gamma_ajk_bjk_, STK::Clust::Gamma_ajk_bk_, STK::Clust::Gamma_ak_b_, STK::Clust::Gamma_ak_bj_, STK::Clust::Gamma_ak_bjk_, STK::Clust::Gamma_ak_bk_, and STK_CREATE_MIXTURE.

◆ createMixtureImpl() [2/2]

template<class DataHandler >
IMixture * STK::GammaMixtureManager< DataHandler >::createMixtureImpl ( String const modelName,
String const idData,
int  nbCluster 
)
inline

create a concrete mixture and initialize it.

Parameters
modelNamea valid model name
idDataId of the data
nbClusternumber of cluster of the model

Definition at line 287 of file STK_GammaMixtureManager.h.

288 {
289 Clust::Mixture idModel = Clust::stringToMixture(modelName);
290 return createMixtureImpl(idModel, idData, nbCluster);
291 }
IMixture * createMixtureImpl(String const &modelName, String const &idData, int nbCluster)
create a concrete mixture and initialize it.
Mixture stringToMixture(String const &type)
Convert a String to a Mixture.
Mixture
list of the mixtures that can be used by the composer

References STK::GammaMixtureManager< DataHandler >::createMixtureImpl(), and STK::Clust::stringToMixture().

Referenced by STK::GammaMixtureManager< DataHandler >::createMixtureImpl().

◆ getDataBridge()

template<class DataHandler >
IDataBridge * STK::IMixtureManager< Derived >::getDataBridge ( String const idData) const

Utility lookup function allowing to find a DataBridge from its idData.

Parameters
idDatathe id name of the mixture we want to get
Returns
a pointer on the DataBridge

Definition at line 151 of file STK_IMixtureManager.h.

262{
263 typedef std::vector<IDataBridge*>::const_iterator ConstDataIterator;
264 for (ConstDataIterator it = v_data_.begin(); it != v_data_.end(); ++it)
265 { if ((*it)->idData() == idData) return (*it);}
266 return 0;
267}
std::vector< IDataBridge * > v_data_
vector of pointers to the data components

◆ getIdModel()

template<class DataHandler >
Clust::Mixture STK::IMixtureManager< Derived >::getIdModel ( String const idData) const

Utility function allowing to find the idModel from the idData.

Parameters
idDatathe id name of the data we want the idModel
Returns
the idModel

Definition at line 91 of file STK_IMixtureManager.h.

173{
174 String modelName;
175 if (!p_handler()->getIdModelName( idData, modelName))
176 {
177#ifdef STK_MIXTURE_VERY_VERBOSE
178 stk_cout << _T("In IMixtureManager::getIdModel, fail to get idData = ") << idData << _T("\n");
179#endif
181 }
182#ifdef STK_MIXTURE_VERY_VERBOSE
183 stk_cout << _T("In IMixtureManager::getIdModel, success to get idData = ") << idData << _T("\n");
184 stk_cout << _T("In IMixtureManager::getIdModel, modelName = ") << modelName << _T("\n");
185#endif
186 return Clust::stringToMixture(modelName);
187}
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
DataHandler const *const p_handler() const
String getIdModelName(String const &idData) const
Utility function allowing to find the idModel name from the idData.
std::basic_string< Char > String
STK fundamental type of a String.

Referenced by STK::GammaMixtureManager< DataHandler >::getMissingValuesImpl(), STK::GammaMixtureManager< DataHandler >::getParametersImpl(), and STK::GammaMixtureManager< DataHandler >::setParametersImpl().

◆ getMissingValuesImpl()

template<class DataHandler >
void STK::GammaMixtureManager< DataHandler >::getMissingValuesImpl ( IMixture p_mixture,
MissingValues missing 
) const
inline

get the missing values from an IMixture.

Parameters
p_mixturepointer on the mixture
missingstructure to return with the missing values

Definition at line 132 of file STK_GammaMixtureManager.h.

133 {
134 Clust::Mixture idModel = getIdModel(p_mixture->idData());
135 if (idModel == Clust::unknown_mixture_) return;
136 // up-cast... (Yes it's bad....;)...)
137 switch (idModel)
138 {
140 { static_cast<MixtureBridge_ajk_bjk*>(p_mixture)->getMissingValues(missing);}
141 break;
143 { static_cast<MixtureBridge_ajk_bk*>(p_mixture)->getMissingValues(missing);}
144 break;
146 { static_cast<MixtureBridge_ajk_bj*>(p_mixture)->getMissingValues(missing);}
147 break;
149 { static_cast<MixtureBridge_ajk_b*>(p_mixture)->getMissingValues(missing);}
150 break;
152 { static_cast<MixtureBridge_ak_bjk*>(p_mixture)->getMissingValues(missing);}
153 break;
155 { static_cast<MixtureBridge_ak_bk*>(p_mixture)->getMissingValues(missing);}
156 break;
158 { static_cast<MixtureBridge_ak_bj*>(p_mixture)->getMissingValues(missing);}
159 break;
161 { static_cast<MixtureBridge_ak_b*>(p_mixture)->getMissingValues(missing);}
162 break;
164 { static_cast<MixtureBridge_aj_bjk*>(p_mixture)->getMissingValues(missing);}
165 break;
167 { static_cast<MixtureBridge_aj_bk*>(p_mixture)->getMissingValues(missing);}
168 break;
170 { static_cast<MixtureBridge_a_bjk*>(p_mixture)->getMissingValues(missing);}
171 break;
173 { static_cast<MixtureBridge_a_bk*>(p_mixture)->getMissingValues(missing);}
174 break;
175 default: // idModel is not implemented
176 break;
177 }
178 }
Clust::Mixture getIdModel(String const &idData) const
Utility function allowing to find the idModel from the idData.
void getMissingValues(IMixture *p_mixture, MissingValues &missing) const
get the missing values

References STK::Clust::Gamma_a_bjk_, STK::Clust::Gamma_a_bk_, STK::Clust::Gamma_aj_bjk_, STK::Clust::Gamma_aj_bk_, STK::Clust::Gamma_ajk_b_, STK::Clust::Gamma_ajk_bj_, STK::Clust::Gamma_ajk_bjk_, STK::Clust::Gamma_ajk_bk_, STK::Clust::Gamma_ak_b_, STK::Clust::Gamma_ak_bj_, STK::Clust::Gamma_ak_bjk_, STK::Clust::Gamma_ak_bk_, STK::GammaMixtureManager< DataHandler >::getIdModel(), STK::IMixtureManager< GammaMixtureManager< DataHandler > >::getMissingValues(), and STK::Clust::unknown_mixture_.

◆ getParametersImpl()

template<class DataHandler >
void STK::GammaMixtureManager< DataHandler >::getParametersImpl ( IMixture p_mixture,
ArrayXX param 
) const
inline

get the parameters from an IMixture.

Parameters
p_mixturepointer on the mixture
paramthe array to return with the parameters

Definition at line 183 of file STK_GammaMixtureManager.h.

184 {
185 Clust::Mixture idModel = getIdModel(p_mixture->idData());
186 if (idModel == Clust::unknown_mixture_) return;
187 // up-cast... (Yes it's bad....;)...)
188 switch (idModel)
189 {
191 { static_cast<MixtureBridge_ajk_bjk*>(p_mixture)->getParameters(param);}
192 break;
194 { static_cast<MixtureBridge_ajk_bk*>(p_mixture)->getParameters(param);}
195 break;
197 { static_cast<MixtureBridge_ajk_bj*>(p_mixture)->getParameters(param);}
198 break;
200 { static_cast<MixtureBridge_ajk_b*>(p_mixture)->getParameters(param);}
201 break;
203 { static_cast<MixtureBridge_ak_bjk*>(p_mixture)->getParameters(param);}
204 break;
206 { static_cast<MixtureBridge_ak_bk*>(p_mixture)->getParameters(param);}
207 break;
209 { static_cast<MixtureBridge_ak_bj*>(p_mixture)->getParameters(param);}
210 break;
212 { static_cast<MixtureBridge_ak_b*>(p_mixture)->getParameters(param);}
213 break;
215 { static_cast<MixtureBridge_aj_bjk*>(p_mixture)->getParameters(param);}
216 break;
218 { static_cast<MixtureBridge_aj_bk*>(p_mixture)->getParameters(param);}
219 break;
221 { static_cast<MixtureBridge_a_bjk*>(p_mixture)->getParameters(param);}
222 break;
224 { static_cast<MixtureBridge_a_bk*>(p_mixture)->getParameters(param);}
225 break;
226 default: // idModel is not implemented
227 break;
228 }
229 }
void getParameters(IMixture *p_mixture, ArrayXX &data) const
get the parameters from an IMixture.

References STK::Clust::Gamma_a_bjk_, STK::Clust::Gamma_a_bk_, STK::Clust::Gamma_aj_bjk_, STK::Clust::Gamma_aj_bk_, STK::Clust::Gamma_ajk_b_, STK::Clust::Gamma_ajk_bj_, STK::Clust::Gamma_ajk_bjk_, STK::Clust::Gamma_ajk_bk_, STK::Clust::Gamma_ak_b_, STK::Clust::Gamma_ak_bj_, STK::Clust::Gamma_ak_bjk_, STK::Clust::Gamma_ak_bk_, STK::GammaMixtureManager< DataHandler >::getIdModel(), STK::IMixtureManager< GammaMixtureManager< DataHandler > >::getParameters(), and STK::Clust::unknown_mixture_.

◆ p_handler()

template<class DataHandler >
DataHandler const *const STK::IMixtureManager< Derived >::p_handler ( ) const
inline
Returns
constant pointer on the data handler

Definition at line 85 of file STK_IMixtureManager.h.

85{ return p_handler_;}
DataHandler const *const p_handler_
A pointer on the concrete instance of the data handler.

◆ registerDataBridge()

template<class DataHandler >
void STK::IMixtureManager< Derived >::registerDataBridge ( IDataBridge p_data)

register a data bridge to the IMixtureManager.

For each mixture created and registered, a data bridge is created and registered so that it will be deleted when the mixture itself is deleted.

Parameters
p_dataa pointer on the data manager

Definition at line 114 of file STK_IMixtureManager.h.

244{ v_data_.push_back(p_data);}

◆ setParametersImpl()

template<class DataHandler >
void STK::GammaMixtureManager< DataHandler >::setParametersImpl ( IMixture p_mixture,
ArrayXX const param 
) const
inline

set the parameters from an IMixture.

Parameters
p_mixturepointer on the mixture
paramthe array with the parameters to set

Definition at line 234 of file STK_GammaMixtureManager.h.

235 {
236 Clust::Mixture idModel = getIdModel(p_mixture->idData());
237 if (idModel == Clust::unknown_mixture_) return;
238 // up-cast... (Yes it's bad....;)...)
239 switch (idModel)
240 {
242 { static_cast<MixtureBridge_ajk_bjk*>(p_mixture)->setParameters(param);}
243 break;
245 { static_cast<MixtureBridge_ajk_bk*>(p_mixture)->setParameters(param);}
246 break;
248 { static_cast<MixtureBridge_ajk_bj*>(p_mixture)->setParameters(param);}
249 break;
251 { static_cast<MixtureBridge_ajk_b*>(p_mixture)->setParameters(param);}
252 break;
254 { static_cast<MixtureBridge_ak_bjk*>(p_mixture)->setParameters(param);}
255 break;
257 { static_cast<MixtureBridge_ak_bk*>(p_mixture)->setParameters(param);}
258 break;
260 { static_cast<MixtureBridge_ak_bj*>(p_mixture)->setParameters(param);}
261 break;
263 { static_cast<MixtureBridge_ak_b*>(p_mixture)->setParameters(param);}
264 break;
266 { static_cast<MixtureBridge_aj_bjk*>(p_mixture)->setParameters(param);}
267 break;
269 { static_cast<MixtureBridge_aj_bk*>(p_mixture)->setParameters(param);}
270 break;
272 { static_cast<MixtureBridge_a_bjk*>(p_mixture)->setParameters(param);}
273 break;
275 { static_cast<MixtureBridge_a_bk*>(p_mixture)->setParameters(param);}
276 break;
277 default: // idModel is not implemented
278 break;
279 }
280 }
void setParameters(IMixture *p_mixture, ArrayXX const &data) const
set the parameters from an IMixture.

References STK::Clust::Gamma_a_bjk_, STK::Clust::Gamma_a_bk_, STK::Clust::Gamma_aj_bjk_, STK::Clust::Gamma_aj_bk_, STK::Clust::Gamma_ajk_b_, STK::Clust::Gamma_ajk_bj_, STK::Clust::Gamma_ajk_bjk_, STK::Clust::Gamma_ajk_bk_, STK::Clust::Gamma_ak_b_, STK::Clust::Gamma_ak_bj_, STK::Clust::Gamma_ak_bjk_, STK::Clust::Gamma_ak_bk_, STK::GammaMixtureManager< DataHandler >::getIdModel(), STK::IMixtureManager< GammaMixtureManager< DataHandler > >::setParameters(), and STK::Clust::unknown_mixture_.


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