STK++ 0.9.13
STK_KernelMixtureManager.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::Clustering
27 * created on: 15 mars 2014
28 * Author: iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 **/
30
36#ifndef STK_KERNELMIXTUREMANAGER_H
37#define STK_KERNELMIXTUREMANAGER_H
38
39#include "../STK_Clust_Util.h"
40#include "../STK_IMixtureManager.h"
41
42#include "STK_KmmBridge.h"
43#include "STK_KernelHandler.h"
44
45namespace STK
46{
47// forward declaration
48class KernelMixtureManager;
49
50namespace hidden
51{
54template<>
56{
57 private:
58 class Void {};
59 public:
63 typedef Real Type;
65 typedef std::vector< std::pair<int,int> > MissingIndexes;
67 typedef std::vector< std::pair<std::pair<int,int>, Type > > MissingValues;
68
69 // All data handlers will store and return a specific container for
70 // the data they handle. The DataHandlerTraits class allow us to know the
71 // type of these containers when data is of type Type.
74 typedef Void Data;
75 // Classes wrapping the Real and Integer containers
77 typedef Void DataBridgeType;
78};
79
80} // namespace hidden
81
139
140/* set the dimension of the kernel mixture model */
141template<class Vector>
143{
145 if (!p_mixture) return;
147 // up-cast... (Yes it's bad....;)...)
148 switch (idModel)
149 {
150 // Kernel models
151 case Clust::Kmm_sk_:
152 { static_cast<KmmBridge_sk*>(p_mixture)->setDim(dim.asDerived());}
153 break;
154 case Clust::Kmm_s_:
155 { static_cast<KmmBridge_s*>(p_mixture)->setDim(dim.asDerived());}
156 break;
157 default: // idModel is not implemented
158 break;
159 }
160}
161
162
163} // namespace STK
164
165#endif /* STK_KERNELMIXTUREMANAGER_H */
In this file we define the KernelHandler class.
In this file we define the bridge class between the kernel mixtures and the IMixture interface.
#define STK_STATIC_ASSERT_ONE_DIMENSION_ONLY(EXPR)
Interface base class for mixture managers.
Clust::Mixture getIdModel(String const &idData) const
Utility function allowing to find the idModel from the idData.
Interface base class for all the mixture models that will be processed by the composer.
implementation of the DataHandlerBase class for kernel mixture models.
A mixture manager is a factory class for injection dependency in the STK++ derived class of the Mixtu...
hidden::MixtureManagerTraits< KernelMixtureManager >::DataHandler DataHandler
hidden::MixtureManagerTraits< KernelMixtureManager >::DataBridgeType DataBridgeType
IMixtureManager< KernelMixtureManager > Base
KmmBridge< Clust::Kmm_s_, CSquareX > KmmBridge_s
void setParametersImpl(IMixture *p_mixture, ArrayXX const &param) const
set the parameters from an IMixture.
hidden::MixtureManagerTraits< KernelMixtureManager >::MissingValues MissingValues
void setDim(IMixture *p_mixture, Real const &dim) const
set the dimension of the kernel mixture model
IMixture * createMixtureImpl(String const &modelName, String const &idData, int nbCluster)
create a concrete mixture from its string name and initialize it.
hidden::MixtureManagerTraits< KernelMixtureManager >::MissingIndexes MissingIndexes
void getParametersImpl(IMixture *p_mixture, ArrayXX &param) const
get the parameters from an IMixture.
hidden::MixtureManagerTraits< KernelMixtureManager >::Type Type
KmmBridge< Clust::Kmm_sk_, CSquareX > KmmBridge_sk
hidden::MixtureManagerTraits< KernelMixtureManager >::Data Data
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Mixture
list of the mixtures that can be used by the composer
std::basic_string< Char > String
STK fundamental type of a String.
double Real
STK fundamental type of Real values.
The namespace STK is the main domain space of the Statistical ToolKit project.
std::vector< std::pair< int, int > > MissingIndexes
Type of the array storing missing values indexes.
std::vector< std::pair< std::pair< int, int >, Type > > MissingValues
Type of the array storing missing values.
Main class for the mixture managers traits policy.