stripe / rainier

Bayesian inference in Scala.
https://rainier.fit
Apache License 2.0
433 stars 51 forks source link

Events class with simulate method #367

Closed avibryant closed 5 years ago

avibryant commented 5 years ago

This follow-up to https://github.com/stripe/rainier/pull/365 changes the two observe methods that take functions so that instead of returning the bare function, they return a wrapper that provides a simulate method, which does the more complex thing the original version of that PR wanted to do (ie, take a Seq[X] and produce a Generator[Seq[(X,Y)]]). This seems like a nice compromise between the simplicity we ended up with and the convenience I was originally aiming for.

Here's an example use (taken from the Ch 4 notebook).

Screenshot 2019-08-31 at 9 19 22 AM

codecov-io commented 5 years ago

Codecov Report

Merging #367 into develop will increase coverage by 0.68%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #367      +/-   ##
=========================================
+ Coverage    46.32%    47%   +0.68%     
=========================================
  Files           85     85              
  Lines         3044   3106      +62     
  Branches       140    142       +2     
=========================================
+ Hits          1410   1460      +50     
- Misses        1634   1646      +12
Impacted Files Coverage Δ
...rc/main/scala/com/stripe/rainier/core/Events.scala 0% <0%> (ø) :arrow_up:
...c/main/scala/com/stripe/rainier/cats/package.scala 100% <0%> (ø) :arrow_up:
...main/scala/com/stripe/rainier/core/Generator.scala 85.29% <0%> (+0.04%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a1862f0...1e1a37c. Read the comment docs.