JWS C Library
C language utility library
|
Multinomial mixture model and parameter fitting using EM. More...
#include <jwsc/config.h>
#include <stdlib.h>
#include <inttypes.h>
#include "jwsc/vector/vector.h"
#include "jwsc/matrix/matrix.h"
#include "jwsc/matblock/matblock.h"
Go to the source code of this file.
Functions | |
double | mmm_log_likelihood_d (const Matblock_d *mu, const Vector_d *pi, const Matblock_u32 *x) |
Computes the double precision multinomial mixture model log-likelihood. | |
void | mmm_kmeans_init_d (Matblock_d **mu_out, Vector_d **pi_out, const Matblock_u32 *x, uint32_t K) |
Initializes the double precision multinomial mixture model using the kmeans clustering algorithm. | |
void | train_mmm_d (Matblock_d **mu_out, Vector_d **pi_out, Matrix_d **gamma_out, const Matblock_u32 *x, uint32_t K) |
Trains a double precision multinomial mixture model. |
Multinomial mixture model and parameter fitting using EM.
The multinomials are represented as a set of binary variables.
Definition in file mmm.h.
double mmm_log_likelihood_d | ( | const Matblock_d * | mu, |
const Vector_d * | pi, | ||
const Matblock_u32 * | x | ||
) |
void mmm_kmeans_init_d | ( | Matblock_d ** | mu_out, |
Vector_d ** | pi_out, | ||
const Matblock_u32 * | x, | ||
uint32_t | K | ||
) |
Initializes the double precision multinomial mixture model using the kmeans clustering algorithm.
If one of the arguments is already allocated, it is assumed to be initialized as well.
Minimum cluster membership is 1 sample.
mu_out | Multivariate multinomial parameters. |
pi_out | Mixture component weights. |
x | Data. |
K | Number of mixture components. |
void train_mmm_d | ( | Matblock_d ** | mu_out, |
Vector_d ** | pi_out, | ||
Matrix_d ** | gamma_out, | ||
const Matblock_u32 * | x, | ||
uint32_t | K | ||
) |
Trains a double precision multinomial mixture model.
If *mu_out and *pi_out are not initialized, mmm_kmeans_init_d() is used to do so.
mu_out | Result parameter. Parameters for mixture components. |
pi_out | Result parameter. Mixture component weights. |
gamma_out | Optional result parameter. Responsibilities of each mixture component per sample. If NULL, the variable is ignored. |
x | Data to train the MMM with. |
K | Number of mixture components. |