|
libak
0.4.0
|
Data Structures | |
| struct | akClassHyp |
| Classification hypothesis. More... | |
Typedefs | |
| 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. | |
Functions | |
| 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 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
for every character sequence.
| void ak_classifier_free | ( | akClassifier * | cls | ) |
Frees memory.
Frees the memory allocated for the classifier.
| cls | The 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.
| cmodel | The character models used to classify. |
| lexicon | The lexicon used to classify. |
| priors | The prior probabilities used to classify. |
| callback | A callback function used to capture the calculated probabilities during the classification process. It can be NULL. |
| err | Pointer to string variable. If not NULL an error message is allocated in the variable in case of error. |
| udata | User data passed to the callback function. |
| 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:
where
is the given sample and
is a valid pair of character sequence and class. The probability
is approximated using the Viterbi algorithm. This function can be used to obtain the N most probable pairs
or hypothesis. The variable hyps must contain the enough memory to allocate N hypothesis.
| cls | The classifier. |
| fea | A feature vector manager, which must contain a sequence of feature vectors of an adequate type for the cmodel. |
| hyps | An array with enough memory to allocate the required hypothesis. |
| N | Number of required hypothesis. |
1.7.6.1