mlpack: how to compute Gaussian probability density function

mlpack::gmm::phi() computes univariate/multivariate Gaussian probability density functions.

probability of a univariate Gaussian.
double mlpack::gmm::phi(
    const double x,    // Observation.
    const double mean, // Mean of univariate Gaussian.
    const double var   // Variance of univariate Gaussian.
) // returns Probability of x being observed from the given univariate Gaussian.
// Example usage
    double x, mean, var;
    ....
    double f = phi(x, mean, var);

probability of a multivariate Gaussian.

double mlpack::gmm::phi(
     const arma::vec &      x,    // Observation.
    const arma::vec &      mean, // Mean of multivariate Gaussian.
    const arma::mat &      cov      // Covariance of multivariate Gaussian.
) // returns Probability of x being observed from the given multivariate Gaussian.
// Example usage
    arma::vec x, mean;
    arma::mat cov;
    ....
    double f = phi(x, mean, cov);

a set of probabilities of a multivariate Gaussian.

void mlpack::gmm::phi(
     const arma::mat &      x,            // List of observations.
    const arma::vec &      mean,         // Mean of multivariate Gaussian.
    const arma::mat &      cov,          // Covariance of multivariate Gaussian.
    arma::vec &      probabilities    // Output probabilities for each input observation.
) // Calculates the multivariate Gaussian probability density function for each data point (column) in the given matrix, with respect to the given mean and variance.

probability of a multivariate Gaussian and its gradients

double mlpack::gmm::phi(
     const arma::vec &      x,    // Observation.
    const arma::vec &      mean, // Mean of multivariate Gaussian.
    const arma::mat &      cov,  // Covariance of multivariate Gaussian.
    const std::vector< arma::mat > & d_cov,  //
    arma::vec &                         g_mean, // gradients w.r.t. the mean
    arma::vec &                         g_cov     // gradients w.r.t. the covariance
) // Calculates the multivariate Gaussian probability density function and also the gradients with respect to the mean and the variance.
// Example usage
    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);
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s