StochHMM  v0.34
Flexible Hidden Markov Model C++ Library and Application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes
StochHMM::StateFuncs Class Reference

(**Adding in log space) More...

#include <userFunctions.h>

List of all members.

Public Member Functions

 StateFuncs ()
void assignTransitionFunction (std::string &, transitionFunc)
void assignTransitionFunction (const char *, transitionFunc)
void assignEmissionFunction (std::string &, emissionFunc)
void assignEmissionFunction (const char *, emissionFunc)
void assignPDFFunction (std::string &, pdfFunc)
void assignPDFFunction (const char *, pdfFunc)
void assignMultivariatePdfFunction (std::string &, multiPdfFunc)
void assignMultivariatePdfFunction (const char *, multiPdfFunc)
transitionFuncgetTransitionFunction (std::string &)
emissionFuncgetEmissionFunction (std::string &)
pdfFuncgetPDFFunction (std::string &)
multiPdfFuncgetMultivariatePdfFunction (std::string &)

Private Member Functions

void _loadUnivariatePdf ()
void _loadMultivariatePdf ()

Private Attributes

std::map< std::string,
transitionFunc
transitionFunctions
std::map< std::string,
emissionFunc
emissionFunctions
std::map< std::string, pdfFuncpdfFunctions
std::map< std::string,
multiPdfFunc
multiPdfFunctions

Detailed Description

(**Adding in log space)

The map stores the pointers to the different functions by const char* word. Allows the user to create and integrate their own functions into the model By specifying the name in the model, and assigning the ptr in the externalFuncs class. At any State or transition their function will be called and return float The float will then be applied in the trellis added to transition or emission. Stores pointers to user functions used by the State's Emissions and Transitions

Definition at line 75 of file userFunctions.h.


Constructor & Destructor Documentation

StochHMM::StateFuncs::StateFuncs ( )

Member Function Documentation

void StochHMM::StateFuncs::_loadMultivariatePdf ( )
private

Definition at line 275 of file userFunctions.cpp.

References assignMultivariatePdfFunction(), StochHMM::dirichlet_multi_pdf(), and StochHMM::ewens_multi_pdf().

Referenced by StateFuncs().

{
assignMultivariatePdfFunction("DIRICHLET",static_cast<double(*)(const std::vector<double>*, const std::vector<double>*)>(dirichlet_multi_pdf));
assignMultivariatePdfFunction("EWENS",static_cast<double(*)(const std::vector<double>*, const std::vector<double>*)>(ewens_multi_pdf));
}
void StochHMM::StateFuncs::_loadUnivariatePdf ( )
private

Definition at line 199 of file userFunctions.cpp.

References StochHMM::arcsine_pdf(), assignPDFFunction(), StochHMM::beta_binomial_pdf(), StochHMM::beta_negative_binomial_pdf(), StochHMM::beta_pdf(), StochHMM::beta_prime_pdf(), StochHMM::binomial_pdf(), StochHMM::cauchy_pdf(), StochHMM::chi_pdf(), StochHMM::chi_squared_pdf(), StochHMM::continuous_uniform_pdf(), StochHMM::dagum_pdf(), StochHMM::degenerate_pdf(), StochHMM::discrete_uniform_pdf(), StochHMM::exponential_pdf(), StochHMM::f_pdf(), StochHMM::fishers_z_pdf(), StochHMM::folded_normal_pdf(), StochHMM::frechet_pdf(), StochHMM::gamma_pdf(), StochHMM::generalized_extreme_value_pdf(), StochHMM::generalized_normal_pdf(), StochHMM::generalized_pareto_pdf(), StochHMM::geometric_pdf(), StochHMM::gumbel_pdf(), StochHMM::gumbel_type_one_pdf(), StochHMM::gumbel_type_two_pdf(), StochHMM::half_normal_pdf(), StochHMM::hyperbolic_secant_pdf(), StochHMM::hypergeometric_pdf(), StochHMM::inv_gamma_pdf(), StochHMM::inv_gaussian_pdf(), StochHMM::inverse_chi_squared_pdf(), StochHMM::kumaraswamy_pdf(), StochHMM::laplace_pdf(), StochHMM::levy_pdf(), StochHMM::log_cauchy_pdf(), StochHMM::log_laplace_pdf(), StochHMM::log_logistic_pdf(), StochHMM::log_normal_pdf(), StochHMM::logarithmic_pdf(), StochHMM::logistic_pdf(), StochHMM::logit_normal_pdf(), StochHMM::maxwell_boltzman_pdf(), StochHMM::nakagami_pdf(), StochHMM::negative_binomial_pdf(), StochHMM::normal_pdf(), StochHMM::pareto_pdf(), StochHMM::poisson_pdf(), StochHMM::raised_cosine_pdf(), StochHMM::rayleigh_pdf(), StochHMM::scaled_inverse_chi_squared_pdf(), StochHMM::standard_normal_pdf(), StochHMM::students_t_pdf(), StochHMM::triangular_pdf(), StochHMM::truncated_normal_pdf(), StochHMM::u_quadratic_pdf(), StochHMM::weibull_distribution(), StochHMM::wigner_semicircle_pdf(), StochHMM::yule_simon_pdf(), StochHMM::zipf_mandelbrot_pdf(), and StochHMM::zipf_pdf().

Referenced by StateFuncs().

{
//Discrete with finite support
assignPDFFunction("BINOMIAL", static_cast<double (*)(const double , const std::vector<double>*)> (binomial_pdf));
assignPDFFunction("BETA_BINOMIAL",static_cast<double (*)(const double, const std::vector<double>*)> (beta_binomial_pdf));
assignPDFFunction("DEGENERATE",static_cast<double (*)(const double, const std::vector<double>*)> (degenerate_pdf));
assignPDFFunction("DISCRETE_UNIFORM",static_cast<double (*)(const double, const std::vector<double>*)> (discrete_uniform_pdf));
assignPDFFunction("HYPERGEOMETRIC", static_cast<double (*)(const double, const std::vector<double>*)> (hypergeometric_pdf));
//Discrete with Infinite Support
assignPDFFunction("BETA_NEGATIVE_BINOMIAL", static_cast<double (*)(const double, const std::vector<double>*)> (beta_negative_binomial_pdf));
assignPDFFunction("MAXWELL_BOLTZMAN", static_cast<double (*)(const double, const std::vector<double>*)> (maxwell_boltzman_pdf));
assignPDFFunction("GEOMETRIC", static_cast<double (*)(const double, const std::vector<double>*)> (geometric_pdf));
assignPDFFunction("LOGARITHMIC", static_cast<double (*)(const double, const std::vector<double>*)> (logarithmic_pdf));
assignPDFFunction("NEGATIVE_BINOMIAL", static_cast<double (*)(const double, const std::vector<double>*)> (negative_binomial_pdf));
assignPDFFunction("POISSON", static_cast<double (*)(const double, const std::vector<double>*)> (poisson_pdf));
assignPDFFunction("YULE_SIMON", static_cast<double (*)(const double, const std::vector<double>*)> (yule_simon_pdf));
assignPDFFunction("ZIPF", static_cast<double (*)(const double, const std::vector<double>*)> (zipf_pdf));
assignPDFFunction("ZIPF-MANDELBROT", static_cast<double (*)(const double, const std::vector<double>*)> (zipf_mandelbrot_pdf));
//Continuous on bounded interval
assignPDFFunction("ARCSINE", static_cast<double (*)(const double, const std::vector<double>*)> (arcsine_pdf));
assignPDFFunction("BETA", static_cast<double (*)(const double, const std::vector<double>*)> (beta_pdf));
assignPDFFunction("LOGIT_NORMAL", static_cast<double (*)(const double, const std::vector<double>*)> (logit_normal_pdf));
assignPDFFunction("CONTINUOUS_UNIFORM", static_cast<double (*)(const double, const std::vector<double>*)> (continuous_uniform_pdf));
assignPDFFunction("KUMARASWAMY", static_cast<double (*)(const double, const std::vector<double>*)> (kumaraswamy_pdf));
assignPDFFunction("RAISED_COSINE", static_cast<double (*)(const double, const std::vector<double>*)> (raised_cosine_pdf));
assignPDFFunction("TRIANGULAR", static_cast<double (*)(const double, const std::vector<double>*)> (triangular_pdf));
assignPDFFunction("TRUNCATED_NORMAL", static_cast<double (*)(const double, const std::vector<double>*)> (truncated_normal_pdf));
assignPDFFunction("U_QUADRATIC", static_cast<double (*)(const double, const std::vector<double>*)> (u_quadratic_pdf));
assignPDFFunction("WIGNER_SEMICIRCLE", static_cast<double (*)(const double, const std::vector<double>*)> (wigner_semicircle_pdf));
//Continous on semi-bounded interval
assignPDFFunction("BETA_PRIME", static_cast<double (*)(const double, const std::vector<double>*)> (beta_prime_pdf));
assignPDFFunction("CHI", static_cast<double (*)(const double, const std::vector<double>*)> (chi_pdf));
assignPDFFunction("CHI_SQUARED", static_cast<double (*)(const double, const std::vector<double>*)> (chi_squared_pdf));
assignPDFFunction("INVERSE_CHI_SQUARED", static_cast<double (*)(const double, const std::vector<double>*)> (inverse_chi_squared_pdf));
assignPDFFunction("SCALED_INVERSE_CHI_SQUARED", static_cast<double (*)(const double, const std::vector<double>*)> (scaled_inverse_chi_squared_pdf));
assignPDFFunction("DAGUM", static_cast<double (*)(const double, const std::vector<double>*)> (dagum_pdf));
assignPDFFunction("EXPONENTIAL", static_cast<double (*)(const double, const std::vector<double>*)> (exponential_pdf));
assignPDFFunction("F_DIST", static_cast<double (*)(const double, const std::vector<double>*)> (f_pdf));
assignPDFFunction("FISHERS_Z", static_cast<double (*)(const double, const std::vector<double>*)> (fishers_z_pdf));
assignPDFFunction("FOLDED_NORMAL", static_cast<double (*)(const double, const std::vector<double>*)> (folded_normal_pdf));
assignPDFFunction("FRECHET", static_cast<double (*)(const double, const std::vector<double>*)> (frechet_pdf));
assignPDFFunction("GAMMA", static_cast<double (*)(const double, const std::vector<double>*)> (gamma_pdf));
assignPDFFunction("INVERSE_GAMMA", static_cast<double (*)(const double, const std::vector<double>*)> (inv_gamma_pdf));
assignPDFFunction("HALF_NORMAL", static_cast<double (*)(const double, const std::vector<double>*)> (half_normal_pdf));
assignPDFFunction("INVERSE_GAUSSIAN", static_cast<double (*)(const double, const std::vector<double>*)> (inv_gaussian_pdf));
assignPDFFunction("LEVY", static_cast<double (*)(const double, const std::vector<double>*)> (levy_pdf));
assignPDFFunction("LOG_CAUCHY", static_cast<double (*)(const double, const std::vector<double>*)> (log_cauchy_pdf));
assignPDFFunction("LOG_LAPLACE", static_cast<double (*)(const double, const std::vector<double>*)> (log_laplace_pdf));
assignPDFFunction("LOG_LOGISTIC", static_cast<double (*)(const double, const std::vector<double>*)> (log_logistic_pdf));
assignPDFFunction("LOG_NORMAL", static_cast<double (*)(const double, const std::vector<double>*)> (log_normal_pdf));
assignPDFFunction("PARETO", static_cast<double (*)(const double, const std::vector<double>*)> (pareto_pdf));
assignPDFFunction("NAKAGAMI", static_cast<double (*)(const double, const std::vector<double>*)> (nakagami_pdf));
assignPDFFunction("RAYLEIGH", static_cast<double (*)(const double, const std::vector<double>*)> (rayleigh_pdf));
assignPDFFunction("GUMBEL_TYPE_TWO", static_cast<double (*)(const double, const std::vector<double>*)> (gumbel_type_two_pdf));
assignPDFFunction("WEIBULL", static_cast<double (*)(const double, const std::vector<double>*)> (weibull_distribution));
//Continuous on unbounded interval
assignPDFFunction("CAUCHY", static_cast<double (*)(const double, const std::vector<double>*)> (cauchy_pdf));
assignPDFFunction("GUMBEL", static_cast<double (*)(const double, const std::vector<double>*)> (gumbel_pdf));
assignPDFFunction("GENERALIZED_NORMAL", static_cast<double (*)(const double, const std::vector<double>*)> (generalized_normal_pdf));
assignPDFFunction("HYPERBOLIC_SECANT", static_cast<double (*)(const double, const std::vector<double>*)> (hyperbolic_secant_pdf));
assignPDFFunction("LAPLACE", static_cast<double (*)(const double, const std::vector<double>*)> (laplace_pdf));
assignPDFFunction("LOGISTIC", static_cast<double (*)(const double, const std::vector<double>*)> (logistic_pdf));
assignPDFFunction("STANDARD_NORMAL", static_cast<double (*)(const double, const std::vector<double>*)> (standard_normal_pdf));
assignPDFFunction("NORMAL", static_cast<double (*)(const double, const std::vector<double>*)> (normal_pdf));
assignPDFFunction("STUDENT_T", static_cast<double (*)(const double, const std::vector<double>*)> (students_t_pdf));
assignPDFFunction("GUMBEL_TYPE_ONE", static_cast<double (*)(const double, const std::vector<double>*)> (gumbel_type_one_pdf));
assignPDFFunction("GENERALIZED_EXTREME_VALUE", static_cast<double (*)(const double, const std::vector<double>*)> (generalized_extreme_value_pdf));
assignPDFFunction("GENERALIZED_PARETO", static_cast<double (*)(const double, const std::vector<double>*)> (generalized_pareto_pdf));
}
void StochHMM::StateFuncs::assignEmissionFunction ( std::string &  str,
emissionFunc  ptrFunc 
)

Assign a emission function to the StateFuncs class

Parameters:
strName of function
ptrFuncpt2StateFunc to use for StateFunc

Definition at line 67 of file userFunctions.cpp.

References emissionFunctions.

Referenced by assignEmissionFunction().

{
if (emissionFunctions.count(str)==0){
emissionFunctions[str]=ptrFunc;
}
else{
std::cerr << "Function Name: " << str << " already exists. You need to choose a new function name that doesn't already exist. For reference here are a list of names already assigned as external functions\nAssigned Names:\n";
std::map<std::string,emissionFunc>::iterator it;
for(it=emissionFunctions.begin();it!=emissionFunctions.end();it++){
std::cerr << "\t" << it->first <<std::endl;
}
}
}
void StochHMM::StateFuncs::assignEmissionFunction ( const char *  str,
emissionFunc  ptrFunc 
)

Definition at line 83 of file userFunctions.cpp.

References assignEmissionFunction().

{
std::string st(str);
assignEmissionFunction(st, ptrFunc);
}
void StochHMM::StateFuncs::assignMultivariatePdfFunction ( std::string &  str,
multiPdfFunc  ptrFunc 
)

Assign a Multivariate Probability Distribution Function to the StateFuncs class

Parameters:
strName of function
ptrFuncPointer to pdfFunc to use for continuous emission

Definition at line 116 of file userFunctions.cpp.

References multiPdfFunctions.

Referenced by _loadMultivariatePdf(), and assignMultivariatePdfFunction().

{
if (multiPdfFunctions.count(str)==0){
multiPdfFunctions[str]=ptrFunc;
}
else{
std::cerr << "Function Name: " << str << " already exists. You need to choose a new function name that doesn't already exist. For reference here are a list of names already assigned as external functions\nAssigned Names:\n";
std::map<std::string,multiPdfFunc>::iterator it;
for(it=multiPdfFunctions.begin();it!=multiPdfFunctions.end();it++){
std::cerr << "\t" << it->first <<std::endl;
}
}
}
void StochHMM::StateFuncs::assignMultivariatePdfFunction ( const char *  str,
multiPdfFunc  ptrFunc 
)

Definition at line 131 of file userFunctions.cpp.

References assignMultivariatePdfFunction().

{
std::string st(str);
}
void StochHMM::StateFuncs::assignPDFFunction ( std::string &  str,
pdfFunc  ptrFunc 
)

Assign a Univariate Probability Distribution Function to the StateFuncs class

Parameters:
strName of function
ptrFuncPointer to pdfFunc to use for continuous emission

Definition at line 93 of file userFunctions.cpp.

References pdfFunctions.

Referenced by _loadUnivariatePdf(), and assignPDFFunction().

{
if (pdfFunctions.count(str)==0){
pdfFunctions[str]=ptrFunc;
}
else{
std::cerr << "Function Name: " << str << " already exists. You need to choose a new function name that doesn't already exist. For reference here are a list of names already assigned as external functions\nAssigned Names:\n";
std::map<std::string,pdfFunc>::iterator it;
for(it=pdfFunctions.begin();it!=pdfFunctions.end();it++){
std::cerr << "\t" << it->first <<std::endl;
}
}
}
void StochHMM::StateFuncs::assignPDFFunction ( const char *  str,
pdfFunc  ptrFunc 
)

Definition at line 108 of file userFunctions.cpp.

References assignPDFFunction().

{
std::string st(str);
assignPDFFunction(st, ptrFunc);
}
void StochHMM::StateFuncs::assignTransitionFunction ( std::string &  str,
transitionFunc  ptrFunc 
)

Assign a transition function to the StateFuncs class

Parameters:
strName of function
ptrFuncpt2StateFunc to use for StateFunc

Definition at line 40 of file userFunctions.cpp.

References transitionFunctions.

Referenced by assignTransitionFunction().

{
if (transitionFunctions.count(str)==0){
transitionFunctions[str]=ptrFunc;
}
else{
std::cerr << "Function Name: " << str << " already exists. You need to choose a new function name that doesn't already exist. For reference here are a list of names already assigned as external functions\nAssigned Names:\n";
std::map<std::string,transitionFunc>::iterator it;
for(it=transitionFunctions.begin();it!=transitionFunctions.end();it++){
std::cerr << "\t" << it->first <<std::endl;
}
}
};
void StochHMM::StateFuncs::assignTransitionFunction ( const char *  str,
transitionFunc  ptrFunc 
)

Definition at line 57 of file userFunctions.cpp.

References assignTransitionFunction().

{
std::string st(str);
};
emissionFunc * StochHMM::StateFuncs::getEmissionFunction ( std::string &  name)

Get pointer to function with given name

Parameters:
nameName of the function
Returns:
pt2StateFunc*

Definition at line 156 of file userFunctions.cpp.

References emissionFunctions.

Referenced by StochHMM::emissionFuncParam::emissionFuncParam(), and StochHMM::emissionFuncParam::parse().

{
if (emissionFunctions.count(name)){
return &emissionFunctions[name];
}
else{
std::cerr << "Function named: " << name << " was not initialized. " <<std::endl;
return NULL;
}
}
multiPdfFunc * StochHMM::StateFuncs::getMultivariatePdfFunction ( std::string &  name)

Get pointer to multivariate probability distribution function with given name

Parameters:
nameName of the function
Returns:
pdfFunc*

Definition at line 186 of file userFunctions.cpp.

References multiPdfFunctions.

Referenced by StochHMM::emm::parse().

{
if (multiPdfFunctions.count(name)){
return &multiPdfFunctions[name];
}
else{
std::cerr << "Function named: " << name << " was not initialized. " <<std::endl;
return NULL;
}
}
pdfFunc * StochHMM::StateFuncs::getPDFFunction ( std::string &  name)

Get pointer to Univariate probability distribution function with given name

Parameters:
nameName of the function
Returns:
pdfFunc*

Definition at line 171 of file userFunctions.cpp.

References pdfFunctions.

Referenced by StochHMM::emm::parse().

{
if (pdfFunctions.count(name)){
return &pdfFunctions[name];
}
else{
std::cerr << "Function named: " << name << " was not initialized. " <<std::endl;
return NULL;
}
}
transitionFunc * StochHMM::StateFuncs::getTransitionFunction ( std::string &  name)

Get pointer to function with given name

Parameters:
nameName of the function
Returns:
pt2StateFunc*

Definition at line 141 of file userFunctions.cpp.

References transitionFunctions.

Referenced by StochHMM::transitionFuncParam::parse().

{
if (transitionFunctions.count(name)){
return &transitionFunctions[name];
}
else{
std::cerr << "Function named: " << name << " was not initialized. " <<std::endl;
return NULL;
}
}

Member Data Documentation

std::map<std::string, emissionFunc> StochHMM::StateFuncs::emissionFunctions
private

Definition at line 100 of file userFunctions.h.

Referenced by assignEmissionFunction(), and getEmissionFunction().

std::map<std::string, multiPdfFunc> StochHMM::StateFuncs::multiPdfFunctions
private

Definition at line 102 of file userFunctions.h.

Referenced by assignMultivariatePdfFunction(), and getMultivariatePdfFunction().

std::map<std::string, pdfFunc> StochHMM::StateFuncs::pdfFunctions
private

Definition at line 101 of file userFunctions.h.

Referenced by assignPDFFunction(), and getPDFFunction().

std::map<std::string, transitionFunc> StochHMM::StateFuncs::transitionFunctions
private

Definition at line 99 of file userFunctions.h.

Referenced by assignTransitionFunction(), and getTransitionFunction().


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