libak  0.4.0
Data Structures | Typedefs | Functions
Classification of samples

Data Structures

struct  akClassHyp
 Classification hypothesis. More...


typedef void( akClassifyCallback )(void *udata, akProb prob_class, akProb prob_lexicon, akProb prob_sample, size_t class, const akCSeq *cs)
 Callback function for ak_classify.


void ak_classifier_free (akClassifier *cls)
 Frees memory.
akClassifier * ak_classifier_new (const akCModel *cmodel, const akLexicon *lexicon, const akPriors *priors, akClassifyCallback *callback, void *udata, char **err)
 Gets a Classifier.
unsigned int ak_classify (akClassifier *cls, const akFea *fea, akClassHyp *hyps, const unsigned int N)
 Classifies a sample.

Typedef Documentation

typedef void( akClassifyCallback)(void *udata,akProb prob_class,akProb prob_lexicon,akProb prob_sample,size_t class,const akCSeq *cs)

Callback function for ak_classify.

This callback is used to capture probability $p(c)p(e\mid c)p(x\mid e)$ for every character sequence.

Function Documentation

void ak_classifier_free ( akClassifier *  cls)

Frees memory.

Frees the memory allocated for the classifier.

clsThe classifier.
akClassifier* ak_classifier_new ( const akCModel cmodel,
const akLexicon lexicon,
const akPriors priors,
akClassifyCallback callback,
void *  udata,
char **  err 

Gets a Classifier.

This function creates a classifier used to classify samples. Currently supported types are: Bernoulli, DGaussian, Mixture and TiedStates.

cmodelThe character models used to classify.
lexiconThe lexicon used to classify.
priorsThe prior probabilities used to classify.
callbackA callback function used to capture the calculated probabilities during the classification process. It can be NULL.
errPointer to string variable. If not NULL an error message is allocated in the variable in case of error.
udataUser data passed to the callback function.
Classifier or NULL in case of error.
unsigned int ak_classify ( akClassifier *  cls,
const akFea fea,
akClassHyp hyps,
const unsigned int  N 

Classifies a sample.

This function classifies the given sample, feature vector sequence, according to the next expression: $(c,e)^*=\arg\max_{(c,e)} p(c)p(e\mid c)p(x\mid e)\, $ where $x$ is the given sample and $(c,e)$ is a valid pair of character sequence and class. The probability $p(x\mid e)$ is approximated using the Viterbi algorithm. This function can be used to obtain the N most probable pairs $(c,e)$ or hypothesis. The variable hyps must contain the enough memory to allocate N hypothesis.

clsThe classifier.
feaA feature vector manager, which must contain a sequence of feature vectors of an adequate type for the cmodel.
hypsAn array with enough memory to allocate the required hypothesis.
NNumber of required hypothesis.
The number of returned hypothesis.
 All Data Structures Variables