Classes | Functions
ms_gauden.h File Reference

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

#include <s3types.h>
#include <logmath.h>
#include "vector.h"

Go to the source code of this file.

Classes

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

Functions

gauden_tgauden_init (const char *meanfile, const char *varfile, float32 varfloor, int32 precompute, logmath_t *logmath)
 
void gauden_free (gauden_t *g)
 
int32 gauden_mean_reload (gauden_t *g, const char *meanfile)
 
int32 gauden_dist (gauden_t *g, s3mgauid_t mgau, int32 n_top, vector_t *obs, gauden_dist_t **out_dist)
 
int32 gauden_dist_norm (gauden_t *g, int32 n_top, gauden_dist_t ***dist, uint8 *active)
 
void gauden_dump (const gauden_t *g)
 
void gauden_dump_ind (const gauden_t *g, int senidx)
 

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.

Function Documentation

◆ gauden_dist()

int32 gauden_dist ( gauden_t g,
s3mgauid_t  mgau,
int32  n_top,
vector_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: #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

◆ gauden_dist_norm()

int32 gauden_dist_norm ( gauden_t g,
int32  n_top,
gauden_dist_t ***  dist,
uint8 *  active 
)

Normalize density values (previously computed by gauden_dist). Two cases: If (g->n_mgau == 1), normalize such that the sum of the n_top codeword scores for each feature in dist sums to 1 (in prob domain). Otherwise, normalize by dividing the density value (subtracting, in logprob domain) for each codeword by the best one.

Returns
scaling applied to every senone score as a result of the normalization.
Parameters
gIn: handle to all collection of codebooks
n_topIn: #density values computed per feature
distIn/Out: n_top density indices and values for each feature. On return, density values are normalized.
activeIn: active[gid] is non-0 iff codebook gid is active. If NULL, all codebooks active

◆ gauden_dump()

void gauden_dump ( const gauden_t g)

Dump the definitionn of Gaussian distribution.

Parameters
gIn: Gaussian distribution g

◆ gauden_dump_ind()

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

◆ gauden_free()

void gauden_free ( gauden_t g)

Release memory allocated by gauden_init. In: The gauden_t to free

◆ gauden_init()

gauden_t* gauden_init ( const char *  meanfile,
const char *  varfile,
float32  varfloor,
int32  precompute,
logmath_t *  logmath 
)

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
precomputeInput: Whether we should precompute

◆ gauden_mean_reload()

int32 gauden_mean_reload ( gauden_t g,
const char *  meanfile 
)

Reload mixture Gaussian means from the given file. The means must have already been loaded at least once (using gauden_init).

Returns
0 if successful, -1 otherwise.
Parameters
gIn/Out: g->mean to be reloaded
meanfileIn: File to reload means from