[mlpack-git] [mlpack/mlpack] GammaDistribution: Adds functionality to solve #749 (#751)

Ryan Curtin notifications at github.com
Fri Aug 5 23:35:43 EDT 2016


> +      // Compute probability using Multiplication Law and Logarithm addition
> +      // property.
> +      LogProbabilities(i) += std::log( 
> +        std::pow(observations(d, i), alpha(d) - 1) 
> +        * std::exp(-observations(d, i) / beta(d)) 
> +        / denominators(d));
> +    }
> +  }
> +}
> +
> +// Returns a gamma-random d-dimensional vector.
> +arma::vec GammaDistribution::Random() const
> +{
> +  arma::vec randVec(alpha.n_elem);
> +
> +  std::default_random_engine generator;

I think you should use `mlpack::math::randGen` here instead, so that if the user sets the random seed, the results when they call `GammaDistribution::Random()` are deterministic.  (`randGen` is defined in `mlpack/core/math/random.hpp`.)

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/751/files/9cb117f671f55186baddf38ce71107a2a3ae027f#r73780142
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160805/90dd6d51/attachment.html>


More information about the mlpack-git mailing list