mixmod  3.2.0
Mixture models for clustering and classification
 All Classes Namespaces Files Functions Variables Enumerations Friends
Util.h File Reference

Constants definitions, various utilities to describe models, and others... More...

#include "mixmod/Utilities/exceptions/Exception.h"
#include "mixmod/Utilities/exceptions/DCVException.h"
#include "mixmod/Utilities/exceptions/DCVonlyInGaussianCaseException.h"
#include "mixmod/Utilities/exceptions/InputException.h"
#include "mixmod/Utilities/exceptions/NumericException.h"
#include "mixmod/Utilities/exceptions/OtherException.h"
#include <vector>
#include <fstream>
#include <string>
#include <cstring>
#include <ctype.h>
#include <stdint.h>
#include <memory>
#include <limits>
#include <sstream>
#include <typeinfo>
#include <assert.h>
#include "mixmod/Utilities/maths/SelectLibrary.h"
Include dependency graph for Util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  XEM::NumericPartitionFile
struct  XEM::TWeightedIndividual
 Structure for chain list of differents sample. More...
struct  XEM::CVBlock
 XEMCVBlock. More...
struct  XEM::TabDeleter< T >
struct  XEM::IfChangedDeleter< T >


 Base class for Label(s)


#define WANT_MATH
#define THROW(Exceptionclass, errortype)   throw Exceptionclass(__FILE__,__LINE__,errortype)


enum  CVinitBlocks { CV_RANDOM = 0, CV_DIAG = 1 }
enum  DCVinitBlocks { DCV_RANDOM = 0, DCV_DIAG = 1 }
enum  XEM::StrategyInitName {
  CEM_INIT = 4, SEM_MAX = 5
 Enumeration of differents strategy initialization.
 Enumeration of differents type of converge of algorithm (stop rule)
enum  XEM::CriterionName {
  UNKNOWN_CRITERION_NAME = -1, BIC = 0, CV = 1, ICL = 2,
  NEC = 3, DCV = 4
 Enumeration of Criterion type.
enum  XEM::AlgoName {
  UNKNOWN_ALGO_NAME = -1, MAP = 0, EM = 1, CEM = 2,
  SEM = 3, M = 4
 Enumeration of Algo type.
enum  FormatNumericFile { txt = 0, hdf5 = 1, XML = 2 }
enum  TypePartition { UNKNOWN_PARTITION = 0, label = 1, partition = 2 }
 type of partition
enum  DataType { QualitativeData = 0, QuantitativeData, HeterogeneousData }
enum  ModelGenre { QualitativeModel = 0, QuantitativeModel, HeterogeneousModel }
enum  XEM::ModelName {
  UNKNOWN_MODEL_NAME = -1, Gaussian_p_L_I = 0, Gaussian_p_Lk_I, Gaussian_pk_L_I,
  Gaussian_pk_Lk_I, Gaussian_p_L_B, Gaussian_p_Lk_B, Gaussian_p_L_Bk,
  Gaussian_p_Lk_Bk, Gaussian_pk_L_B, Gaussian_pk_Lk_B, Gaussian_pk_L_Bk,
  Gaussian_pk_Lk_Bk, Gaussian_p_L_C, Gaussian_p_Lk_C, Gaussian_p_L_D_Ak_D,
  Gaussian_p_Lk_D_Ak_D, Gaussian_p_L_Dk_A_Dk, Gaussian_p_Lk_Dk_A_Dk, Gaussian_p_L_Ck,
  Gaussian_p_Lk_Ck, Gaussian_pk_L_C, Gaussian_pk_Lk_C, Gaussian_pk_L_D_Ak_D,
  Gaussian_pk_Lk_D_Ak_D, Gaussian_pk_L_Dk_A_Dk, Gaussian_pk_Lk_Dk_A_Dk, Gaussian_pk_L_Ck,
  Gaussian_pk_Lk_Ck, Gaussian_HD_p_AkjBkQkDk, Gaussian_HD_p_AkBkQkDk, Gaussian_HD_p_AkjBkQkD,
  Gaussian_HD_p_AjBkQkD, Gaussian_HD_p_AkjBQkD, Gaussian_HD_p_AjBQkD, Gaussian_HD_p_AkBkQkD,
  Gaussian_HD_p_AkBQkD, Gaussian_HD_pk_AkjBkQkDk, Gaussian_HD_pk_AkBkQkDk, Gaussian_HD_pk_AkjBkQkD,
  Gaussian_HD_pk_AjBkQkD, Gaussian_HD_pk_AkjBQkD, Gaussian_HD_pk_AjBQkD, Gaussian_HD_pk_AkBkQkD,
  Gaussian_HD_pk_AkBQkD, Binary_p_E, Binary_p_Ek, Binary_p_Ej,
  Binary_p_Ekj, Binary_p_Ekjh, Binary_pk_E, Binary_pk_Ek,
  Binary_pk_Ej, Binary_pk_Ekj, Binary_pk_Ekjh, Heterogeneous_pk_E_L_B,
  Heterogeneous_pk_E_Lk_B, Heterogeneous_pk_E_L_Bk, Heterogeneous_pk_E_Lk_Bk, Heterogeneous_pk_Ek_L_B,
  Heterogeneous_pk_Ek_Lk_B, Heterogeneous_pk_Ek_L_Bk, Heterogeneous_pk_Ek_Lk_Bk, Heterogeneous_pk_Ej_L_B,
  Heterogeneous_pk_Ej_Lk_B, Heterogeneous_pk_Ej_L_Bk, Heterogeneous_pk_Ej_Lk_Bk, Heterogeneous_pk_Ekj_L_B,
  Heterogeneous_pk_Ekj_Lk_B, Heterogeneous_pk_Ekj_L_Bk, Heterogeneous_pk_Ekj_Lk_Bk, Heterogeneous_pk_Ekjh_L_B,
  Heterogeneous_pk_Ekjh_Lk_B, Heterogeneous_pk_Ekjh_L_Bk, Heterogeneous_pk_Ekjh_Lk_Bk, Heterogeneous_p_E_L_B,
  Heterogeneous_p_E_Lk_B, Heterogeneous_p_E_L_Bk, Heterogeneous_p_E_Lk_Bk, Heterogeneous_p_Ek_L_B,
  Heterogeneous_p_Ek_Lk_B, Heterogeneous_p_Ek_L_Bk, Heterogeneous_p_Ek_Lk_Bk, Heterogeneous_p_Ej_L_B,
  Heterogeneous_p_Ej_Lk_B, Heterogeneous_p_Ej_L_Bk, Heterogeneous_p_Ej_Lk_Bk, Heterogeneous_p_Ekj_L_B,
  Heterogeneous_p_Ekj_Lk_B, Heterogeneous_p_Ekj_L_Bk, Heterogeneous_p_Ekj_Lk_Bk, Heterogeneous_p_Ekjh_L_B,
  Heterogeneous_p_Ekjh_Lk_B, Heterogeneous_p_Ekjh_L_Bk, Heterogeneous_p_Ekjh_Lk_Bk, nbModelName = 54
 Enumeration of model name.
enum  OutputType {
  BICstandardOutput = 0, BICnumericStandardOutput, BIClabelOutput, BICparameterOutput,
  BICtikOutput, BICzikOutput, BIClikelihoodOutput, BICnumericLikelihoodOutput,
  BICErrorOutput = 8, CVstandardOutput, CVnumericStandardOutput, CVlabelOutput,
  CVparameterOutput, CVtikOutput, CVzikOutput, CVlikelihoodOutput,
  CVnumericLikelihoodOutput, CVErrorOutput = 17, ICLstandardOutput, ICLnumericStandardOutput,
  ICLlabelOutput, ICLparameterOutput, ICLtikOutput, ICLzikOutput,
  ICLlikelihoodOutput, ICLnumericLikelihoodOutput, ICLErrorOutput = 26, NECstandardOutput,
  NECnumericStandardOutput, NEClabelOutput, NECparameterOutput, NECtikOutput,
  NECzikOutput, NEClikelihoodOutput, NECnumericLikelihoodOutput, NECErrorOutput = 35,
  DCVstandardOutput, DCVnumericStandardOutput, DCVlabelOutput, DCVparameterOutput,
  DCVtikOutput, DCVzikOutput, DCVlikelihoodOutput, DCVnumericLikelihoodOutput,
  DCVErrorOutput = 44, completeOutput, numericCompleteOutput, CVlabelClassificationOutput,
  errorMixmodOutput, errorModelOutput, DCVinfo, DCVnumericInfo = 51


bool XEM::isKeyword (std::string &name)
double XEM::powAndCheckIfNotNull (double a, double b, const Exception &errorType=NumericException("Defaulter", 0, nullDeterminant))
 compute a^b and throw an error if it's equal to zero
int64_t XEM::Round (double d)
 return the nearest int64_t
void XEM::ConvertBigtoLowString (std::string &str)
 convert big char of a string in low char
std::string XEM::ModelNameToString (const ModelName &modelName)
ModelName XEM::StringToModelName (const std::string &strModelName)
ModelName XEM::getHeterogeneousModelName (const ModelName binaryName, const ModelName gaussianName)
ModelName XEM::getBinaryModelNamefromHeterogeneous (const ModelName HeterogeneousName)
ModelName XEM::getGaussianModelNamefromHeterogeneous (const ModelName HeterogeneousName)
void XEM::edit (const ModelName &modelName)
std::string XEM::CriterionNameToString (const CriterionName &criterionName)
CriterionName XEM::StringtoCriterionName (const std::string &str)
void XEM::edit (const CriterionName &criterionName)
std::string XEM::AlgoNameToString (const AlgoName &typeAlgo)
AlgoName XEM::StringToAlgoName (const std::string &str)
void XEM::edit (const AlgoName &typeAlgo)
std::string XEM::FormatNumericFileToString (const FormatNumeric::FormatNumericFile &formatNumericFile)
FormatNumeric::FormatNumericFile XEM::StringToFormatNumericFile (const std::string &strFormatNumericFile)
std::string XEM::TypePartitionToString (const TypePartition::TypePartition &typePartition)
TypePartition::TypePartition XEM::StringToTypePartition (const std::string &strTypePartition)
std::string XEM::StrategyInitNameToString (const StrategyInitName &strategyInitName)
StrategyInitName XEM::StringToStrategyInitName (const std::string &str)
void XEM::edit (const StrategyInitName &strategyInitName)
std::string XEM::AlgoStopNameToString (const AlgoStopName &algoStopName)
void XEM::edit (const AlgoStopName &algoStopName)
bool XEM::hasFreeProportion (ModelName modelName)
bool XEM::isDiagonal (ModelName modelName)
bool XEM::isSpherical (ModelName modelName)
bool XEM::isGeneral (ModelName modelName)
bool XEM::isEDDA (ModelName modelName)
bool XEM::isHD (ModelName modelName)
bool XEM::isFreeSubDimension (ModelName modelName)
bool XEM::isBinary (ModelName modelName)
bool XEM::isHeterogeneous (ModelName modelname)
ModelGenre XEM::getModelGenre (ModelName name)
template<typename T >
T * XEM::copyTab (T *tab, int64_t dim)
template<typename T >
T ** XEM::copyTab (T **tab, int64_t dim1, int64_t dim2)
template<typename T >
void XEM::recopyTab (T *source, T *destination, int64_t dim)
void XEM::recopyTab (int64_t *source, double *destination, int64_t dim)
void XEM::recopyTabToVector (double **source, std::vector< std::vector< double > > &destination, int64_t dim1, int64_t dim2)
void XEM::recopyTabToVector (int64_t *source, std::vector< int64_t > &destination, int64_t dim1)
void XEM::recopyVectorToTab (std::vector< std::vector< double > > source, double **&destination)
void XEM::recopyVectorToTab (std::vector< int64_t > source, int64_t *&destination)
template<typename T >
void XEM::recopyTab (T **source, T **destination, int64_t dim1, int64_t dim2)
void XEM::editSimpleTab (double *tab, int64_t n, std::ostream &flux, std::string sep=" ", std::string before=" ")
void XEM::editSimpleTab (int64_t *tab, int64_t n, std::ostream &flux)
template<typename T >
void XEM::editTab (T **tab, int64_t dim1, int64_t dim2, std::ostream &flux, std::string sep=" ", std::string before="")
void XEM::moveUntilReach (std::ifstream &fi, std::string what)
void XEM::readTabFileName (std::ifstream &fi, int64_t nbNbCluster, std::string *tabFileName, std::string &keyWord)
void XEM::initToZero (double *tab, int64_t n)
void XEM::echange (double *tab, int64_t i1, int64_t i2)
void XEM::echange (int64_t *tab, int64_t i1, int64_t i2)
void XEM::selectionSortWithOrder (double *tabRandom, int64_t *tabOrder, int64_t left, int64_t right)
int64_t XEM::partition (double *tabRandom, int64_t *tabOrder, int64_t left, int64_t right)
void XEM::quickSortWithOrder (double *tabRandom, int64_t *tabOrder, int64_t left, int64_t right)
int64_t XEM::generateRandomIndex (bool *tabIndividualCanBeUsedForInitRandom, double *weight, double totalWeight)
void XEM::inputCriterion (std::ifstream &fi, CriterionName &criterionName)
void XEM::inputCVinitBlocks (std::ifstream &fi, CVinitBlocks cVinitBlocks)
void XEM::inputDCVinitBlocks (std::ifstream &fi, DCVinitBlocks dCVinitBlocks)


const double XEM::XEMPI = 3.14159265358979323846
 Define PI.
const int XEM::DEBUG = 0
const bool XEM::DATA_REDUCE = false
const bool XEM::VERBOSE = false
const int64_t XEM::maxNbSample = 1000000
 Define number of maximum samples.
const int64_t XEM::maxPbDimension = 10000
const int64_t XEM::minNbIteration = 1
const int64_t XEM::minNbIterationForSEM = 50
const int64_t XEM::maxNbIteration = 100000
const int64_t XEM::defaultNbIteration = 200
const double XEM::minEpsilon = 0
const double XEM::maxEpsilon = 1
const double XEM::defaultEpsilon = 1.0E-3
const int64_t XEM::maxNbNbCluster = 10
const int64_t XEM::maxNbAlgo = 5
const int64_t XEM::defaultNbAlgo = 1
const int64_t XEM::maxNbStrategy = 10
const int64_t XEM::defaultNbStrategy = 1
const int64_t XEM::maxNbModel = 100
const int64_t XEM::defaultNbModel = 1
const int64_t XEM::maxNbCriterion = 4
const int64_t XEM::defaultNbCriterion = 1
const int64_t XEM::minNbTryInStrategy = 1
const int64_t XEM::maxNbTryInStrategy = 100
const int64_t XEM::defaultNbTryInStrategy = 1
const int64_t XEM::nbTryInDefaultClusteringStrategy = 1
const int64_t XEM::minNbTryInInit = 1
const int64_t XEM::maxNbTryInInit = 1000
const int64_t XEM::defaultNbTryInInit = 10
const int64_t XEM::minNbIterationInInit = 1
const int64_t XEM::maxNbIterationInInit = 1000
const int64_t XEM::defaultNbIterationInInit = 5
const int64_t XEM::defaultNbIterationInInitForSemMax = 100
const double XEM::minEpsilonInInit = 0
const double XEM::maxEpsilonInInit = 1
const double XEM::defaultEpsilonInInit = 0.001
const int64_t XEM::maxNbIterationInCEM_INIT = 100
const double XEM::minOverflow = std::numeric_limits<double>::min()
const double XEM::minUnderflow = std::numeric_limits<double>::min()
const int64_t XEM::nbMaxSelection = 5
const int64_t XEM::maxNbOutputFiles = 52
const int64_t XEM::nbTestOutputFiles = 7
const double XEM::defaultFluryEpsilon = 0.001
const int64_t XEM::maxFluryIter = 7
const double XEM::minDeterminantValue
const double XEM::maxRelativeDiffValueTest = 1.0E-5
const double XEM::maxAbsoluteDiffValueTest = 1.0E-8
const int64_t XEM::defaultDCVnumberOfBlocks = 10
const int64_t XEM::defaultCVnumberOfBlocks = 10
const double XEM::minValueForLLandLLOne = 1.e-10
const int64_t XEM::int64_t_max = std::numeric_limits<int64_t>::max()
const int64_t XEM::nbQualitativeGraphics = 2
const int64_t XEM::nbQuantitativeGraphics = 3
const CVinitBlocks XEM::defaultCVinitBlocks = CV_RANDOM
const DCVinitBlocks XEM::defaultDCVinitBlocks = DCV_RANDOM
const StrategyInitName XEM::defaultStrategyInitName = SMALL_EM
const StrategyInitName XEM::defaultClusteringStrategyInitName = SMALL_EM
const AlgoStopName XEM::defaultAlgoStopName = NBITERATION_EPSILON
const CriterionName XEM::defaultCriterionName = BIC
const CriterionName XEM::defaultLearnCriterionName = CV
const AlgoName XEM::defaultAlgoName = EM
const AlgoName XEM::defaultClusteringAlgoName = EM
const int64_t XEM::nbFormatNumeric = 3
const FormatNumericFile XEM::FormatNumeric::defaultFormatNumericFile = txt
const TypePartition XEM::TypePartition::defaultTypePartition = label
const ModelName XEM::defaultGaussianModelName = Gaussian_pk_Lk_C
const ModelName XEM::defaultBinaryModelName = Binary_pk_Ekjh
const ModelName XEM::defaultGaussianHDDAModelName = Gaussian_HD_pk_AkjBkQkD
const ModelName XEM::defaultHeterogeneousModelName = Heterogeneous_pk_Ekjh_Lk_Bk

Detailed Description

Constants definitions, various utilities to describe models, and others...