I am Charmie

メモとログ

mlpack: how to compute Gaussian probability density function

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

probability of a univariate Gaussian.
[sourcecode language="cpp"]
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);
[/sourcecode]

probability of a multivariate Gaussian. [sourcecode language="cpp"] 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); [/sourcecode]

a set of probabilities of a multivariate Gaussian. [sourcecode language="cpp"] 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. [/sourcecode]

probability of a multivariate Gaussian and its gradients [sourcecode language="cpp"] 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); [/sourcecode]