[mlpack] [mlpack/mlpack] adds GammaDistribution::Train(observations, probabilities) (#834)

Ryan Curtin notifications at github.com
Thu Dec 22 10:11:29 EST 2016


rcurtin commented on this pull request.



> +  for(size_t i = 0; i < N; i++)
+    probabilities(i) = prob(generator);
+
+  // fit results with probabilities and data
+  GammaDistribution gDist;
+  gDist.Train(rdata, probabilities);
+
+  // fit results with only data
+  GammaDistribution gDist2;
+  gDist2.Train(rdata);
+
+  BOOST_REQUIRE_CLOSE(gDist2.Alpha(0), gDist.Alpha(0), 10);
+  BOOST_REQUIRE_CLOSE(gDist2.Beta(0), gDist.Beta(0), 10);
+
+  BOOST_REQUIRE_CLOSE(alphaReal, gDist.Alpha(0), 10);
+  BOOST_REQUIRE_CLOSE(betaReal, gDist.Beta(0), 10);

We can use a larger tolerance between the values of `alphaReal` and `betaReal` and the estimated values, due to the noisy sampling from the gamma distribution.  I still think 10% tolerance is a bit large.  But `gDist` and `gDist2` should have virtually identical values so the tolerance should be very small and 1e-5 should be fine.  If that is causing the tests to fail, then I think the implementation is incorrect.

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/834
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20161222/28e5361f/attachment-0001.html>


More information about the mlpack mailing list