libak  0.4.0
Data Structures | Defines | Enumerations | Functions
Character models (HMMs)
Models

Data Structures

struct  akCModelTransListEdge
 Transitions in type LIST. More...
struct  akCModelTransListState
 Outgoing transitions for type LIST. More...
union  akCModelTrans
 HMM transitions. More...
struct  akCModelChar
 HMM. More...
struct  akCModel
 Character models. More...

Defines

#define ak_cmodel_get_fea_type(CMODEL)   (CMODEL)->meths->get_fea_type ( (CMODEL)->global )
 Gets the feature type.
#define ak_cmodel_test(CMODEL, FEA, ERR)   (CMODEL)->meths->test ( (CMODEL)->global, (FEA), (ERR) )
 Tests sample compatibility.

Enumerations

enum  akCModelTransType { , AKLINEAL, AKLIST, AKPOINTER }
 Type of HMM transitions. More...

Functions

akCModelak_cmodel_copy (const akCModel *cmodel)
 Copies character models.
void ak_cmodel_free (akCModel *cmodel)
 Frees memory.
akCModelak_cmodel_mixture_new (const akCModel *cmodel)
 Creates a new set of mixture character models.
akCModelak_cmodel_new_from_file (FILE *from, akDict *syms, char **err)
 Reads character models from a file.
void ak_cmodel_print (const akCModel *cmodel, FILE *to, const akDict *syms, const akBool binary)
 Prints the character models.
void ak_cmodel_smooth (akCModel *cmodel, const akFloat f, const akBool smooth_trans)
 Smooth parameters of character models.
const akDictak_cmodel_tiedstates_get_names (const akCModel *cmodel)
 Returns the names of the tied states.
akCModelak_cmodel_tiedstates_mixture_new (const akCModel *cmodel)
 Creates a new set of tiedstates mixture character models.
akCModelak_cmodel_bernoulli_new (const akDict *syms, const unsigned int Q, const unsigned int D)
 Creates a new set of Bernoulli character models.
akCModelak_cmodel_bernoulli_new_vs (const akDict *syms, const unsigned int *Qs, const unsigned int D)
 Creates a new set of Bernoulli character models with variable states.
akCModelak_cmodel_dgaussian_new (const akDict *syms, const unsigned int Q, const unsigned int D)
 Creates a new set of diagonal Gaussian character models.
akCModelak_cmodel_dgaussian_new_vs (const akDict *syms, const unsigned int *Qs, const unsigned int D)
 Creates a new set of diagonal Gaussian character models with variable states.
akFloatak_cmodel_dgaussian_get_smooth (akCModel *cmodel)
 Gets a pointer to the smooth array.

Define Documentation

#define ak_cmodel_get_fea_type (   CMODEL)    (CMODEL)->meths->get_fea_type ( (CMODEL)->global )

Gets the feature type.

This macro returns the type of the feature vectors supported by the given character models.

Parameters:
CMODELThe character models.
Returns:
The type of the supported feature vectors.
#define ak_cmodel_test (   CMODEL,
  FEA,
  ERR 
)    (CMODEL)->meths->test ( (CMODEL)->global, (FEA), (ERR) )

Tests sample compatibility.

This macro tests if the given feature vector sequence is compatible with the provided character models.

Parameters:
CMODELThe character models.
FEAA feature vectors manager, which must contain a sequence of feature vectors of an adequate type for the CMODEL.
ERRPointer to string variable. If not NULL an error message is allocated in the variable in case of error.
Returns:
TRUE if the sample is compatible, FALSE in other case.

Enumeration Type Documentation

Type of HMM transitions.

Enumerator:
AKLINEAL 

Lineal topology.

Only transitions to the next state and current state are allowed.

AKLIST 

Open topology.

Transitions for each state are stored as a list.

AKPOINTER 

Reference to previous HMM.

The transition matrix of the referenced HMM is used.


Function Documentation

akCModel* ak_cmodel_bernoulli_new ( const akDict syms,
const unsigned int  Q,
const unsigned int  D 
)

Creates a new set of Bernoulli character models.

This functions creates a new set of Bernoulli characters models. For each symbol of the provided dictionary a new Bernoulli character model with Q states and D-dimensional feature vectors is created.

Parameters:
symsNon empty dictionary in which characters are registered.
QThe number of states for the new Bernoulli character models.
DThe dimension of feature vector for the new Bernoulli character models.
Returns:
The Bernoulli character models.
akCModel* ak_cmodel_bernoulli_new_vs ( const akDict syms,
const unsigned int *  Qs,
const unsigned int  D 
)

Creates a new set of Bernoulli character models with variable states.

This functions creates a new set of Bernoulli characters models. For each symbol of the provided dictionary a new Bernoulli character model with D-dimensional feature vector is created. An array of size syms->N is provided in order to indicate the number of states for each character model.

Parameters:
symsNon empty dictionary in which characters are registered.
QsAn array with the number of states for each character of the dictionary.
DThe dimension of feature vector for the new Bernoulli character models.
Returns:
The Bernoulli character models.
akCModel* ak_cmodel_copy ( const akCModel cmodel)

Copies character models.

This function create a new copy of the provided set of character models.

Parameters:
cmodelThe character models to copy.
Returns:
The character models copy.

Gets a pointer to the smooth array.

This function gets a pointer to the smooth array of a diagonal Gaussian character models. The content of the array can be modified but the pointer can't be freed.

Parameters:
cmodelThe diagonal Gaussian character models.
akCModel* ak_cmodel_dgaussian_new ( const akDict syms,
const unsigned int  Q,
const unsigned int  D 
)

Creates a new set of diagonal Gaussian character models.

This functions creates a new set of diagonal Gaussian characters models. For each symbol of the provided dictionary a new diagonal Gaussian character model with Q states and D-dimensional feature vectors is created.

Parameters:
symsNon empty dictionary in which characters are registered.
QThe number of states for the new diagonal Gaussian character models.
DThe dimension of feature vector for the new diagonal Gaussian character models.
Returns:
The diagonal Gaussian character models.
akCModel* ak_cmodel_dgaussian_new_vs ( const akDict syms,
const unsigned int *  Qs,
const unsigned int  D 
)

Creates a new set of diagonal Gaussian character models with variable states.

This functions creates a new set of diagonal Gaussian characters models. For each symbol of the provided dictionary a new diagonal Gaussian character model with D-dimensional feature vector is created. An array of size syms->N is provided in order to indicate the number of states for each character model.

Parameters:
symsNon empty dictionary in which characters are registered.
QsAn array with the number of states for each character of the dictionary.
DThe dimension of feature vector for the new diagonal Gaussian character models.
Returns:
The diagonal Gaussian character models.
void ak_cmodel_free ( akCModel cmodel)

Frees memory.

Frees the memory allocated for the character models.

Parameters:
cmodelThe character models.
akCModel* ak_cmodel_mixture_new ( const akCModel cmodel)

Creates a new set of mixture character models.

This function creates a new equivalent mixture version of the set of characters models provided. That is, each probability emission function T is replaced by a one component T mixture probability function.

Parameters:
cmodelThe character models.
Returns:
A new equivalent mixture version of the provided character models.
akCModel* ak_cmodel_new_from_file ( FILE *  from,
akDict syms,
char **  err 
)

Reads character models from a file.

This functions creates a new set of characters models from a text description or binary representation. The characters (symbols) are registered into the given dictionary, which must be initially empty.

Parameters:
fromFile where the text description or binary representation is stored.
symsEmpty dictionary in which characters are registered.
errPointer to string variable. If not NULL an error message is allocated in the variable in case of error.
Returns:
The character models, or NULL in case of error.
void ak_cmodel_print ( const akCModel cmodel,
FILE *  to,
const akDict syms,
const akBool  binary 
)

Prints the character models.

This function writes in the given file the content of the character models. Each character model is labeled according to the provided dictionary. If binary is FALSE the content is written in text format, else it is written in binary format. The binary format is not a compact nor portable representation, but a way to ensure that parameters are written as they are stored in memory.

Parameters:
cmodelThe character models.
toFile where the models are written.
symsA dictionary with the labels of the character models.
binaryIf false the models are written in text format, else in binary format.
void ak_cmodel_smooth ( akCModel cmodel,
const akFloat  f,
const akBool  smooth_trans 
)

Smooth parameters of character models.

This function is a common interface to smooth the parameters of character models regardless of the emission probability functions type. Diagonal Gaussian distributions are not affected by this function, instead they are smoothed using the SMOOTH values in the model description during parameter updating, the variances are floored to the SMOOTH values. Probability parameters are linearly interpolated with the uniform distribution using F.

Parameters:
cmodelThe character models.
fWeight used to perform a lineal interpolation with the uniform distribution (p*(1-f) + 0.5*f).
smooth_transIf TRUE the transition probabilities are smoothed.
const akDict* ak_cmodel_tiedstates_get_names ( const akCModel cmodel)

Returns the names of the tied states.

This function returns the dictionary containing the names of the tied states.

Parameters:
cmodelThe character models.
Returns:
The dictionary containing the names, or NULL if character models are not of type TiedStates.

Creates a new set of tiedstates mixture character models.

Given a TiedStates character model set, this function create an equivalent tiedstate version in which each probability emission T is replaced by a one component T mixture probability function.

Parameters:
cmodelThe TiedStates character models.
Returns:
A new equivalent mixture version of the provided TiedStates character models.
 All Data Structures Variables