[mlpack-git] master: Fix error in random sample generation. (bba6f35)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:55:40 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit bba6f3572271937cedf61796a3dd65b88b8fd12a
Author: Ryan Curtin <ryan at ratml.org>
Date: Fri Aug 1 16:30:43 2014 +0000
Fix error in random sample generation.
>---------------------------------------------------------------
bba6f3572271937cedf61796a3dd65b88b8fd12a
src/mlpack/core/dists/laplace_distribution.hpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/mlpack/core/dists/laplace_distribution.hpp b/src/mlpack/core/dists/laplace_distribution.hpp
index 63aa7f4..59fa17f 100644
--- a/src/mlpack/core/dists/laplace_distribution.hpp
+++ b/src/mlpack/core/dists/laplace_distribution.hpp
@@ -93,12 +93,10 @@ class LaplaceDistribution
// elementwise.
for (size_t i = 0; i < result.n_elem; ++i)
{
- if (result[i] < 0)
- result[i] = mean[i] + scale * result[i] * std::log(1 + 2.0 * (result[i]
- - 0.5));
+ if (result[i] < 0.5)
+ result[i] = mean[i] + scale * std::log(1 + 2.0 * (result[i] - 0.5));
else
- result[i] = mean[i] - scale * result[i] * std::log(1 - 2.0 * (result[i]
- - 0.5));
+ result[i] = mean[i] - scale * std::log(1 - 2.0 * (result[i] - 0.5));
}
return result;
More information about the mlpack-git
mailing list