JWS C Library
C language utility library
|
Bernoulli mixture model and parameter fitting using EM. More...
#include <jwsc/config.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include <inttypes.h>
#include "jwsc/base/limits.h"
#include "jwsc/vector/vector.h"
#include "jwsc/vector/vector_math.h"
#include "jwsc/matrix/matrix.h"
#include "jwsc/matrix/matrix_math.h"
#include "jwsc/matblock/matblock.h"
#include "jwsc/prob/mv_pmf.h"
#include "jwsc/stat/stat.h"
#include "jwsc/stat/kmeans.h"
#include "jwsc/stat/bmm.h"
Go to the source code of this file.
Functions | |
static void | bmm_e_step_d (const Matrix_d *mu, const Vector_d *pi, Matrix_d *gamma, const Matrix_u32 *x) |
E-step in the EM algorithm. | |
static void | bmm_m_step_d (Matrix_d *mu, Vector_d *pi, const Matrix_d *gamma, const Matrix_u32 *x) |
M-step in the EM algorithm. | |
double | bmm_log_likelihood_d (const Matrix_d *mu, const Vector_d *pi, const Matrix_u32 *x) |
Computes the double precision Bernoulli mixture model log-likelihood. | |
void | bmm_kmeans_init_d (Matrix_d **mu_out, Vector_d **pi_out, const Matrix_u32 *x, uint32_t K) |
Initializes the double precision Bernoulli mixture model using the kmeans clustering algorithm. | |
void | train_bmm_d (Matrix_d **mu_out, Vector_d **pi_out, const Matrix_u32 *x, uint32_t K) |
Trains a double precision Bernoulli mixture model. |
Bernoulli mixture model and parameter fitting using EM.
Definition in file bmm.c.
static void bmm_e_step_d | ( | const Matrix_d * | mu, |
const Vector_d * | pi, | ||
Matrix_d * | gamma, | ||
const Matrix_u32 * | x | ||
) | [static] |
static void bmm_m_step_d | ( | Matrix_d * | mu, |
Vector_d * | pi, | ||
const Matrix_d * | gamma, | ||
const Matrix_u32 * | x | ||
) | [static] |
double bmm_log_likelihood_d | ( | const Matrix_d * | mu, |
const Vector_d * | pi, | ||
const Matrix_u32 * | x | ||
) |
void bmm_kmeans_init_d | ( | Matrix_d ** | mu_out, |
Vector_d ** | pi_out, | ||
const Matrix_u32 * | x, | ||
uint32_t | K | ||
) |
Initializes the double precision Bernoulli 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 Bernoulli parameters. |
pi_out | Mixture component weights. |
x | Data. |
K | Number of mixture components. |
void train_bmm_d | ( | Matrix_d ** | mu_out, |
Vector_d ** | pi_out, | ||
const Matrix_u32 * | x, | ||
uint32_t | K | ||
) |
Trains a double precision Bernoulli mixture model.
If *mu_out and *pi_out are not initialized, bmm_kmeans_init_d() is used to do so.
mu_out | Result parameter. Parameters for mixture components. |
pi_out | Result parameter. Mixture component weights. |
x | Data to train the BMM with. |
K | Number of mixture components. |