STK++ 0.9.13
STK_Clust_Util.cpp
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff
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.org (see copyright for ...)
23*/
24
25/*
26 * Project: stkpp::Clustering
27 * created on: 4 sept. 2013
28 * Author: iovleff, s...DOTi...ATstkppDOTorg
29 **/
30
41
42namespace STK
43{
44
45namespace Clust
46{
47
48/* @ingroup Clustering
49 * Convert a String to a initType. The recognized strings are
50 * <table>
51 * <tr> <th> Initialization </th></tr>
52 * <tr> <td> "randomInit"</td></tr>
53 * <tr> <td> "randomParamInit"</td></tr>
54 * <tr> <td> "randomClassInit"</td></tr>
55 * <tr> <td> "randomFuzzyInit"</td></tr>
56 * <tr> <td> "random" </td></tr>
57 * <tr> <td> "class" </td></tr>
58 * <tr> <td> "fuzzy" </td></tr>
59 * </table>
60 * @param type the type of initialization wanted
61 * @return the initType corresponding (default is randomClassInit)
62 * @note if the string is not found in the list above,the type Clust::randomClassInit_
63 * is returned.
64 **/
66{
67 if (toUpperString(type) == toUpperString(_T("randomInit"))) return randomParamInit_;
68 if (toUpperString(type) == toUpperString(_T("randomParamInit"))) return randomParamInit_;
69 if (toUpperString(type) == toUpperString(_T("randomClassInit"))) return randomClassInit_;
70 if (toUpperString(type) == toUpperString(_T("randomFuzzyInit"))) return randomFuzzyInit_;
71 if (toUpperString(type) == toUpperString(_T("random"))) return randomParamInit_;
72 if (toUpperString(type) == toUpperString(_T("class"))) return randomClassInit_;
73 if (toUpperString(type) == toUpperString(_T("fuzzy"))) return randomFuzzyInit_;
74 return randomClassInit_;
75}
76
77/* @ingroup Clustering
78 * Convert a String to an algoType. The recognized strings are
79 * <table>
80 * <tr> <th> Algorithm </th></tr>
81 * <tr> <td> "emAlgo"</td></tr>
82 * <tr> <td> "cemAlgo"</td></tr>
83 * <tr> <td> "semAlgo"</td></tr>
84 * <tr> <td> "em"</td></tr>
85 * <tr> <td> "cem" </td></tr>
86 * <tr> <td> "sem" </td></tr>
87 * </table>
88 * @param type the type of algorithm wanted
89 * @return the algoType corresponding (default is emAlgo)
90 * @note if the string is not found in the list above,the type Clust::emAlgo_
91 * is returned.
92 **/
94{
95 if (toUpperString(type) == toUpperString(_T("emAlgo"))) return emAlgo_;
96 if (toUpperString(type) == toUpperString(_T("cemAlgo"))) return cemAlgo_;
97 if (toUpperString(type) == toUpperString(_T("semAlgo"))) return semAlgo_;
98 if (toUpperString(type) == toUpperString(_T("semiSemAlgo"))) return semiSemAlgo_;
99 if (toUpperString(type) == toUpperString(_T("em"))) return emAlgo_;
100 if (toUpperString(type) == toUpperString(_T("cem"))) return cemAlgo_;
101 if (toUpperString(type) == toUpperString(_T("sem"))) return semAlgo_;
102 if (toUpperString(type) == toUpperString(_T("semiSem"))) return semiSemAlgo_;
103 return emAlgo_;
104}
105
106/* @ingroup Clustering
107 * Convert a String to an algoPredictType. The recognized strings are
108 * <table>
109 * <tr> <th> Algorithm </th></tr>
110 * <tr> <td> "em" </td></tr>
111 * <tr> <td> "semiSem" </td></tr>
112 * </table>
113 * @param type the type of algorithm wanted
114 * @return the algoPredictType corresponding (default is em)
115 * @note The capitalized letters have no effect and if the string is not found
116 * in the list above, the type Clust::emPredictAlgo_ is returned.
117 **/
119{
120 if (toUpperString(type) == toUpperString(_T("em"))) return emPredictAlgo_;
121 if (toUpperString(type) == toUpperString(_T("semiSem"))) return semiSEMPredictAlgo_;
122 return emPredictAlgo_;
123}
124
125/* @ingroup Clustering
126 * Convert a String to an algoLearnType. The recognized strings are
127 * <table>
128 * <tr> <th> Algorithm </th></tr>
129 * <tr> <td> "imputeAlgo" </td></tr>
130 * <tr> <td> "simulAlgo" </td></tr>
131 * <tr> <td> "impute" </td></tr>
132 * <tr> <td> "simul" </td></tr>
133 * </table>
134 * @param type the type of algorithm wanted
135 * @return the algoType corresponding (default is emAlgo)
136 * @note The capitalized letters have no effect and if the string is not found
137 * in the list above,the type Clust::emAlgo_ is returned.
138 **/
140{
141 if (toUpperString(type) == toUpperString(_T("imputeAlgo"))) return imputeAlgo_;
142 if (toUpperString(type) == toUpperString(_T("simulAlgo"))) return simulAlgo_;
143 if (toUpperString(type) == toUpperString(_T("impute"))) return imputeAlgo_;
144 if (toUpperString(type) == toUpperString(_T("simul"))) return simulAlgo_;
145 return imputeAlgo_;
146}
147
148
149
150/* @ingroup Clustering
151 * Convert a String to an criterionType. The recognized strings are
152 * <table>
153 * <tr> <th> Criterion </th></tr>
154 * <tr> <td> "AIC" </td></tr>
155 * <tr> <td> "BIC" </td></tr>
156 * <tr> <td> "ICL </td></tr>
157 * <tr> <td> "ML" </td></tr>
158 * </table>
159 * @param type the type of criterion wanted
160 * @return the criterionType corresponding
161 * @note The capitalized letters have no effect and if the string is not found
162 * in the list above,the type Clust::bic_ is returned.
163 **/
165{
166 if (toUpperString(type) == toUpperString(_T("AIC"))) return aic_;
167 if (toUpperString(type) == toUpperString(_T("BIC"))) return bic_;
168 if (toUpperString(type) == toUpperString(_T("ICL"))) return icl_;
169 if (toUpperString(type) == toUpperString(_T("ML"))) return ml_;
170 return bic_;
171}
172
173/* @ingroup Clustering
174 * convert a TypeReduction to a String.
175 * @param type the type of exception that occur
176 * @return the string associated to this type.
177 **/
179{
180 if (type == randomInitFail_) return String(_T("RandomInit fail"));
181 if (type == randomClassInitFail_) return String(_T("RandomClassInit fail"));
182 if (type == randomFuzzyInitFail_) return String(_T("RandomFuzzyInit fail"));
183 if (type == randomParamInitFail_) return String(_T("RandomParamInit fail"));
184 if (type == initializeStepFail_) return String(_T("initializeStep fail"));
185 if (type == estimFail_) return String(_T("Estimation fail"));
186 if (type == mStepFail_) return String(_T("mStep fail"));
187 if (type == eStepFail_) return String(_T("eStep fail"));
188 if (type == mapStepFail_) return String(_T("mapStep fail"));
189 if (type == cStepFail_) return String(_T("cStep fail"));
190 if (type == sStepFail_) return String(_T("sStep fail"));
191 return String(_T("unknown exception"));
192}
193
194/* @ingroup Clustering
195 * convert a Mixture to a MixtureClass.
196 * @param type the type of Mixture
197 * @return the MixtureClass associated to this Mixture.
198 **/
200{
201 if (type == Gamma_ajk_bjk_) return Gamma_;
202 if (type == Gamma_ajk_bk_) return Gamma_;
203 if (type == Gamma_ajk_bj_) return Gamma_;
204 if (type == Gamma_ajk_b_) return Gamma_;
205 if (type == Gamma_ak_bjk_) return Gamma_;
206 if (type == Gamma_ak_bk_) return Gamma_;
207 if (type == Gamma_ak_bj_) return Gamma_;
208 if (type == Gamma_ak_b_) return Gamma_;
209 if (type == Gamma_aj_bjk_) return Gamma_;
210 if (type == Gamma_aj_bk_) return Gamma_;
211 if (type == Gamma_a_bjk_) return Gamma_;
212 if (type == Gamma_a_bk_) return Gamma_;
213 if (type == Gaussian_sjk_) return DiagGaussian_;
214 if (type == Gaussian_sk_) return DiagGaussian_;
215 if (type == Gaussian_sj_) return DiagGaussian_;
216 if (type == Gaussian_s_) return DiagGaussian_;
217 if (type == Gaussian_sjsk_) return DiagGaussian_;
218 if (type == HDGaussian_AjkBkQkDk_) return HDGaussian_;
219 if (type == HDGaussian_AjkBkQkD_) return HDGaussian_;
220 if (type == HDGaussian_AjkBkQDk_) return HDGaussian_;
221 if (type == HDGaussian_AjkBkQD_) return HDGaussian_;
222 if (type == HDGaussian_AjkBQkDk_) return HDGaussian_;
223 if (type == HDGaussian_AjkBQkD_) return HDGaussian_;
224 if (type == HDGaussian_AjkBQDk_) return HDGaussian_;
225 if (type == HDGaussian_AjkBQD_) return HDGaussian_;
226 if (type == HDGaussian_AkBkQkDk_) return HDGaussian_;
227 if (type == HDGaussian_AkBkQkD_) return HDGaussian_;
228 if (type == HDGaussian_AkBkQDk_) return HDGaussian_;
229 if (type == HDGaussian_AkBkQD_) return HDGaussian_;
230 if (type == HDGaussian_AkBQkDk_) return HDGaussian_;
231 if (type == HDGaussian_AkBQkD_) return HDGaussian_;
232 if (type == HDGaussian_AkBQDk_) return HDGaussian_;
233 if (type == HDGaussian_AkBQD_) return HDGaussian_;
234 if (type == HDGaussian_AjBkQkDk_) return HDGaussian_;
235 if (type == HDGaussian_AjBkQkD_) return HDGaussian_;
236 if (type == HDGaussian_AjBkQDk_) return HDGaussian_;
237 if (type == HDGaussian_AjBkQD_) return HDGaussian_;
238 if (type == HDGaussian_AjBQkDk_) return HDGaussian_;
239 if (type == HDGaussian_AjBQkD_) return HDGaussian_;
240 if (type == HDGaussian_ABkQkDk_) return HDGaussian_;
241 if (type == HDGaussian_ABkQkD_) return HDGaussian_;
242 if (type == HDGaussian_ABkQDk_) return HDGaussian_;
243 if (type == HDGaussian_ABkQD_) return HDGaussian_;
244 if (type == HDGaussian_ABQkDk_) return HDGaussian_;
245 if (type == HDGaussian_ABQkD_) return HDGaussian_;
246 if (type == Categorical_pjk_) return Categorical_;
247 if (type == Categorical_pk_) return Categorical_;
248 if (type == Poisson_ljk_) return Poisson_;
249 if (type == Poisson_lk_) return Poisson_;
250 if (type == Poisson_ljlk_) return Poisson_;
251 if (type == Kmm_sk_) return Kmm_;
252 if (type == Kmm_s_) return Kmm_;
253 if (type == unknown_mixture_) return unknown_mixture_class_;
254 return unknown_mixture_class_; // avoid compiler warning
255}
256
257/* @ingroup Clustering
258 * convert a String to an Mixture.
259 * @param type the String we want to convert
260 * @return the Mixture represented by the String @c type. if the string
261 * does not match any known name, the @c unknown_mixture_ type is returned.
262 **/
264{
265 if (toUpperString(type) == toUpperString(_T("Gamma_ajk_bjk"))) return Gamma_ajk_bjk_;
266 if (toUpperString(type) == toUpperString(_T("Gamma_ajk_bk"))) return Gamma_ajk_bk_;
267 if (toUpperString(type) == toUpperString(_T("Gamma_ajk_bj"))) return Gamma_ajk_bj_;
268 if (toUpperString(type) == toUpperString(_T("Gamma_ajk_b"))) return Gamma_ajk_b_;
269 if (toUpperString(type) == toUpperString(_T("Gamma_ak_bjk"))) return Gamma_ak_bjk_;
270 if (toUpperString(type) == toUpperString(_T("Gamma_ak_bk"))) return Gamma_ak_bk_;
271 if (toUpperString(type) == toUpperString(_T("Gamma_ak_bj"))) return Gamma_ak_bj_;
272 if (toUpperString(type) == toUpperString(_T("Gamma_ak_b"))) return Gamma_ak_b_;
273 if (toUpperString(type) == toUpperString(_T("Gamma_aj_bjk"))) return Gamma_aj_bjk_;
274 if (toUpperString(type) == toUpperString(_T("Gamma_aj_bk"))) return Gamma_aj_bk_;
275 if (toUpperString(type) == toUpperString(_T("Gamma_a_bjk"))) return Gamma_a_bjk_;
276 if (toUpperString(type) == toUpperString(_T("Gamma_a_bk"))) return Gamma_a_bk_;
277 if (toUpperString(type) == toUpperString(_T("Gaussian_sjk"))) return Gaussian_sjk_;
278 if (toUpperString(type) == toUpperString(_T("Gaussian_sk"))) return Gaussian_sk_;
279 if (toUpperString(type) == toUpperString(_T("Gaussian_sj"))) return Gaussian_sj_;
280 if (toUpperString(type) == toUpperString(_T("Gaussian_s"))) return Gaussian_s_;
281 if (toUpperString(type) == toUpperString(_T("Gaussian_sjsk"))) return Gaussian_sjsk_;
282 if (toUpperString(type) == toUpperString(_T("Categorical_pjk"))) return Categorical_pjk_;
283 if (toUpperString(type) == toUpperString(_T("Categorical_pk"))) return Categorical_pk_;
284 if (toUpperString(type) == toUpperString(_T("Poisson_ljk"))) return Poisson_ljk_;
285 if (toUpperString(type) == toUpperString(_T("Poisson_lk"))) return Poisson_lk_;
286 if (toUpperString(type) == toUpperString(_T("Poisson_ljlk"))) return Poisson_ljlk_;
287 if (toUpperString(type) == toUpperString(_T("Kmm_sk")))return Kmm_sk_;
288 if (toUpperString(type) == toUpperString(_T("Kmm_s"))) return Kmm_s_;
289 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjkBkQkDk")))return HDGaussian_AjkBkQkDk_;
290 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjkBkQkD"))) return HDGaussian_AjkBkQkD_;
291 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjkBkQDk"))) return HDGaussian_AjkBkQDk_;
292 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjkBkQD"))) return HDGaussian_AjkBkQD_;
293 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjkBQkDk"))) return HDGaussian_AjkBQkDk_;
294 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjkBQkD"))) return HDGaussian_AjkBQkD_;
295 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjkBQDk"))) return HDGaussian_AjkBQDk_;
296 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjkBQD"))) return HDGaussian_AjkBQD_;
297 if (toUpperString(type) == toUpperString(_T("HDGaussian_AkBkQkDk"))) return HDGaussian_AkBkQkDk_;
298 if (toUpperString(type) == toUpperString(_T("HDGaussian_AkBkQkD"))) return HDGaussian_AkBkQkD_;
299 if (toUpperString(type) == toUpperString(_T("HDGaussian_AkBkQDk"))) return HDGaussian_AkBkQDk_;
300 if (toUpperString(type) == toUpperString(_T("HDGaussian_AkBkQD"))) return HDGaussian_AkBkQD_;
301 if (toUpperString(type) == toUpperString(_T("HDGaussian_AkBQkDk"))) return HDGaussian_AkBQkDk_;
302 if (toUpperString(type) == toUpperString(_T("HDGaussian_AkBQkD"))) return HDGaussian_AkBQkD_;
303 if (toUpperString(type) == toUpperString(_T("HDGaussian_AkBQDk"))) return HDGaussian_AkBQDk_;
304 if (toUpperString(type) == toUpperString(_T("HDGaussian_AkBQD"))) return HDGaussian_AkBQD_;
305 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjBkQkDk"))) return HDGaussian_AjBkQkDk_;
306 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjBkQkD"))) return HDGaussian_AjBkQkD_;
307 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjBkQDk"))) return HDGaussian_AjBkQDk_;
308 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjBkQD"))) return HDGaussian_AjBkQD_;
309 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjBQkDk"))) return HDGaussian_AjBQkDk_;
310 if (toUpperString(type) == toUpperString(_T("HDGaussian_AjBQkD"))) return HDGaussian_AjBQkD_;
311 if (toUpperString(type) == toUpperString(_T("HDGaussian_ABkQkDk"))) return HDGaussian_ABkQkDk_;
312 if (toUpperString(type) == toUpperString(_T("HDGaussian_ABkQkD"))) return HDGaussian_ABkQkD_;
313 if (toUpperString(type) == toUpperString(_T("HDGaussian_ABkQDk"))) return HDGaussian_ABkQDk_;
314 if (toUpperString(type) == toUpperString(_T("HDGaussian_ABkQD"))) return HDGaussian_ABkQD_;
315 if (toUpperString(type) == toUpperString(_T("HDGaussian_ABQkDk"))) return HDGaussian_ABQkDk_;
316 if (toUpperString(type) == toUpperString(_T("HDGaussian_ABQkD"))) return HDGaussian_ABQkD_;
317 if (toUpperString(type) == toUpperString(_T("HDGaussian_ABQD"))) return HDGaussian_ABQD_;
318 // try second naming sheme
319 bool freeProp;
321#ifdef STK_MIXTURE_DEBUG
322 if (res == unknown_mixture_)
323 { stk_cout << _T("In stringToMixture, mixture ") << type << _T(" not found.\n");}
324#endif
325 return res;
326}
327/* @ingroup Clustering
328 * convert a String to an Mixture.
329 * @param type the String we want to convert
330 * @return the Mixture represented by the String @c type. if the string
331 * does not match any known name, the @c unknown_mixture_ type is returned.
332 **/
334{
335 freeProp = false;
336 if (toUpperString(type) == toUpperString(_T("Gamma_p_ajk_bjk"))) return Gamma_ajk_bjk_;
337 if (toUpperString(type) == toUpperString(_T("Gamma_p_ajk_bk"))) return Gamma_ajk_bk_;
338 if (toUpperString(type) == toUpperString(_T("Gamma_p_ajk_bj"))) return Gamma_ajk_bj_;
339 if (toUpperString(type) == toUpperString(_T("Gamma_p_ajk_b"))) return Gamma_ajk_b_;
340 if (toUpperString(type) == toUpperString(_T("Gamma_p_ak_bjk"))) return Gamma_ak_bjk_;
341 if (toUpperString(type) == toUpperString(_T("Gamma_p_ak_bk"))) return Gamma_ak_bk_;
342 if (toUpperString(type) == toUpperString(_T("Gamma_p_ak_bj"))) return Gamma_ak_bj_;
343 if (toUpperString(type) == toUpperString(_T("Gamma_p_ak_b"))) return Gamma_ak_b_;
344 if (toUpperString(type) == toUpperString(_T("Gamma_p_aj_bjk"))) return Gamma_aj_bjk_;
345 if (toUpperString(type) == toUpperString(_T("Gamma_p_aj_bk"))) return Gamma_aj_bk_;
346 if (toUpperString(type) == toUpperString(_T("Gamma_p_a_bjk"))) return Gamma_a_bjk_;
347 if (toUpperString(type) == toUpperString(_T("Gamma_p_a_bk"))) return Gamma_a_bk_;
348 if (toUpperString(type) == toUpperString(_T("Gaussian_p_sjk"))) return Gaussian_sjk_;
349 if (toUpperString(type) == toUpperString(_T("Gaussian_p_sk"))) return Gaussian_sk_;
350 if (toUpperString(type) == toUpperString(_T("Gaussian_p_sj"))) return Gaussian_sj_;
351 if (toUpperString(type) == toUpperString(_T("Gaussian_p_s"))) return Gaussian_s_;
352 if (toUpperString(type) == toUpperString(_T("Gaussian_p_sjsk"))) return Gaussian_sjsk_;
353 if (toUpperString(type) == toUpperString(_T("Categorical_p_pjk"))) return Categorical_pjk_;
354 if (toUpperString(type) == toUpperString(_T("Categorical_p_pk"))) return Categorical_pk_;
355 if (toUpperString(type) == toUpperString(_T("Poisson_p_ljk"))) return Poisson_ljk_;
356 if (toUpperString(type) == toUpperString(_T("Poisson_p_lk"))) return Poisson_lk_;
357 if (toUpperString(type) == toUpperString(_T("Poisson_p_ljlk"))) return Poisson_ljlk_;
358 if (toUpperString(type) == toUpperString(_T("Kmm_p_sk"))) return Kmm_sk_;
359 if (toUpperString(type) == toUpperString(_T("Kmm_p_s"))) return Kmm_s_;
360 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjkBkQkDk"))) return HDGaussian_AjkBkQkDk_;
361 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjkBkQkD"))) return HDGaussian_AjkBkQkD_;
362 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjkBkQDk"))) return HDGaussian_AjkBkQDk_;
363 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjkBkQD"))) return HDGaussian_AjkBkQD_;
364 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjkBQkDk"))) return HDGaussian_AjkBQkDk_;
365 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjkBQkD"))) return HDGaussian_AjkBQkD_;
366 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjkBQDk"))) return HDGaussian_AjkBQDk_;
367 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjkBQD"))) return HDGaussian_AjkBQD_;
368 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AkBkQkDk"))) return HDGaussian_AkBkQkDk_;
369 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AkBkQkD"))) return HDGaussian_AkBkQkD_;
370 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AkBkQDk"))) return HDGaussian_AkBkQDk_;
371 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AkBkQD"))) return HDGaussian_AkBkQD_;
372 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AkBQkDk"))) return HDGaussian_AkBQkDk_;
373 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AkBQkD"))) return HDGaussian_AkBQkD_;
374 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AkBQDk"))) return HDGaussian_AkBQDk_;
375 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AkBQD"))) return HDGaussian_AkBQD_;
376 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjBkQkDk"))) return HDGaussian_AjBkQkDk_;
377 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjBkQkD"))) return HDGaussian_AjBkQkD_;
378 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjBkQDk"))) return HDGaussian_AjBkQDk_;
379 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjBkQD"))) return HDGaussian_AjBkQD_;
380 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjBQkDk"))) return HDGaussian_AjBQkDk_;
381 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_AjBQkD"))) return HDGaussian_AjBQkD_;
382 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_ABkQkDk"))) return HDGaussian_ABkQkDk_;
383 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_ABkQkD"))) return HDGaussian_ABkQkD_;
384 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_ABkQDk"))) return HDGaussian_ABkQDk_;
385 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_ABkQD"))) return HDGaussian_ABkQD_;
386 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_ABQkDk"))) return HDGaussian_ABQkDk_;
387 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_ABQkD"))) return HDGaussian_ABQkD_;
388 if (toUpperString(type) == toUpperString(_T("HDGaussian_p_ABQD"))) return HDGaussian_ABQD_;
389 freeProp = true;
390 if (toUpperString(type) == toUpperString(_T("Gamma_pk_ajk_bjk"))) return Gamma_ajk_bjk_;
391 if (toUpperString(type) == toUpperString(_T("Gamma_pk_ajk_bk"))) return Gamma_ajk_bk_;
392 if (toUpperString(type) == toUpperString(_T("Gamma_pk_ajk_bj"))) return Gamma_ajk_bj_;
393 if (toUpperString(type) == toUpperString(_T("Gamma_pk_ajk_b"))) return Gamma_ajk_b_;
394 if (toUpperString(type) == toUpperString(_T("Gamma_pk_ak_bjk"))) return Gamma_ak_bjk_;
395 if (toUpperString(type) == toUpperString(_T("Gamma_pk_ak_bk"))) return Gamma_ak_bk_;
396 if (toUpperString(type) == toUpperString(_T("Gamma_pk_ak_bj"))) return Gamma_ak_bj_;
397 if (toUpperString(type) == toUpperString(_T("Gamma_pk_ak_b"))) return Gamma_ak_b_;
398 if (toUpperString(type) == toUpperString(_T("Gamma_pk_aj_bjk"))) return Gamma_aj_bjk_;
399 if (toUpperString(type) == toUpperString(_T("Gamma_pk_aj_bk"))) return Gamma_aj_bk_;
400 if (toUpperString(type) == toUpperString(_T("Gamma_pk_a_bjk"))) return Gamma_a_bjk_;
401 if (toUpperString(type) == toUpperString(_T("Gamma_pk_a_bk"))) return Gamma_a_bk_;
402 if (toUpperString(type) == toUpperString(_T("Gaussian_pk_sjk"))) return Gaussian_sjk_;
403 if (toUpperString(type) == toUpperString(_T("Gaussian_pk_sk"))) return Gaussian_sk_;
404 if (toUpperString(type) == toUpperString(_T("Gaussian_pk_sj"))) return Gaussian_sj_;
405 if (toUpperString(type) == toUpperString(_T("Gaussian_pk_s"))) return Gaussian_s_;
406 if (toUpperString(type) == toUpperString(_T("Categorical_pk_pjk"))) return Categorical_pjk_;
407 if (toUpperString(type) == toUpperString(_T("Categorical_pk_pk"))) return Categorical_pk_;
408 if (toUpperString(type) == toUpperString(_T("Poisson_pk_ljk"))) return Poisson_ljk_;
409 if (toUpperString(type) == toUpperString(_T("Poisson_pk_lk"))) return Poisson_lk_;
410 if (toUpperString(type) == toUpperString(_T("Poisson_pk_ljlk"))) return Poisson_ljlk_;
411 if (toUpperString(type) == toUpperString(_T("Kmm_pk_sk"))) return Kmm_sk_;
412 if (toUpperString(type) == toUpperString(_T("Kmm_pk_s"))) return Kmm_s_;
413 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjkBkQkDk"))) return HDGaussian_AjkBkQkDk_;
414 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjkBkQkD"))) return HDGaussian_AjkBkQkD_;
415 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjkBkQDk"))) return HDGaussian_AjkBkQDk_;
416 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjkBkQD"))) return HDGaussian_AjkBkQD_;
417 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjkBQkDk"))) return HDGaussian_AjkBQkDk_;
418 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjkBQkD"))) return HDGaussian_AjkBQkD_;
419 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjkBQDk"))) return HDGaussian_AjkBQDk_;
420 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjkBQD"))) return HDGaussian_AjkBQD_;
421 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AkBkQkDk"))) return HDGaussian_AkBkQkDk_;
422 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AkBkQkD"))) return HDGaussian_AkBkQkD_;
423 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AkBkQDk"))) return HDGaussian_AkBkQDk_;
424 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AkBkQD"))) return HDGaussian_AkBkQD_;
425 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AkBQkDk"))) return HDGaussian_AkBQkDk_;
426 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AkBQkD"))) return HDGaussian_AkBQkD_;
427 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AkBQDk"))) return HDGaussian_AkBQDk_;
428 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AkBQD"))) return HDGaussian_AkBQD_;
429 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjBkQkDk"))) return HDGaussian_AjBkQkDk_;
430 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjBkQkD"))) return HDGaussian_AjBkQkD_;
431 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjBkQDk"))) return HDGaussian_AjBkQDk_;
432 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjBkQD"))) return HDGaussian_AjBkQD_;
433 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjBQkDk"))) return HDGaussian_AjBQkDk_;
434 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_AjBQkD"))) return HDGaussian_AjBQkD_;
435 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_ABkQkDk"))) return HDGaussian_ABkQkDk_;
436 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_ABkQkD"))) return HDGaussian_ABkQkD_;
437 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_ABkQDk"))) return HDGaussian_ABkQDk_;
438 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_ABkQD"))) return HDGaussian_ABkQD_;
439 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_ABQkDk"))) return HDGaussian_ABQkDk_;
440 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_ABQkD"))) return HDGaussian_ABQkD_;
441 if (toUpperString(type) == toUpperString(_T("HDGaussian_pk_ABQD"))) return HDGaussian_ABQD_;
442#ifdef STK_MIXTURE_DEBUG
443 stk_cout << _T("In stringToMixture, mixture ") << type << _T(" not found.\n");
444#endif
445 return unknown_mixture_;
446}
447
448/* @ingroup Clustering
449 * convert a Mixture to a String.
450 * @param type the type of Mixture we want to convert
451 * @return the string associated to this type.
452 **/
454{
455 if (type == Gamma_ajk_bjk_) return String(_T("Gamma_ajk_bjk"));
456 if (type == Gamma_ajk_bk_) return String(_T("Gamma_ajk_bk"));
457 if (type == Gamma_ajk_bj_) return String(_T("Gamma_ajk_bj"));
458 if (type == Gamma_ajk_b_) return String(_T("Gamma_ajk_b"));
459 if (type == Gamma_ak_bjk_) return String(_T("Gamma_ak_bjk"));
460 if (type == Gamma_ak_bk_) return String(_T("Gamma_ak_bk"));
461 if (type == Gamma_ak_bj_) return String(_T("Gamma_ak_bj"));
462 if (type == Gamma_ak_b_) return String(_T("Gamma_ak_b"));
463 if (type == Gamma_aj_bjk_) return String(_T("Gamma_aj_bjk"));
464 if (type == Gamma_aj_bk_) return String(_T("Gamma_aj_bk"));
465 if (type == Gamma_a_bjk_) return String(_T("Gamma_a_bjk"));
466 if (type == Gamma_a_bk_) return String(_T("Gamma_a_bk"));
467 if (type == Gaussian_sjk_) return String(_T("Gaussian_sjk"));
468 if (type == Gaussian_sk_) return String(_T("Gaussian_sk"));
469 if (type == Gaussian_sj_) return String(_T("Gaussian_sj"));
470 if (type == Gaussian_s_) return String(_T("Gaussian_s"));
471 if (type == Gaussian_sjsk_) return String(_T("Gaussian_sjsk"));
472 if (type == Categorical_pjk_) return String(_T("Categorical_pjk"));
473 if (type == Categorical_pk_) return String(_T("Categorical_pk"));
474 if (type == Poisson_ljk_) return String(_T("Poisson_ljk"));
475 if (type == Poisson_lk_) return String(_T("Poisson_lk"));
476 if (type == Poisson_ljlk_) return String(_T("Poisson_ljlk"));
477 if (type == Kmm_sk_) return String(_T("Kmm_sk"));
478 if (type == Kmm_s_) return String(_T("Kmm_s"));
479 if (type == HDGaussian_AjkBkQkDk_) return String(_T("HDGaussian_AjkBkQkDk"));
480 if (type == HDGaussian_AjkBkQkD_) return String(_T("HDGaussian_AjkBkQkD"));
481 if (type == HDGaussian_AjkBkQDk_) return String(_T("HDGaussian_AjkBkQDk"));
482 if (type == HDGaussian_AjkBkQD_) return String(_T("HDGaussian_AjkBkQD"));
483 if (type == HDGaussian_AjkBQkDk_) return String(_T("HDGaussian_AjkBQkDk"));
484 if (type == HDGaussian_AjkBQkD_) return String(_T("HDGaussian_AjkBQkD"));
485 if (type == HDGaussian_AjkBQDk_) return String(_T("HDGaussian_AjkBQDk"));
486 if (type == HDGaussian_AjkBQD_) return String(_T("HDGaussian_AjkBQD"));
487 if (type == HDGaussian_AkBkQkDk_) return String(_T("HDGaussian_AkBkQkDk"));
488 if (type == HDGaussian_AkBkQkD_) return String(_T("HDGaussian_AkBkQkD"));
489 if (type == HDGaussian_AkBkQDk_) return String(_T("HDGaussian_AkBkQDk"));
490 if (type == HDGaussian_AkBkQD_) return String(_T("HDGaussian_AkBkQD"));
491 if (type == HDGaussian_AkBQkDk_) return String(_T("HDGaussian_AkBQkDk"));
492 if (type == HDGaussian_AkBQkD_) return String(_T("HDGaussian_AkBQkD"));
493 if (type == HDGaussian_AkBQDk_) return String(_T("HDGaussian_AkBQDk"));
494 if (type == HDGaussian_AkBQD_) return String(_T("HDGaussian_AkBQD"));
495 if (type == HDGaussian_AjBkQkDk_) return String(_T("HDGaussian_AjBkQkDk"));
496 if (type == HDGaussian_AjBkQkD_) return String(_T("HDGaussian_AjBkQkD"));
497 if (type == HDGaussian_AjBkQDk_) return String(_T("HDGaussian_AjBkQDk"));
498 if (type == HDGaussian_AjBkQD_) return String(_T("HDGaussian_AjBkQD"));
499 if (type == HDGaussian_AjBQkDk_) return String(_T("HDGaussian_AjBQkDk"));
500 if (type == HDGaussian_AjBQkD_) return String(_T("HDGaussian_AjBQkD"));
501 if (type == HDGaussian_ABkQkDk_) return String(_T("HDGaussian_ABkQkDk"));
502 if (type == HDGaussian_ABkQkD_) return String(_T("HDGaussian_ABkQkD"));
503 if (type == HDGaussian_ABkQDk_) return String(_T("HDGaussian_ABkQDk"));
504 if (type == HDGaussian_ABkQD_) return String(_T("HDGaussian_ABkQD"));
505 if (type == HDGaussian_ABQkDk_) return String(_T("HDGaussian_ABQkDk"));
506 if (type == HDGaussian_ABQkD_) return String(_T("HDGaussian_ABQkD"));
507 if (type == HDGaussian_ABQD_) return String(_T("HDGaussian_ABQD"));
508 return String(_T("unknown"));
509}
510
511/* @ingroup Clustering
512 * convert a Mixture to a string specifying if the model is with free
513 * proportions.
514 * @sa stringToMixture
515 * @param type the Mixture we want to convert
516 * @param freeProp @c true if the model have free proportions, @c false otherwise.
517 * @return the string represented by the Mixture @c type.
518 **/
520{
521 if (freeProp == false)
522 {
523 if (type == Gamma_ajk_bjk_) return String(_T("Gamma_p_ajk_bjk"));
524 if (type == Gamma_ajk_bk_) return String(_T("Gamma_p_ajk_bk"));
525 if (type == Gamma_ajk_bj_) return String(_T("Gamma_p_ajk_bj"));
526 if (type == Gamma_ajk_b_) return String(_T("Gamma_p_ajk_b"));
527 if (type == Gamma_ak_bjk_) return String(_T("Gamma_p_ak_bjk"));
528 if (type == Gamma_ak_bk_) return String(_T("Gamma_p_ak_bk"));
529 if (type == Gamma_ak_bj_) return String(_T("Gamma_p_ak_bj"));
530 if (type == Gamma_ak_b_) return String(_T("Gamma_p_ak_b"));
531 if (type == Gamma_aj_bjk_) return String(_T("Gamma_p_aj_bjk"));
532 if (type == Gamma_aj_bk_) return String(_T("Gamma_p_aj_bk"));
533 if (type == Gamma_a_bjk_) return String(_T("Gamma_p_a_bjk"));
534 if (type == Gamma_a_bk_) return String(_T("Gamma_p_a_bk"));
535 if (type == Gaussian_sjk_) return String(_T("Gaussian_p_sjk"));
536 if (type == Gaussian_sk_) return String(_T("Gaussian_p_sk"));
537 if (type == Gaussian_sj_) return String(_T("Gaussian_p_sj"));
538 if (type == Gaussian_s_) return String(_T("Gaussian_p_s"));
539 if (type == Gaussian_sjsk_) return String(_T("Gaussian_p_sjsk"));
540 if (type == Categorical_pjk_) return String(_T("Categorical_p_pjk"));
541 if (type == Categorical_pk_) return String(_T("Categorical_p_pk"));
542 if (type == Poisson_ljk_) return String(_T("Poisson_p_ljk"));
543 if (type == Poisson_lk_) return String(_T("Poisson_p_lk"));
544 if (type == Poisson_ljlk_) return String(_T("Poisson_p_ljlk"));
545 if (type == Poisson_ljlk_) return String(_T("Poisson_p_ljlk"));
546 if (type == Kmm_sk_) return String(_T("Kmm_p_sk"));
547 if (type == Kmm_s_) return String(_T("Kmm_p_s"));
548 if (type == HDGaussian_AjkBkQkDk_) return String(_T("HDGaussian_p_AjkBkQkDk"));
549 if (type == HDGaussian_AjkBkQkD_) return String(_T("HDGaussian_p_AjkBkQkD"));
550 if (type == HDGaussian_AjkBkQDk_) return String(_T("HDGaussian_p_AjkBkQDk"));
551 if (type == HDGaussian_AjkBkQD_) return String(_T("HDGaussian_p_AjkBkQD"));
552 if (type == HDGaussian_AjkBQkDk_) return String(_T("HDGaussian_p_AjkBQkDk"));
553 if (type == HDGaussian_AjkBQkD_) return String(_T("HDGaussian_p_AjkBQkD"));
554 if (type == HDGaussian_AjkBQDk_) return String(_T("HDGaussian_p_AjkBQDk"));
555 if (type == HDGaussian_AjkBQD_) return String(_T("HDGaussian_p_AjkBQD"));
556 if (type == HDGaussian_AkBkQkDk_) return String(_T("HDGaussian_p_AkBkQkDk"));
557 if (type == HDGaussian_AkBkQkD_) return String(_T("HDGaussian_p_AkBkQkD"));
558 if (type == HDGaussian_AkBkQDk_) return String(_T("HDGaussian_p_AkBkQDk"));
559 if (type == HDGaussian_AkBkQD_) return String(_T("HDGaussian_p_AkBkQD"));
560 if (type == HDGaussian_AkBQkDk_) return String(_T("HDGaussian_p_AkBQkDk"));
561 if (type == HDGaussian_AkBQkD_) return String(_T("HDGaussian_p_AkBQkD"));
562 if (type == HDGaussian_AkBQDk_) return String(_T("HDGaussian_p_AkBQDk"));
563 if (type == HDGaussian_AkBQD_) return String(_T("HDGaussian_p_AkBQD"));
564 if (type == HDGaussian_AjBkQkDk_) return String(_T("HDGaussian_p_AjBkQkDk"));
565 if (type == HDGaussian_AjBkQkD_) return String(_T("HDGaussian_p_AjBkQkD"));
566 if (type == HDGaussian_AjBkQDk_) return String(_T("HDGaussian_p_AjBkQDk"));
567 if (type == HDGaussian_AjBkQD_) return String(_T("HDGaussian_p_AjBkQD"));
568 if (type == HDGaussian_AjBQkDk_) return String(_T("HDGaussian_p_AjBQkDk"));
569 if (type == HDGaussian_AjBQkD_) return String(_T("HDGaussian_p_AjBQkD"));
570 if (type == HDGaussian_ABkQkDk_) return String(_T("HDGaussian_p_ABkQkDk"));
571 if (type == HDGaussian_ABkQkD_) return String(_T("HDGaussian_p_ABkQkD"));
572 if (type == HDGaussian_ABkQDk_) return String(_T("HDGaussian_p_ABkQDk"));
573 if (type == HDGaussian_ABkQD_) return String(_T("HDGaussian_p_ABkQD"));
574 if (type == HDGaussian_ABQkDk_) return String(_T("HDGaussian_p_ABQkDk"));
575 if (type == HDGaussian_ABQkD_) return String(_T("HDGaussian_p_ABQkD"));
576 if (type == HDGaussian_ABQD_) return String(_T("HDGaussian_p_ABQD"));
577 }
578 else
579 {
580 if (type == Gamma_ajk_bjk_) return String(_T("Gamma_pk_ajk_bjk"));
581 if (type == Gamma_ajk_bk_) return String(_T("Gamma_pk_ajk_bk"));
582 if (type == Gamma_ajk_bj_) return String(_T("Gamma_pk_ajk_bj"));
583 if (type == Gamma_ajk_b_) return String(_T("Gamma_pk_ajk_b"));
584 if (type == Gamma_ak_bjk_) return String(_T("Gamma_pk_ak_bjk"));
585 if (type == Gamma_ak_bk_) return String(_T("Gamma_pk_ak_bk"));
586 if (type == Gamma_ak_bj_) return String(_T("Gamma_pk_ak_bj"));
587 if (type == Gamma_ak_b_) return String(_T("Gamma_pk_ak_b"));
588 if (type == Gamma_aj_bjk_) return String(_T("Gamma_pk_aj_bjk"));
589 if (type == Gamma_aj_bk_) return String(_T("Gamma_pk_aj_bk"));
590 if (type == Gamma_a_bjk_) return String(_T("Gamma_pk_a_bjk"));
591 if (type == Gamma_a_bk_) return String(_T("Gamma_pk_a_bk"));
592 if (type == Gaussian_sjk_) return String(_T("Gaussian_pk_sjk"));
593 if (type == Gaussian_sk_) return String(_T("Gaussian_pk_sk"));
594 if (type == Gaussian_sj_) return String(_T("Gaussian_pk_sj"));
595 if (type == Gaussian_s_) return String(_T("Gaussian_pk_s"));
596 if (type == Gaussian_sjsk_) return String(_T("Gaussian_pk_sjsk"));
597 if (type == Categorical_pjk_) return String(_T("Categorical_pk_pjk"));
598 if (type == Categorical_pk_) return String(_T("Categorical_pk_pk"));
599 if (type == Poisson_ljk_) return String(_T("Poisson_pk_ljk"));
600 if (type == Poisson_lk_) return String(_T("Poisson_pk_lk"));
601 if (type == Poisson_ljlk_) return String(_T("Poisson_pk_ljlk"));
602 if (type == Kmm_sk_) return String(_T("Kmm_pk_sk"));
603 if (type == Kmm_s_) return String(_T("Kmm_pk_s"));
604 if (type == HDGaussian_AjkBkQkDk_) return String(_T("HDGaussian_pk_AjkBkQkDk"));
605 if (type == HDGaussian_AjkBkQkD_) return String(_T("HDGaussian_pk_AjkBkQkD"));
606 if (type == HDGaussian_AjkBkQDk_) return String(_T("HDGaussian_pk_AjkBkQDk"));
607 if (type == HDGaussian_AjkBkQD_) return String(_T("HDGaussian_pk_AjkBkQD"));
608 if (type == HDGaussian_AjkBQkDk_) return String(_T("HDGaussian_pk_AjkBQkDk"));
609 if (type == HDGaussian_AjkBQkD_) return String(_T("HDGaussian_pk_AjkBQkD"));
610 if (type == HDGaussian_AjkBQDk_) return String(_T("HDGaussian_pk_AjkBQDk"));
611 if (type == HDGaussian_AjkBQD_) return String(_T("HDGaussian_pk_AjkBQD"));
612 if (type == HDGaussian_AkBkQkDk_) return String(_T("HDGaussian_pk_AkBkQkDk"));
613 if (type == HDGaussian_AkBkQkD_) return String(_T("HDGaussian_pk_AkBkQkD"));
614 if (type == HDGaussian_AkBkQDk_) return String(_T("HDGaussian_pk_AkBkQDk"));
615 if (type == HDGaussian_AkBkQD_) return String(_T("HDGaussian_pk_AkBkQD"));
616 if (type == HDGaussian_AkBQkDk_) return String(_T("HDGaussian_pk_AkBQkDk"));
617 if (type == HDGaussian_AkBQkD_) return String(_T("HDGaussian_pk_AkBQkD"));
618 if (type == HDGaussian_AkBQDk_) return String(_T("HDGaussian_pk_AkBQDk"));
619 if (type == HDGaussian_AkBQD_) return String(_T("HDGaussian_pk_AkBQD"));
620 if (type == HDGaussian_AjBkQkDk_) return String(_T("HDGaussian_pk_AjBkQkDk"));
621 if (type == HDGaussian_AjBkQkD_) return String(_T("HDGaussian_pk_AjBkQkD"));
622 if (type == HDGaussian_AjBkQDk_) return String(_T("HDGaussian_pk_AjBkQDk"));
623 if (type == HDGaussian_AjBkQD_) return String(_T("HDGaussian_pk_AjBkQD"));
624 if (type == HDGaussian_AjBQkDk_) return String(_T("HDGaussian_pk_AjBQkDk"));
625 if (type == HDGaussian_AjBQkD_) return String(_T("HDGaussian_pk_AjBQkD"));
626 if (type == HDGaussian_ABkQkDk_) return String(_T("HDGaussian_pk_ABkQkDk"));
627 if (type == HDGaussian_ABkQkD_) return String(_T("HDGaussian_pk_ABkQkD"));
628 if (type == HDGaussian_ABkQDk_) return String(_T("HDGaussian_pk_ABkQDk"));
629 if (type == HDGaussian_ABkQD_) return String(_T("HDGaussian_pk_ABkQD"));
630 if (type == HDGaussian_ABQkDk_) return String(_T("HDGaussian_pk_ABQkDk"));
631 if (type == HDGaussian_ABQkD_) return String(_T("HDGaussian_pk_ABQkD"));
632 if (type == HDGaussian_ABQD_) return String(_T("HDGaussian_pk_ABQD"));
633 }
634 return String(_T("unknown"));
635}
636
638{
640 switch (type)
641 {
642 case aic_:
644 break;
645 case bic_:
647 break;
648 case icl_:
650 break;
651 case ml_:
653 break;
654 }
655 return p_criter;
656}
657
658/* @return a pointer on the class computing the criterion */
664
665/* utility function for creating an estimation algorithm
666 * @param algo the algorithm to create
667 * @param nbIterMax the maximal number of iteration of the algorithm
668 * @param epsilon the tolerance of the algorithm
669 **/
671{
672 IMixtureAlgo* p_algo = 0;
673 switch (algo)
674 {
675 case emAlgo_:
676 p_algo = new EMAlgo();
677 break;
678 case cemAlgo_:
679 p_algo = new CEMAlgo();
680 break;
681 case semAlgo_:
682 p_algo = new SEMAlgo();
683 break;
684 case semiSemAlgo_:
685 p_algo = new SemiSEMAlgo();
686 break;
687 default:
688 break;
689 }
690 if (p_algo)
691 {
692 p_algo->setNbIterMax(nbIterMax);
693 p_algo->setEpsilon(epsilon);
694 }
695 return p_algo;
696}
697
698/* utility function for creating an estimation algorithm
699 * @param algo the algorithm to create
700 * @param nbIterMax the maximal number of iteration of the algorithm
701 * @param epsilon the tolerance of the algorithm
702 **/
704{
706 switch (algo)
707 {
708 case imputeAlgo_:
709 p_algo = new ImputeAlgo();
710 break;
711 case simulAlgo_:
712 p_algo = new SimulAlgo();
713 break;
714 default:
715 break;
716 }
717 if (p_algo)
718 {
719 p_algo->setNbIterMax(nbIterMax);
720 p_algo->setEpsilon(epsilon);
721 }
722 return p_algo;
723}
724
725/* utility function for creating an estimation algorithm
726 * @param algo the algorithm to create
727 * @param nbIterMax the maximal number of iteration of the algorithm
728 * @param epsilon the tolerance of the algorithm
729 **/
731{
733 switch (algo)
734 {
735 case emPredictAlgo_:
736 p_algo = new EMPredict();
737 break;
739 p_algo = new SemiSEMPredict();
740 break;
741 default:
742 break;
743 }
744 if (p_algo)
745 {
746 p_algo->setNbIterBurn(nbIterBurn);
747 p_algo->setNbIterLong(nbIterLong);
748 p_algo->setEpsilon(epsilon);
749 }
750 return p_algo;
751}
752
753/* utility function for creating a model initializer
754 * @param init the kind of initializer to create
755 * @param algo the kind of algorithm to add to the initializer
756 * @param nbIterMax the maximal number of iteration of the algorithm
757 * @param epsilon the tolerance of the algorithm
758 **/
760{
761 IMixtureInit* p_init = 0;
762 switch (init)
763 {
764 case Clust::noInit_:
765 p_init = 0;
766 break;
768 p_init = new RandomInit();
769 break;
771 p_init = new RandomInit();
772 break;
774 p_init = new ClassInit();
775 break;
777 p_init = new FuzzyInit();
778 break;
779 default:
780 break;
781 }
782 if (p_init)
783 {
784 p_init->setNbTry(nbInits);
785 p_init->setInitAlgo(Clust::createAlgo(algo, nbIterMax, epsilon));
786 }
787 return p_init;
788}
789
790/* @ingroup Clustering
791 * Utility function for creating a SimpleStrategy.
792 * @param nbTry the number of tries.
793 * @param p_init the initializer to use.
794 * @param algo the algorithm to use in the long run.
795 * @return an instance of the SimpleStrategy
796 **/
798 , int nbTry
799 , IMixtureInit* const& p_init
800 , IMixtureAlgo* const& algo)
801{
803 p_strategyParam->p_algo_ = algo;
804 SimpleStrategy* p_strategy = new SimpleStrategy(p_composer);
805 p_strategy->setNbTry(nbTry);
806 p_strategy->setMixtureInit(p_init);
807 p_strategy->setParam(p_strategyParam);
808 return p_strategy;
809}
810
811
812/* @ingroup Clustering
813 * Utility function for creating a FullStrategy.
814 * @param nbTry the number of tries.
815 * @param p_init the initializer to use.
816 * @param nbShortRun the number of shortRun.
817 * @param shortRunAlgo the algorithm to use in the short run.
818 * @param longRunAlgo the algorithm to use in the long run.
819 * @return an instance of the SimpleStrategy
820 **/
822 , int nbTry, int nbInitRun
823 , IMixtureInit* const& p_init
825 , IMixtureAlgo* const& longRunAlgo)
826{
828 p_strategyParam->nbInitRun_ = nbInitRun;
829 p_strategyParam->nbShortRun_ = nbShortRun;
830 p_strategyParam->p_shortAlgo_ = shortRunAlgo;
831 p_strategyParam->p_longAlgo_ = longRunAlgo;
832 FullStrategy* p_strategy = new FullStrategy(p_composer);
833 p_strategy->setNbTry(nbTry);
834 p_strategy->setMixtureInit(p_init);
835 p_strategy->setParam(p_strategyParam);
836 return p_strategy;
837}
838
839} // namespace Clust
840
841} // namespace STK
842
843
In this file we define the abstract base class for mixture models.
In this file we define learning mixture algorithms.
In this file we define algorithms for predicting in a mixture model.
In this file we define mixture algorithms.
In this file we define the classes for computing the penalized criterion on mixture models.
In this file we define the interface base class for initialization methods.
In this file we define the strategies to use in order to estimate a mixture model.
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
Derived class of Criterion for computing the AIC Criterion The AIC criteria of a given model M is a p...
Derived class of Criterion for computing the BIC Criterion The Bic criteria of a model M is a penaliz...
Implementation of the SEM algorithm.
Initialization by simulating a realization of the class labels zi accordingly to the initial proporti...
Implementation of the EM algorithm.
Implementation of the EMPredict algorithm.
A FullStrategy is based on the following paradigm:
Initialization by simulating the tik accordingly to the initial proportions.
Derived class of IMixtureCriterion for computing the ICL Criterion The ICL criteria of a model M is a...
Interface base class for the learning algorithms.
Interface base class for predicting algorithms.
Interface base class for the algorithms.
Base class for Mixture (composed) model.
Interface base class for the selection model criterion.
Interface base class for the initializations.
Interface base class for all the strategies.
Implementation of the ImputeAlgo learning algorithm.
Derived class of Criterion for computing the Maximum Likelihood Criterion This criterion does not pen...
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
Implementation of the random initialization.
Implementation of the SEM algorithm.
Implementation of the SemiSEM algorithm.
Implementation of the SemiSEMPredict algorithm.
A SimpleStrategy is just nbTry long run.
Implementation of the SimulAlgo learning algorithm.
String const & toUpperString(String &s)
convert the characters of the String to upper case
Definition STK_String.h:134
algoPredictType
Learning estimation algorithms.
initType
initialization type.
algoType
Estimation algorithms.
MixtureClass
list of the class of mixture implemented in stkpp
algoType stringToAlgo(String const &type)
Convert a String to an algoType.
initType stringToInit(String const &type)
Convert a String to a initType.
MixtureClass mixtureToMixtureClass(Mixture const &type)
convert a Mixture to a MixtureClass.
algoLearnType
Learning estimation algorithms.
IMixtureInit * createInit(Clust::initType init=defaultInitType, int nbInits=defaultNbInit, Clust::algoType algo=defaultAlgoInInit, int nbIterMax=defaultNbIterMaxInInit, Real epsilon=defaultEpsilonInInit)
Utility function for creating a model initializer.
IMixtureAlgo * createAlgo(Clust::algoType algo, int nbIterMax, Real epsilon)
utility function for creating an estimation algorithm.
algoPredictType stringToPredictAlgo(String const &type)
Convert a String to an algoPredictType.
IMixtureStrategy * createSimpleStrategy(IMixtureComposer *&p_composer, int nbTry, IMixtureInit *const &p_init, IMixtureAlgo *const &algo)
Utility function for creating a SimpleStrategy.
IMixtureCriterion * createCriterion(Clust::criterionType criterion)
criterionType stringToCriterion(String const &type)
Convert a String to an criterionType.
Mixture stringToMixture(String const &type)
Convert a String to a Mixture.
String mixtureToString(Mixture const &type)
convert a Mixture to a String.
String exceptionToString(exceptions const &type)
convert a Clust::exceptions to a String.
IMixtureAlgoLearn * createLearnAlgo(Clust::algoLearnType algo, int nbIterMax, Real epsilon)
utility function for creating a learning algorithm.
algoLearnType stringToLearnAlgo(String const &type)
Convert a String to an algoLearnType.
exceptions
Specific exceptions allowing to handle the erroros that can occur in the estimation process.
Mixture
list of the mixtures that can be used by the composer
IMixtureStrategy * createFullStrategy(IMixtureComposer *&p_composer, int nbTry, int nbInitRun, IMixtureInit *const &p_init, int nbShortRun, IMixtureAlgo *const &shortRunAlgo, IMixtureAlgo *const &longRunAlgo)
Utility function for creating a FullStrategy.
IMixtureAlgoPredict * createPredictAlgo(Clust::algoPredictType algo, int nbIterBurn, int nbIterLong, Real epsilon)
utility function for creating a predicting algorithm.
criterionType
type of criterion to use in order to select the mixture model
@ randomParamInit_
initialize randomly the parameters
@ randomFuzzyInit_
initialize randomly the partnership class probabilities
@ randomClassInit_
initialize randomly the class labels
@ randomInit_
DEPRECATED.
@ noInit_
no initialization
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.
helper structure encapsulating the parameters of the Full strategy
helper structure encapsulating the parameters of the simple strategy