Closed turion closed 2 years ago
Ah, but SMC2
is a MonadSample
instance. Here's an example from the tests of how to run smc2
:
population $ smc2 0 100 100 100 random (normal 0)
The whole idea of monad-bayes is that you write programs of type MonadInfer m => m X
, which various different inference algorithms then specialize. In this case, you are supplying a MonadSample m => m Double
and a MonadSample m => Double -> m Double
, rather than anything concretely in SMC2
. In fact, it's intentional not to expose SMC2
Ah, ok. It's still hard to discover this fact, because since the type SMC2
is not exported, its haddocks are not displayed on hackage, so one cannot know that MonadSample SMC2
.
Ah, that's a good point. To be honest, SMC2 was complicated enough that I didn't get to the point of making documentation or examples for it, as I did with the others. But I agree that's a problem - let me see if I can find a good solution, maybe by adding comments to the hackage docs
How about exporting the type SMC2
without exporting the constructor? Then people can only create values of type SMC2 a
by using its instances, but its haddocks are there.
Plus, it appears on the hoogle and hackage searches!
Excellent idea, let me do that!
Resolved
Looking at https://hackage.haskell.org/package/monad-bayes-0.1.1.0/docs/Control-Monad-Bayes-Inference-SMC2.html, it seems that to use this inference method, I have to supply a function of type
b -> S (P (SMC2 m)) a
, but the typeSMC2
and its constructors are not exported. It seems to me that this is thus not usable.