PocketSphinx  5prealpha
ms_gauden.h File Reference

(Sphinx 3.0 specific) Gaussian density module. More...

#include <sphinxbase/feat.h>
#include <sphinxbase/logmath.h>
#include <sphinxbase/cmd_ln.h>
#include "vector.h"
#include "pocketsphinx_internal.h"
#include "hmm.h"

Go to the source code of this file.

Data Structures

struct  gauden_dist_t
 Structure to store distance (density) values for a given input observation wrt density values in some given codebook. More...
 
struct  gauden_t
 Multivariate gaussian mixture density parameters. More...
 

Functions

gauden_tgauden_init (char const *meanfile, char const *varfile, float32 varfloor, logmath_t *lmath)
 Read mixture gaussian codebooks from the given files. More...
 
void gauden_free (gauden_t *g)
 Release memory allocated by gauden_init. More...
 
int32 gauden_mllr_transform (gauden_t *s, ps_mllr_t *mllr, cmd_ln_t *config)
 Transform Gaussians according to an MLLR matrix (or, eventually, more). More...
 
int32 gauden_dist (gauden_t *g, int mgau, int n_top, mfcc_t **obs, gauden_dist_t **out_dist)
 Compute gaussian density values for the given input observation vector wrt the specified mixture gaussian codebook (which may consist of several feature streams). More...
 
void gauden_dump (const gauden_t *g)
 Dump the definitionn of Gaussian distribution. More...
 
void gauden_dump_ind (const gauden_t *g, int senidx)
 Dump the definition of Gaussian distribution of a particular index to the standard output stream. More...
 

Detailed Description

(Sphinx 3.0 specific) Gaussian density module.

Gaussian density distribution implementation. There are two major difference bettwen ms_gauden and cont_mgau. One is the fact that ms_gauden only take cares of the Gaussian computation part where cont_mgau actually take care of senone computation as well. The other is the fact that ms_gauden is a multi-stream implementation of GMM computation.

Definition in file ms_gauden.h.

Function Documentation

int32 gauden_dist ( gauden_t g,
int  mgau,
int  n_top,
mfcc_t **  obs,
gauden_dist_t **  out_dist 
)

Compute gaussian density values for the given input observation vector wrt the specified mixture gaussian codebook (which may consist of several feature streams).

Density values are left UNnormalized.

Returns
0 if successful, -1 otherwise.
Parameters
gIn: handle to entire ensemble of codebooks
mgauIn: codebook for which density values to be evaluated (g->{mean,var}[mgau])
n_topIn: Number top densities to be evaluated
obsIn: Observation vector; obs[f] = for feature f
out_distOut: n_top best codewords and density values, in worsening order, for each feature stream. out_dist[f][i] = i-th best density for feature f. Caller must allocate memory for this output
void gauden_dump ( const gauden_t g)

Dump the definitionn of Gaussian distribution.

Parameters
gIn: Gaussian distribution g

Definition at line 58 of file ms_gauden.c.

References gauden_dump_ind(), and gauden_t::n_mgau.

void gauden_dump_ind ( const gauden_t g,
int  senidx 
)

Dump the definition of Gaussian distribution of a particular index to the standard output stream.

Parameters
gIn: Gaussian distribution g
senidxIn: The senone index of the Gaussian

Definition at line 68 of file ms_gauden.c.

References gauden_t::det, gauden_t::featlen, gauden_t::mean, gauden_t::n_density, gauden_t::n_feat, and gauden_t::var.

Referenced by gauden_dump().

void gauden_free ( gauden_t g)

Release memory allocated by gauden_init.

In: The gauden_t to free

Definition at line 358 of file ms_gauden.c.

References gauden_t::det, gauden_t::featlen, gauden_t::mean, and gauden_t::var.

Referenced by gauden_init().

gauden_t* gauden_init ( char const *  meanfile,
char const *  varfile,
float32  varfloor,
logmath_t *  lmath 
)

Read mixture gaussian codebooks from the given files.

Allocate memory space needed for them. Apply the specified variance floor value. Return value: ptr to the model created; NULL if error. (See Sphinx3 model file-format documentation.)

Parameters
meanfileInput: File containing means of mixture gaussians
varfileInput: File containing variances of mixture gaussians
varfloorInput: Floor value to be applied to variances

Definition at line 311 of file ms_gauden.c.

References gauden_t::featlen, gauden_free(), gauden_t::lmath, gauden_t::mean, gauden_t::n_density, gauden_t::n_feat, gauden_t::n_mgau, and gauden_t::var.

int32 gauden_mllr_transform ( gauden_t s,
ps_mllr_t mllr,
cmd_ln_t *  config 
)

Transform Gaussians according to an MLLR matrix (or, eventually, more).

Definition at line 509 of file ms_gauden.c.

References ps_mllr_s::A, ps_mllr_s::b, gauden_t::det, gauden_t::featlen, ps_mllr_s::h, gauden_t::lmath, gauden_t::mean, gauden_t::n_density, gauden_t::n_feat, gauden_t::n_mgau, and gauden_t::var.