---
name: "mlpack_gmm"
section: "3"
platform: "linux"
package: "mlpack-doc"
version: "1.0.10-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/mlpack_gmm/3"
---

# mlpack\_gmm(3)

Gaussian Mixture Models.

## NAME

mlpack::gmm -

Gaussian Mixture Models.

## SYNOPSIS

### Classes

class **DiagonalConstraint**\
 *Force a covariance matrix to be diagonal.*  class **EigenvalueRatioConstraint**\
 *Given a vector of eigenvalue ratios, ensure that the covariance matrix always has those eigenvalue ratios.*  class **EMFit**\
 *This class contains methods which can fit a* **GMM** *to observations using the EM algorithm.*  class **GMM**\
 *A Gaussian Mixture Model (***GMM***).*  class **NoConstraint**\
 *This class enforces no constraint on the covariance matrix.*  class **PositiveDefiniteConstraint**\
 *Given a covariance matrix, force the matrix to be positive definite.*

### Functions

double **phi** (const double x, const double mean, const double var)\
 *Calculates the univariate Gaussian probability density function.*  double **phi** (const arma::vec &x, const arma::vec &mean, const arma::mat &cov)\
 *Calculates the multivariate Gaussian probability density function.*  double **phi** (const arma::vec &x, const arma::vec &mean, const arma::mat &cov, const std::vector\< arma::mat \> &d\_cov, arma::vec &g\_mean, arma::vec &g\_cov)\
 *Calculates the multivariate Gaussian probability density function and also the gradients with respect to the mean and the variance.*  void **phi** (const arma::mat &x, const arma::vec &mean, const arma::mat &cov, arma::vec &probabilities)\
 *Calculates the multivariate Gaussian probability density function for each data point (column) in the given matrix, with respect to the given mean and variance.*

## Detailed Description

Gaussian Mixture Models.

## Function Documentation

### double mlpack::gmm::phi (const doublex, const doublemean, const doublevar)` [inline]`

Calculates the univariate Gaussian probability density function. Example use:

```
double x, mean, var;
....
double f = phi(x, mean, var);
```

**Parameters:**

*x* Observation. \
 *mean* Mean of univariate Gaussian. \
 *var* Variance of univariate Gaussian.

**Returns:**

Probability of x being observed from the given univariate Gaussian.

Definition at line 46 of file phi.hpp.

References M\_PI.

Referenced by mlpack::distribution::GaussianDistribution::Probability().

### double mlpack::gmm::phi (const arma::vec &x, const arma::vec &mean, const arma::mat &cov)` [inline]`

Calculates the multivariate Gaussian probability density function. Example use:

```
extern arma::vec x, mean;
extern arma::mat cov;
....
double f = phi(x, mean, cov);
```

**Parameters:**

*x* Observation. \
 *mean* Mean of multivariate Gaussian. \
 *cov* Covariance of multivariate Gaussian.

**Returns:**

Probability of x being observed from the given multivariate Gaussian.

Definition at line 68 of file phi.hpp.

References M\_PI.

### double mlpack::gmm::phi (const arma::vec &x, const arma::vec &mean, const arma::mat &cov, const std::vector\< arma::mat \> &d\_cov, arma::vec &g\_mean, arma::vec &g\_cov)` [inline]`

Calculates the multivariate Gaussian probability density function and also the gradients with respect to the mean and the variance. Example use:

```
extern arma::vec x, mean, g_mean, g_cov;
std::vector<arma::mat> d_cov; // the dSigma
....
double f = phi(x, mean, cov, d_cov, &g_mean, &g_cov);
```

Definition at line 94 of file phi.hpp.

References M\_PI.

### void mlpack::gmm::phi (const arma::mat &x, const arma::vec &mean, const arma::mat &cov, arma::vec &probabilities)` [inline]`

Calculates the multivariate Gaussian probability density function for each data point (column) in the given matrix, with respect to the given mean and variance.

**Parameters:**

*x* List of observations. \
 *mean* Mean of multivariate Gaussian. \
 *cov* Covariance of multivariate Gaussian. \
 *probabilities* Output probabilities for each input observation.

Definition at line 138 of file phi.hpp.

References M\_PI.

## Author

Generated automatically by Doxygen for MLPACK from the source code.
